%bcond_without openblas %bcond_with check %if %{with openblas} %global blas openblas %global blaslib -lopenblas %else %global blas atlas %global blaslib -L%{_libdir}/atlas -llapack -lf77blas %endif %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 %global use_mpich 0 %define svn 0 %define snapshot 20131112 Name: cp2k Version: 2.5.1 Release: 7liv2%{?dist} Group: Applications/Engineering Summary: Ab Initio Molecular Dynamics License: GPLv2+ URL: http://cp2k.org/ %if %{svn} # run cp2k-snapshot.sh to produce this Source0: cp2k-%{version}-%{snapshot}.tar.xz %else Source0: https://github.com/cp2k/cp2k/releases/download/v%version/cp2k-%version.tar.bz2 %endif Source1: http://sourceforge.net/projects/cp2k/files/testresults/cp2k-2_5-branch_LAST-Linux-x86-64-gfortran-popt.tar.bz2 Source4: cp2k-snapshot.sh # patch to: # use rpm optflags # link with atlas/openblas instead of vanilla blas/lapack # build with libint and libxc # use external makedepf90 # skip compilation during regtests Patch0: %{name}-rpm.patch BuildRequires: %{blas}-devel # for regtests BuildRequires: bc BuildRequires: fftw-devel %if 0%{?rhel} && %{?rhel} < 7 BuildRequires: devtoolset-2-gcc-gfortran devtoolset-2-binutils BuildRequires: devtoolset-2-libstdc++-devel %else BuildRequires: gcc-gfortran >= 4.7 %endif BuildRequires: libint-devel >= 1.1.4 BuildRequires: libxc-devel BuildRequires: makedepf90 %if 0%{?rhel} && %{rhel} < 7 BuildRequires: /bin/hostname %else BuildRequires: hostname %endif BuildRequires: elpa-openmpi-devel # Libint can break the API between releases #Requires: libint%{?_isa} = %{_libint_version} Requires: %{name}-common = %{version}-%{release} Obsoletes: %{name}-smp < 2.4-3 Provides: %{name}-smp = %{version}-%{release} %global cp2k_desc_base \ CP2K is a freely available (GPL) program, written in Fortran 95, to\ perform atomistic and molecular simulations of solid state, liquid,\ molecular and biological systems. It provides a general framework for\ different methods such as e.g. density functional theory (DFT) using a\ mixed Gaussian and plane waves approach (GPW), and classical pair and\ many-body potentials.\ \ CP2K does not implement Car-Parinello Molecular Dynamics (CPMD). %description %{cp2k_desc_base} This package contains the non-MPI single process and multi-threaded versions. %package openmpi Group: Applications/Engineering Summary: Molecular simulations software - openmpi version BuildRequires: openmpi-devel BuildRequires: blacs-openmpi-devel BuildRequires: scalapack-openmpi-devel Requires: %{name}-common = %{version}-%{release} Requires: blacs-openmpi%{?_isa} Requires: scalapack-openmpi%{?_isa} # Libint may have API breakage #Requires: libint%{?_isa} = %{_libint_version} Requires: elpa-openmpi %description openmpi %{cp2k_desc_base} This package contains the parallel single- and multi-threaded versions using OpenMPI. %if %use_mpich %package %{mpich} Group: Applications/Engineering Summary: Molecular simulations software - %{mpich} version BuildRequires: %{mpich}-devel BuildRequires: blacs-%{mpich}-devel BuildRequires: scalapack-%{mpich}-devel BuildRequires: elpa-%{mpich}-devel Requires: %{name}-common = %{version}-%{release} Requires: blacs-%{mpich}%{?_isa} Requires: scalapack-%{mpich}%{?_isa} Provides: %{name}-%{mpich} = %{version}-%{release} Obsoletes: %{name}-%{mpich} < 2.4-5 # Libint may have API breakage #Requires: libint%{?_isa} = %{_libint_version} Requires: elpa-%{mpich} %description %{mpich} %{cp2k_desc_base} This package contains the parallel single- and multi-threaded versions using %{mpich}. %endif %package common Group: Applications/Engineering Summary: Molecular simulations software - common files %description common %{cp2k_desc_base} This package contains the documentation and the manual. %prep %setup -q %patch0 -p1 -b .r rm -r tools/makedepf90 chmod -x src/harris_{functional,{env,energy}_types}.F %if 0%{?fedora} >= 21 sed -i 's|-lmpiblacsF77init||g' arch/Linux-x86-64-gfortran* sed -i 's|-lmpiblacsCinit||g' arch/Linux-x86-64-gfortran* %endif # Generate necessary symlinks TARGET=$(tools/get_arch_code) %ifnarch x86_64 ln -s Linux-x86-64-gfortran.sopt arch/${TARGET}.sopt ln -s Linux-x86-64-gfortran.ssmp arch/${TARGET}.ssmp %endif ln -s Linux-x86-64-gfortran.popt arch/${TARGET}-openmpi.popt ln -s Linux-x86-64-gfortran.popt arch/${TARGET}-mpich.popt ln -s Linux-x86-64-gfortran.psmp arch/${TARGET}-openmpi.psmp ln -s Linux-x86-64-gfortran.psmp arch/${TARGET}-mpich.psmp # fix crashes in fftw on i686. Need to run on original file, otherwise symlinks will be replaced with copies. %ifarch i686 sed -i 's/-D__FFTW3/-D__FFTW3 -D__FFTW3_UNALIGNED/g' arch/Linux-x86-64-gfortran* %endif # Get libint and libderiv limits maxam=`grep LIBINT_MAX_AM %{_includedir}/libint/libint.h | awk '{print $3}'` maxderiv=`grep "LIBDERIV_MAX_AM1 " %{_includedir}/libderiv/libderiv.h | awk '{print $3}'` # Plug them in the configuration for f in arch/Linux-x86-64-gfortran.{popt,psmp,sopt,ssmp}; do sed -i "s|@LIBINT_MAX_AM@|$maxam|g;s|@LIBDERIV_MAX_AM@|$maxderiv|g" $f sed -i "s|^OPTFLAGS *=|OPTFLAGS = %{optflags} |g" $f done tar -xf %{SOURCE1} ln -s LAST-Linux-x86-64-gfortran-popt LAST-${TARGET}-sopt ln -s LAST-Linux-x86-64-gfortran-popt LAST-${TARGET}-openmpi-popt %build TARGET=$(tools/get_arch_code) pushd makefiles %if 0%{?rhel} && %{?rhel} < 7 PATH=/opt/rh/devtoolset-2/root/usr/bin:$PATH %endif make BLASLIB="%blaslib" %{?_smp_mflags} sopt ARCH="Linux-x86-64-gfortran" HWTOPO=yes %{_openmpi_load} make BLASLIB="%blaslib" %{?_smp_mflags} ARCH="${TARGET}-openmpi" VERSION=popt make BLASLIB="%blaslib" %{?_smp_mflags} ARCH="${TARGET}-openmpi" VERSION=psmp %{_openmpi_unload} %if %use_mpich %{mpich_load} # Extra -I because the module isn't setting the include path # correctly per the packaging guildelines make BLASLIB="%blaslib" %{?_smp_mflags} ARCH="${TARGET}-mpich" VERSION=popt make BLASLIB="%blaslib" %{?_smp_mflags} ARCH="${TARGET}-mpich" VERSION=psmp %{mpich_unload} %endif make BLASLIB="%blaslib" %{?_smp_mflags} sopt ssmp popd %install TARGET=$(tools/get_arch_code) install -d %{buildroot}%{_bindir} %{_openmpi_load} mkdir -p %{buildroot}%{_libdir}/openmpi%{?_opt_cc_suffix}/bin/ install -pm755 exe/${TARGET}-openmpi/cp2k.popt %{buildroot}%{_libdir}/openmpi%{?_opt_cc_suffix}/bin/cp2k.popt_openmpi install -pm755 exe/${TARGET}-openmpi/cp2k.psmp %{buildroot}%{_libdir}/openmpi%{?_opt_cc_suffix}/bin/cp2k.psmp_openmpi %{_openmpi_unload} %if %use_mpich %{mpich_load} mkdir -p %{buildroot}%{_libdir}/%{mpich}%{?_opt_cc_suffix}/bin/ install -pm755 exe/${TARGET}-mpich/cp2k.popt %{buildroot}%{_libdir}/%{mpich}%{?_opt_cc_suffix}/bin/cp2k.popt_%{mpich} install -pm755 exe/${TARGET}-mpich/cp2k.psmp %{buildroot}%{_libdir}/%{mpich}%{?_opt_cc_suffix}/bin/cp2k.psmp_%{mpich} %{mpich_unload} %endif install -pm755 exe/${TARGET}/cp2k.sopt %{buildroot}%{_bindir} install -pm755 exe/${TARGET}/cp2k.ssmp %{buildroot}%{_bindir} %clean rm -rf %{buildroot} %if %{with check} %check cat > tests/fedora.config << __EOF__ export LC_ALL=C dir_base=%{_builddir} cp2k_version=popt cp2k_run_prefix="mpirun -np 2" dir_triplet=`tools/get_arch_code`-openmpi cp2k_dir=cp2k-%{version} maxtasks=$(echo `getconf _NPROCESSORS_ONLN`/2 | bc) emptycheck="NO" leakcheck="NO" __EOF__ pushd tests %{_openmpi_load} ../tools/regtesting/do_regtest -nosvn -nobuild -config fedora.config %{_openmpi_unload} popd %endif %files common %defattr(-,root,root,-) %doc COPYRIGHT README %files %defattr(-,root,root,-) %{_bindir}/cp2k.sopt %{_bindir}/cp2k.ssmp %files openmpi %defattr(-,root,root,-) %{_libdir}/openmpi%{?_opt_cc_suffix}/bin/cp2k.popt_openmpi %{_libdir}/openmpi%{?_opt_cc_suffix}/bin/cp2k.psmp_openmpi %if %use_mpich %files %{mpich} %defattr(-,root,root,-) %{_libdir}/%{mpich}%{?_opt_cc_suffix}/bin/cp2k.popt_%{mpich} %{_libdir}/%{mpich}%{?_opt_cc_suffix}/bin/cp2k.psmp_%{mpich} %endif %changelog * Thu Sep 18 2014 Dave Love - 2.5.1-7liv2 - Use recommended OPTFLAGS - Require MPI-specific elpa lib - BR elpa-mpich conditionally * Thu Jun 19 2014 Dave Love - 2.5.1-7liv1 - Support EPEL6, using devtoolset - Use ELPA - Fix Source1 - Default to not checking, e.g. for COPR * Sat Jun 07 2014 Fedora Release Engineering - 2.5.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Tue May 20 2014 Thomas Spura - 2.5.1-4 - run tests with openmpi on 2 cores * Tue May 13 2014 Thomas Spura - 2.5.1-3 - add upstream reference data for evaluating tests * Mon May 12 2014 Tom Callaway - 2.5.1-2 - compile against new blacs in rawhide * Fri Mar 14 2014 Dominik Mierzejewski - 2.5.1-1 - update to upstream 2.5.1 release - drop backported compilation fix * Tue Mar 11 2014 Dominik Mierzejewski - 2.5.0-1 - update to upstream 2.5 release - backport compilation fix from SVN - fix description (cp2k doesn't implement Car-Parinello Molecular Dynamics) * Mon Mar 10 2014 Susi Lehtola - 2.5-0.5.20131112svn13316 - Rebuild against updated libint. * Sat Feb 22 2014 Deji Akingunola - 2.5-0.4.20131112svn13316 - Rebuild for mpich-3.1 * Mon Dec 23 2013 Susi Lehtola - 2.5-0.3.20131112svn13316 - Rebuild against new libint. * Fri Nov 15 2013 Dominik Mierzejewski - 2.5-0.2.20131112svn13316 - use xz to compress SVN snapshot tarball * Wed Nov 13 2013 Dominik Mierzejewski - 2.5-0.1.20131112svn13316 - update to current SVN trunk - fix build against atlas >= 3.10.1 - use non-threaded atlas for OpenMP builds per upstream recommendation - fix BR broken by UsrMove feature * Sat Aug 03 2013 Fedora Release Engineering - 2.4-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild * Sat Jul 20 2013 Deji Akingunola - 2.4-5 - Rename mpich2 sub-packages to mpich and rebuild for mpich-3.0 * Sun Jul 14 2013 Dominik Mierzejewski - 2.4-4 - rebuild for new OpenMPI * Tue Jul 02 2013 Dominik Mierzejewski - 2.4-3 - build psmp variants (MPI+OpenMP) - move ssmp build to main package and drop smp subpackage - drop local config files, patch upstream's and symlink when necessary - save the output of tools/get_arch_code and re-use it * Wed Jun 19 2013 Dominik Mierzejewski - 2.4-2 - add MPI implementation suffix back to MPI binaries (required by guidelines) * Mon Jun 17 2013 Dominik Mierzejewski - 2.4-1 - update to 2.4 release - drop gfortran-4.8 patch (fixed upstream) - reorder libraries in LDFLAGS again to follow current upstream config - rename both MPI binaries to cp2k.popt * Thu Apr 18 2013 Dominik Mierzejewski - 2.4-0.5.20130418 - correct SVN url in snapshot script - update to current SVN trunk (r12842) - use (and patch) upstream-provided configs for x86_64 ssmp and popt builds - no need to force FC=gfortran anymore * Wed Apr 17 2013 Dominik Mierzejewski - 2.4-0.4.20130220 - fix build with gfortran-4.8 (bug #913927) - link with libf77blas for MPI builds to avoid undefined reference to symbol 'dgemm_' * Sun Apr 14 2013 Dominik Mierzejewski - 2.4-0.3.20130220 - fix crashes in fftw on i686 (patch by Michael Banck) * Fri Feb 22 2013 Dominik Mierzejewski - 2.4-0.2.20130220 - add requires for respective blacs and scalapack versions * Wed Feb 20 2013 Dominik Mierzejewski - 2.4-0.1.20130220 - re-enable regtests - update to current SVN trunk (2.4) - drop svn patch (no longer needed) - link with libfftw3_omp for ssmp build - reorder libraries in LDFLAGS per M. Guidon's cp2k installation primer - add -ffree-line-length-none to Fortran flags - add a patch to echo the name of reach test (from Debian package) - build with libxc - update libint/libderiv options to match current builds * Wed Feb 13 2013 Fedora Release Engineering - 2.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild * Wed Dec 26 2012 Kevin Fenzi 2.3-2 - Rebuild for new libmpich * Wed Sep 05 2012 Dominik Mierzejewski - 2.3-1 - updated to 2.3 release * Sun Aug 26 2012 Dominik Mierzejewski - 2.3-0.20120825 - updated to current 2.3 branch (trunk) - added snapshot creator script - moved new files out of -rpm patch and into separate SourceN entries - dropped non-standard compiler flags from MPI builds * Wed Jul 25 2012 Jussi Lehtola - 2.1-7.20101006 - Rebuild due to changed libint. * Tue Jul 24 2012 Thomas Spura - 2.1-6.20101006 - don't run testsuite as it is only usefull when comparing to old outputs (which we don't have at buildtime) - define common description macro - also build with openmpi/mpich2 - new url * Wed Jul 18 2012 Fedora Release Engineering - 2.1-5.20101006 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild * Thu Jan 12 2012 Fedora Release Engineering - 2.1-4.20101006 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild * Tue Feb 08 2011 Fedora Release Engineering - 2.1-3.20101006 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild * Tue Dec 07 2010 Dominik Mierzejewski 2.1-2.20101006 - make Summary more descriptive - use atlas instead of blas/lapack - pass special CFLAGS to support libint's higher values of angular momentum * Fri Dec 03 2010 Dominik Mierzejewski 2.1-1.20101006 - initial package