diff --git a/.gitignore b/.gitignore index e69de29..d424b58 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/Nwchem-6.3.revision2-src.2013-10-17.tar.gz diff --git a/nwchem.spec b/nwchem.spec new file mode 100644 index 0000000..0d84865 --- /dev/null +++ b/nwchem.spec @@ -0,0 +1,483 @@ +%global upstream_name Nwchem + +%{?!major_version: %global major_version 6.3} +%{?!minor_version: %global minor_version 2} +%{?!posttag: %global posttag 2013-10-17} + +%ifarch %ix86 %arm +%global make64_to_32 0 +%global NWCHEM_TARGET LINUX +%endif +%ifarch x86_64 +%global make64_to_32 1 +%global NWCHEM_TARGET LINUX64 +# nwchem by default assumes that python is installed +# under lib on a 64 bit machine +%{?!USE_PYTHON64: %global USE_PYTHON64 1} +%endif + +# Global Arrays (part of Nwchem source) is FTBFS on ARM +# https://bugzilla.redhat.com/show_bug.cgi?id=964424 +ExcludeArch: %arm + +%if 0%{?el6} +%global mpich mpich2 +%global mpich_load %_mpich2_load +%global mpich_unload %_mpich2_unload +%else +%global mpich mpich +%global mpich_load %_mpich_load +%global mpich_unload %_mpich_unload +%endif + +# static (a) or shared (so) libpython.* +%global PYTHONLIBTYPE so + +%if 0%{?fedora} >= 21 +%global BLASOPT -L%{_libdir}/atlas -lsatlas +%else +%global BLASOPT -L%{_libdir}/atlas -lf77blas -lcblas -latlas +%endif + +Name: nwchem +Version: %{major_version}.%{minor_version} +Release: 6%{?dist} +Summary: Delivering High-Performance Computational Chemistry to Science + +License: ECL 2.0 +URL: http://www.nwchem-sw.org/ +# Nwchem changes naming convention of tarballs very often! +Source0: http://www.nwchem-sw.org/images/%{upstream_name}-%{major_version}.revision%{minor_version}-src.%{posttag}.tar.gz + +# https://fedoraproject.org/wiki/Packaging:Guidelines#Compiler_flags +# One needs to patch gfortran/gcc makefiles in order to use +# $RPM_OPT_FLAGS (= %%optflags), but an attempt resulted in broken +# executables http://koji.fedoraproject.org/koji/taskinfo?taskID=6429073 +# even after removing the -Werror=format-security flag +# https://bugzilla.redhat.com/show_bug.cgi?id=1037075 + + +%global PKG_TOP ${RPM_BUILD_DIR}/%{name}-%{major_version}.revision%{minor_version}-src.%{posttag} + +BuildRequires: time + +BuildRequires: python2-devel + +BuildRequires: gcc-gfortran + +BuildRequires: atlas-devel + +%if 0%{?fedora} || 0%{?rhel} >= 7 +BuildRequires: fdupes +%endif + +BuildRequires: libsysfs-devel +BuildRequires: ncurses-devel +BuildRequires: perl +BuildRequires: readline-devel +BuildRequires: tcsh +BuildRequires: zlib-devel + +BuildRequires: openssh-clients + +Requires: openssh-clients +Requires: %{name}-common = %{version}-%{release} + + +%global nwchem_desc_base \ +NWChem aims to provide its users with computational chemistry tools that are\ +scalable both in their ability to treat large scientific computational\ +chemistry problems efficiently, and in their use of available parallel\ +computing resources from high-performance parallel supercomputers to\ +conventional workstation clusters. + +%global nwchem_desc_cite \ +Please cite the following reference when\ +publishing results obtained with NWChem:\ +M. Valiev, E.J. Bylaska, N. Govind, K. Kowalski, T.P. Straatsma,\ +H.J.J. van Dam, D. Wang, J. Nieplocha, E. Apra, T.L. Windus, W.A. de Jong,\ +"NWChem: a comprehensive and scalable open-source solution for\ +large scale molecular simulations" Comput. Phys. Commun. 181, 1477 (2010) + + +%description +%{nwchem_desc_base} +%{nwchem_desc_cite} + + +%package openmpi +Summary: %{upstream_name} - openmpi version +BuildRequires: openmpi-devel +Requires: openmpi +Requires: %{name}-common = %{version}-%{release} + +%description openmpi +%{nwchem_desc_base} +%{nwchem_desc_cite} + +This package contains the openmpi version. + + +%package %{mpich} +Summary: %{upstream_name} - %{mpich} version +BuildRequires: %{mpich}-devel +Requires: %{mpich} +Requires: %{name}-common = %{version}-%{release} + +%description %{mpich} +%{nwchem_desc_base} +%{nwchem_desc_cite} + +This package contains the %{mpich} version. + + +%package common +Summary: %{upstream_name} - common files +BuildArch: noarch + +%description common +%{nwchem_desc_base} +%{nwchem_desc_cite} + +This package contains the data files. + + +%prep +%setup -q -n %{name}-%{major_version}.revision%{minor_version}-src.%{posttag} + + +%build +# base settings +echo "# see http://www.nwchem-sw.org/index.php/Compiling_NWChem" > settings.sh +echo export NWCHEM_TOP=%{PKG_TOP} >> settings.sh +echo export NWCHEM_TARGET=%{NWCHEM_TARGET} >> settings.sh +# +echo export CC=gcc >> settings.sh +echo export FC=gfortran >> settings.sh +# +echo export LARGE_FILES=TRUE >> settings.sh +echo export USE_NOFSCHECK=TRUE >> settings.sh +# +echo export PYTHONHOME=/usr >> settings.sh +echo export PYTHONVERSION=%{python_version} >> settings.sh +echo export PYTHONLIBTYPE=%{PYTHONLIBTYPE} >> settings.sh +%if 0%{?USE_PYTHON64} +echo export USE_PYTHON64=y >> settings.sh +%endif +echo export HAS_BLAS=yes >> settings.sh +echo export BLASOPT="'%{BLASOPT}'" >> settings.sh +echo export MAKE='%{__make}' >> settings.sh +echo '$MAKE nwchem_config NWCHEM_MODULES="all python" 2>&1 | tee ../make_nwchem_config.log' > make.sh +%if 0%{?make64_to_32} +echo '$MAKE 64_to_32 2>&1 | tee ../make_64_to_32.log' >> make.sh +echo 'export MAKEOPTS="USE_64TO32=y"' >> make.sh +%else +echo 'export MAKEOPTS=""' >> make.sh +%endif +# final make (log of ~200MB, don't write it) +echo '$MAKE ${MAKEOPTS} 2>&1' >> make.sh # | tee ../make.log' >> make.sh + +# Have to do off-root builds to be able to build many versions at once +mv src src.orig + +# To avoid replicated code define a macro +%global dobuild() \ +cd src; \ +cp -p ../settings.sh ../compile$MPI_SUFFIX.sh; \ +echo export LD_LIBRARY_PATH=$MPI_LIB >> ../compile$MPI_SUFFIX.sh; \ +echo export USE_MPI=y >> ../compile$MPI_SUFFIX.sh; \ +echo export USE_MPIF=y >> ../compile$MPI_SUFFIX.sh; \ +echo export USE_MPIF4=y >> ../compile$MPI_SUFFIX.sh; \ +echo export MPIEXEC=$MPI_BIN/mpiexec >> ../compile$MPI_SUFFIX.sh; \ +echo export MPI_LIB=$MPI_LIB >> ../compile$MPI_SUFFIX.sh; \ +echo export MPI_INCLUDE=$MPI_INCLUDE >> ../compile$MPI_SUFFIX.sh; \ +if [ "$MPI_SUFFIX" == "_openmpi" ] && [ -r "$MPI_LIB/libmpi_f90.so" ]; then echo export LIBMPI="'-lmpi -lmpi_f90 -lmpi_f77'" >> ../compile$MPI_SUFFIX.sh; fi; \ +if [ "$MPI_SUFFIX" == "_openmpi" ] && [ -r "$MPI_LIB/libmpi_usempi.so" ]; then echo export LIBMPI="'-lmpi -lmpi_usempi -lmpi_mpifh'" >> ../compile$MPI_SUFFIX.sh; fi; \ +if [ "$MPI_SUFFIX" == "_mpich2" ]; then echo export LIBMPI='-lmpich' >> ../compile$MPI_SUFFIX.sh; fi; \ +if [ "$MPI_SUFFIX" == "_mpich" ]; then echo export LIBMPI='-lmpich' >> ../compile$MPI_SUFFIX.sh; fi; \ +cat ../make.sh >> ../compile$MPI_SUFFIX.sh; \ +%{__sed} -i "s|.log|$MPI_SUFFIX.log|g" ../compile$MPI_SUFFIX.sh; \ +cat ../compile$MPI_SUFFIX.sh; \ +sh ../compile$MPI_SUFFIX.sh; \ +mv ../bin/%{NWCHEM_TARGET}/%{name} ../bin/%{NWCHEM_TARGET}/%{name}$MPI_SUFFIX; \ +NWCHEM_TARGET=%{NWCHEM_TARGET} NWCHEM_TOP=%{PKG_TOP} %{__make} clean; \ +cd .. + +# build serial version +export MPI_SUFFIX=_serial +cp -rp src.orig src +cd src +cp -p ../settings.sh ../compile$MPI_SUFFIX.sh +echo export ARMCI_NETWORK=SOCKETS >> ../compile$MPI_SUFFIX.sh +# without TCGSSH armci configure fails! +echo export TCGSSH=ssh >> ../compile$MPI_SUFFIX.sh +cat ../make.sh >> ../compile$MPI_SUFFIX.sh +%{__sed} -i "s|.log|$MPI_SUFFIX.log|g" ../compile$MPI_SUFFIX.sh; \ +cat ../compile$MPI_SUFFIX.sh +sh ../compile$MPI_SUFFIX.sh +mv ../bin/%{NWCHEM_TARGET}/%{name} ../bin/%{NWCHEM_TARGET}/%{name}$MPI_SUFFIX; \ +NWCHEM_TARGET=%{NWCHEM_TARGET} NWCHEM_TOP=%{PKG_TOP} %{__make} clean; \ +cd .. +rm -rf src + +# build openmpi version +cp -rp src.orig src +%{_openmpi_load} +%dobuild +%{_openmpi_unload} +rm -rf src + +cp -rp src.orig src +# build mpich version +%{mpich_load} +%dobuild +%{mpich_unload} +# leave last src build for debuginfo + +rm -f make.sh settings.sh + +cat < %{PKG_TOP}/%{name}.sh +# NOTE: This is an automatically-generated file! (generated by the +# %%{name} RPM). Any changes made here will be lost if the RPM is +# uninstalled or upgraded. + +# must end with slash! +PA=%{_datadir}/%{name}/libraries/ + +case \$NWCHEM_BASIS_LIBRARY in + *\${PA}*);; + *?*) NWCHEM_BASIS_LIBRARY=\${PA}:\${NWCHEM_BASIS_LIBRARY};; + *) NWCHEM_BASIS_LIBRARY=\${PA};; +esac +export NWCHEM_BASIS_LIBRARY + +# must end with slash! +PA=%{_datadir}/%{name}/libraryps/ + +case \$NWCHEM_NWPW_LIBRARY in + *\${PA}*);; + *?*) NWCHEM_NWPW_LIBRARY=\${PA}:\${NWCHEM_NWPW_LIBRARY};; + *) NWCHEM_NWPW_LIBRARY=\${PA};; +esac +export NWCHEM_NWPW_LIBRARY + +EOF + +cat < %{PKG_TOP}/%{name}.csh +# NOTE: This is an automatically-generated file! (generated by the +# %%{name} RPM). Any changes made here will be lost if the RPM is +# uninstalled or upgraded. + +# must end with slash! +set PA=%{_datadir}/%{name}/libraries/ + +if (\$?NWCHEM_BASIS_LIBRARY) then + if ("\$NWCHEM_BASIS_LIBRARY" !~ *\${PA}*) then + setenv NWCHEM_BASIS_LIBRARY \${PA}:\${NWCHEM_BASIS_LIBRARY} + endif +else + setenv NWCHEM_BASIS_LIBRARY \${PA} +endif + +unset PA + +# must end with slash! +set PA=%{_datadir}/%{name}/libraryps/ + +if (\$?NWCHEM_NWPW_LIBRARY) then + if ("\$NWCHEM_NWPW_LIBRARY" !~ *\${PA}*) then + setenv NWCHEM_NWPW_LIBRARY \${PA}:\${NWCHEM_NWPW_LIBRARY} + endif +else + setenv NWCHEM_NWPW_LIBRARY \${PA} +endif + +unset PA +EOF + +# create /etc/nwchemrc +cat < %{PKG_TOP}/nwchemrc +# NOTE: This is an automatically-generated file! (generated by the +# %%{name} RPM). Any changes made here will be lost if the RPM is +# uninstalled or upgraded. + +# data directory names must end with slash! +NWCHEM_BASIS_LIBRARY %{_datadir}/%{name}/libraries/ +NWCHEM_NWPW_LIBRARY %{_datadir}/%{name}/libraryps/ +FFIELD amber +AMBER_1 %{_datadir}/%{name}/amber_s/ +AMBER_2 %{_datadir}/%{name}/amber_q/ +AMBER_3 %{_datadir}/%{name}/amber_x/ +AMBER_4 %{_datadir}/%{name}/amber_u/ +SPCE %{_datadir}/%{name}/solvents/spce.rst +CHARMM_s %{_datadir}/%{name}/charmm_s/ +CHARMM_x %{_datadir}/%{name}/charmm_x/ +EOF + + +%install +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir} + +# *.bak files not allowed by rpmlint +for file in `find %{PKG_TOP} -name "*.bak"`; do + rm -f ${file} +done + +# To avoid replicated code define a macro +%global doinstall() \ +mkdir -p $RPM_BUILD_ROOT/$MPI_BIN; \ +install -p -m 755 %{PKG_TOP}/bin/%{NWCHEM_TARGET}/%{name}$MPI_SUFFIX $RPM_BUILD_ROOT/$MPI_BIN + +# install serial version +mkdir -p $RPM_BUILD_ROOT%{_bindir} +install -p -m 755 %{PKG_TOP}/bin/%{NWCHEM_TARGET}/%{name}_serial $RPM_BUILD_ROOT%{_bindir}/%{name} + +# install openmpi version +%{_openmpi_load} +%doinstall +%{_openmpi_unload} + +# install mpich version +%{mpich_load} +%doinstall +%{mpich_unload} + +mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name} + +cp -rp %{PKG_TOP}/src/data/* $RPM_BUILD_ROOT%{_datadir}/%{name} +cp -rp %{PKG_TOP}/src/basis/libraries $RPM_BUILD_ROOT%{_datadir}/%{name} +cp -rp %{PKG_TOP}/src/nwpw/libraryps $RPM_BUILD_ROOT%{_datadir}/%{name} +rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/libraryps/{*MakeFile,*.fh,*.F,dependencies,include_stamp} + +# env scripts +install -p -m 444 %{PKG_TOP}/*.*sh $RPM_BUILD_ROOT%{_datadir}/%{name} +# /etc/nwchemrc not working globally anymore? +install -p -m 444 %{PKG_TOP}/nwchemrc $RPM_BUILD_ROOT%{_datadir}/%{name} +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d +install -p -m 444 %{PKG_TOP}/%{name}*.*sh $RPM_BUILD_ROOT%{_sysconfdir}/profile.d + +# To avoid: "Found '/tmp/rpmbuild/build/' in installed files; aborting" +for file in `find %{PKG_TOP} -name "*.log"`; do + %{__sed} -i "s|$RPM_BUILD_ROOT||g" ${file} +done +for file in `find %{PKG_TOP} -name "*.sh"`; do + %{__sed} -i "s|$RPM_BUILD_ROOT||g" ${file} +done + +%if 0%{?fedora} || 0%{?rhel} >= 7 +%fdupes -s $RPM_BUILD_ROOT +%endif + + +%check +export NWCHEM_TOP=%{PKG_TOP} +export NWCHEM_TARGET=%{NWCHEM_TARGET} +# data directory names must end with slash! +export NWCHEM_BASIS_LIBRARY=$RPM_BUILD_ROOT%{_datadir}/%{name}/libraries/ +export NWCHEM_NWPW_LIBRARY=$RPM_BUILD_ROOT%{_datadir}/%{name}/libraryps/ + +mv QA QA.orig + +# cosmo_h2o_dft hangs on i386? MD Feb 8 2012 +# h2o-response hangs on i386? MD Jul 31 2013 + +# To avoid replicated code define a macro +%global docheck() \ +cp -rp QA.orig QA; \ +cd QA; \ +export LD_LIBRARY_PATH=${MPI_LIB}; \ +export PATH=${MPI_BIN}:${PATH}; \ +export MPIRUN_PATH=${MPI_BIN}/mpiexec; \ +export NWCHEM_EXECUTABLE=$NWCHEM_TOP/bin/$NWCHEM_TARGET/nwchem$MPI_SUFFIX; \ +%{__sed} -i '/cosmo_h2o_dft/d' doafewqmtests.mpi; \ +%{__sed} -i '/h2o-response/d' doafewqmtests.mpi; \ +time ./doafewqmtests.mpi %{NPROC} 2>&1 | tee ../doafewqmtests.mpi.%{NPROC}$MPI_SUFFIX.log; \ +mv testoutputs ../testoutputs.doafewqmtests.mpi.%{NPROC}$MPI_SUFFIX.log; \ +cd ..; \ +rm -rf QA + +%global NPROC 0 +# check serial version +MPI_SUFFIX=_serial %docheck + +%global NPROC %(cat /proc/cpuinfo | grep processor | wc -l) +# check openmpi version +%{_openmpi_load} +%docheck +%{_openmpi_unload} + +# this will fail for mpich2 on el6 - mpd would need to be started ... +# check mpich version +%{mpich_load} +%docheck +%{mpich_unload} + +# restore QA +mv QA.orig QA + + +%files +%{_bindir}/%{name} + + +%files common +%doc LICENSE* +%{_datadir}/%{name} +%config(noreplace) %{_sysconfdir}/profile.d/%{name}*.*sh + + +%files openmpi +%{_libdir}/openmpi%{?_opt_cc_suffix}/bin/%{name}_openmpi + + +%files %{mpich} +%{_libdir}/%{mpich}%{?_opt_cc_suffix}/bin/%{name}_%{mpich} + + +%changelog +* Sun Jan 26 2014 Marcin Dulak 6.3.2-6 +- common is noarch +- LICENSE* in common +- %%config(noreplace) %%{_sysconfdir}/profile.d/* + more explicit glob +- shorten %%description and %%summary +- use serial atlas (-lsatlas) + +* Sat Jan 25 2014 Marcin Dulak 6.3.2-5 +- ExcludeArch: %%arm + +* Fri Jan 24 2014 Marcin Dulak 6.3.2-4 +- the idea of %%optflags dropped, resulting executables were broken + +* Tue Jan 14 2014 Marcin Dulak 6.3.2-3 +- https://bugzilla.redhat.com/show_bug.cgi?id=984605#c12: timestamps + +* Wed Nov 6 2013 Marcin Dulak 6.3.2-2 +- update version +- explicitly set ARMCI_NETWORK=SOCKETS for serial build +- dependency on openssh-clients for serial build +- use tatlas on Fedora >= 21 +- basis are now under src/basis/libraries + +* Wed Jul 10 2013 Marcin Dulak 6.3.1-2 +- conform to http://fedoraproject.org/wiki/Packaging:MPI#Packaging_of_MPI_software + +* Wed Jul 10 2013 Marcin Dulak 6.3.1-1 +- adopted for Fedora and EPEL +- split into the main and data package + +* Mon Aug 13 2012 Marcin Dulak 6.1.1-1 +- restructured for build.opensuse.org and Fedora based on nwchem.spec + +* Sat Feb 4 2012 Marcin Dulak 6.1-1 +- USE_NOFSCHECK set to True +- src/data/* installed under %%{prefix}/share/%%{prgname}/data +- contrib/python/Gnuplot.py excluded +- scalapack build on Fedora (for some reason libscalapack.a not found on build.opensuse.org) +- {doc,web} directories not in source anymore + +* Wed Dec 21 2011 Marcin Dulak 6.1.pre6-1 +- allow pre releases to be built +- fixed ga-5-0 configure problems on EL5 and openSUSE 11.3-12.1 + +* Mon Oct 31 2011 Marcin Dulak 6.0-1 +- initial version diff --git a/sources b/sources index e69de29..6a9c94f 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +f961c1e5ee46fbc8718cf7b1b59bafa9 Nwchem-6.3.revision2-src.2013-10-17.tar.gz