%global major_version 3.8 %global patch_level 5 # check_lead fails to compile in 3.7.8 # no more TranMain TranMain_NC in 3.8 %global tools DosMain jx analysis_example esp check_lead OpticalConductivityMain polB test_mpi %global tools DosMain jx analysis_example esp OpticalConductivityMain polB test_mpi # MPI_FORTRAN_MOD_DIR problem https://bugzilla.redhat.com/show_bug.cgi?id=1409235 # missing on el6/el7 %{?!_fmoddir: %global _fmoddir %{_libdir}/gfortran/modules} %if 0%{?el6} # el6/ppc64 Error: No Package found for mpich-devel ExclusiveArch: x86_64 %{ix86} %endif %global mpi_cpu %{_target_cpu} %ifarch %ix86 %global mpi_cpu i386 %endif %ifarch armv7hl %global mpi_cpu arm %endif # workaround for: Krylov.c: fatal error: emmintrin.h: No such file or directory # http://www.openmx-square.org/openmx_man3.8/node14.html %global openmx_optflags %{optflags} -Dnosse %ifarch x86_64 %global openmx_optflags %{optflags} %endif Name: openmx Version: %{major_version}.%{patch_level} Release: 3%{?dist} Summary: Open source package for Material eXplorer License: GPLv2+ URL: http://www.openmx-square.org/ Source0: http://www.openmx-square.org/%{name}%{major_version}.tar.gz %if %{patch_level} > 0 Source1: http://www.openmx-square.org/bugfixed/16Oct21/patch%{major_version}.%{patch_level}.tar.gz %endif # no license http://www.openmx-square.org/forum/patio.cgi?mode=view&no=1747 Source2: COPYING Source3: LICENSE BuildRequires: time BuildRequires: gcc-gfortran BuildRequires: openblas-devel BuildRequires: fftw3-devel Requires: openssh-clients Requires: %{name}-common = %{version}-%{release} Requires: %{name}-data = %{version}-%{release} Provides: bundled(liberi) = 091216 # bundle elpa https://bugzilla.redhat.com/show_bug.cgi?id=1325933 Provides: bundled(elpa) = 2011.02.21 %global desc_base \ OpenMX (Open source package for Material eXplorer) is a software package for\ nano-scale material simulations based on density functional theories (DFT),\ norm-conserving pseudopotentials, and pseudo-atomic localized basis functions. %description %{desc_base} There is currently no serial version built. %package openmpi Summary: %{name} - openmpi version BuildRequires: openmpi-devel Requires: %{name}-common = %{version}-%{release} Requires: %{name}-data = %{version}-%{release} %description openmpi %{desc_base} This package contains the openmpi version. %package mpich Summary: %{name} - mpich version BuildRequires: mpich-devel Requires: %{name}-common = %{version}-%{release} Requires: %{name}-data = %{version}-%{release} %description mpich %{desc_base} This package contains the mpich version. %package data Summary: %{name} - data files BuildArch: noarch %description data %{desc_base} This package contains the data files. %package common Summary: %{name} - common files BuildArch: noarch %description common %{desc_base} This package contains the common binaries. %prep %setup -q -n %{name}%{major_version} # license files cp -p %{SOURCE2} %{SOURCE3} . %if %{patch_level} > 0 # apply the "patch" cd source tar -zxf %{SOURCE1} cd .. %endif # clear objects find source/liberi-*/ \( -name "*.oo" -o -name "*.o" -o -name "test_pp" \) -delete for mpi in mpich openmpi ; do cp -pr source ${mpi} done %build for mpi in mpich openmpi ; do module load mpi/$mpi-%{mpi_cpu} pushd $mpi CFLAGS="%{openmx_optflags} -fopenmp -I./liberi-091216/source" # MPI_FORTRAN_MOD_DIR problem https://bugzilla.redhat.com/show_bug.cgi?id=1409235 FCFLAGS="%{openmx_optflags} -fopenmp -I$MPI_FORTRAN_MOD_DIR -I%{_fmoddir}/$mpi" LIBS="-lfftw3 -lopenblas -lgfortran" case $MPI_SUFFIX in _openmpi) LIBMPI="-lmpi" [ -r "$MPI_LIB/libmpi_f90.so" ] && LIBMPI="$LIBMPI -lmpi_f90 -lmpi_f77" [ -r "$MPI_LIB/libmpi_usempi.so" ] && LIBMPI="$LIBMPI -lmpi_usempi" [ -r "$MPI_LIB/libmpi_usempif08.so" ] && LIBMPI="$LIBMPI -lmpi_usempif08" [ -r "$MPI_LIB/libmpi_mpifh.so" ] && LIBMPI="$LIBMPI -lmpi_mpifh" ;; _mpich*) LIBMPI="-lmpich" [ -r "$MPI_LIB/libmpifort.so" ] && LIBMPI="$LIBMPI -lmpifort" ;; esac make CC="mpicc $CFLAGS" FC="mpif90 $FCFLAGS -I$MPI_FORTRAN_MOD_DIR" LIB="$LIBS -L$MPI_LIB $LIBMPI" %{name} %{tools} %{?_smp_mflags} popd module unload mpi/$mpi-%{mpi_cpu} done %install mkdir -p $RPM_BUILD_ROOT%{_sysconfdir} for mpi in mpich openmpi ; do module load mpi/$mpi-%{mpi_cpu} install -Dpm755 $mpi/%{name} $RPM_BUILD_ROOT/$MPI_BIN/%{name}$MPI_SUFFIX for f in %{tools}; do install -p -m 755 $mpi/${f} $RPM_BUILD_ROOT/$MPI_BIN/${f}$MPI_SUFFIX; done for f in %{tools}; do echo "$MPI_BIN/${f}$MPI_SUFFIX" >> tools$MPI_SUFFIX; done module unload mpi/$mpi-%{mpi_cpu} done mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name} # don't copy utilities - they trigger dependency on perl, python ... cp -rp DFT_DATA* $RPM_BUILD_ROOT%{_datadir}/%{name} %check export NPROC=1 # test on 1 core export OMP_NUM_THREADS=1 for mpi in mpich openmpi ; do module load mpi/$mpi-%{mpi_cpu} pushd $mpi cp -pr ../work/* ./ time mpiexec -np ${NPROC} ./%{name} -runtest -nt $NPROC |& tee work.${NPROC}.log [ -r runtest.result ] && cat runtest.result popd module unload mpi/$mpi-%{mpi_cpu} done %files common %license COPYING LICENSE %files data %license COPYING LICENSE %dir %{_datadir}/%{name} %{_datadir}/%{name}/DFT_DATA* %files openmpi -f tools_openmpi %{_libdir}/openmpi/bin/%{name}_openmpi %files mpich -f tools_mpich %{_libdir}/mpich/bin/%{name}_mpich %changelog * Mon Nov 26 2018 Orion Poplawski - 3.8.5-3 - Rebuild for openmpi 4.0 * Fri Jul 13 2018 Fedora Release Engineering - 3.8.5-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild * Thu Jun 14 2018 Marcin Dulak 3.8.5-1 - new upstream release - bundle elpa * Thu Feb 08 2018 Fedora Release Engineering - 3.8.1-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild * Thu Aug 03 2017 Fedora Release Engineering - 3.8.1-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild * Thu Jul 27 2017 Fedora Release Engineering - 3.8.1-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Sat Feb 11 2017 Fedora Release Engineering - 3.8.1-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild * Thu Dec 29 2016 Marcin Dulak 3.8.1-9 - new upstream release * Thu Dec 29 2016 Dominik Mierzejewski - 3.8.0-8 - merged changes from bug #1325933 * Sat Oct 22 2016 Orion Poplawski - 3.7.10-7 - Rebuild for openmpi 2.0 * Thu Jul 14 2016 Peter Robinson 3.7.10-6 - openblas supported on Power64 * Wed Jul 13 2016 Peter Robinson 3.7.10-5 - sync up openblas architectures - fix up %%license support macros * Sun Apr 17 2016 Dominik Mierzejewski - 3.7.10-4 - fix build with elpa-2015.11 * Thu Feb 04 2016 Fedora Release Engineering - 3.7.10-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild * Wed Dec 16 2015 Marcin Dulak 3.7.10-2 - removed old mpich macros - ExclusiveArch due to openblas-devel * Wed Nov 11 2015 Marcin Dulak 3.7.10-1 - initial build