diff --git a/petsc.spec b/petsc.spec index 1a22c03..517d2dd 100644 --- a/petsc.spec +++ b/petsc.spec @@ -3,7 +3,7 @@ # # Python binding and its testing -%bcond_without python +%bcond_with python %ifnarch %{power64} %{arm} %bcond_without pycheck %endif @@ -19,11 +19,11 @@ %{?el7:%global _pkgdocdir %{_docdir}/%{name}} # -%bcond_without mpich +%bcond_with mpich %bcond_without openmpi %if %{?__isa_bits:%{__isa_bits}}%{!?__isa_bits:32} == 64 -%bcond_without arch64 +%bcond_with arch64 %else %bcond_with arch64 %endif @@ -972,14 +972,15 @@ export MPI_INTERFACE_HOSTNAME=localhost export OMPI_MCA_btl_base_warn_component_unused=0 export wPETSC_DIR=./ export DATAFILESPATH=%{_builddir}/%{name}-%{version}/buildopenmpi_dir/share/petsc/datafiles +RPM_BUILD_NCPUS="`%{_bindir}/getconf _NPROCESSORS_ONLN`" %if %{with debug} export PETSCVALGRIND_OPTIONS=" --tool=memcheck --leak-check=yes --track-origins=yes" export CFLAGS="-O0 -g -Wl,-z,now -fPIC" export CXXFLAGS="-O0 -g -Wl,-z,now -fPIC" export FFLAGS="-O0 -g -Wl,-z,now -fPIC -I${MPI_FORTRAN_MOD_DIR}" -xvfb-run -a make MAKE_NP=1 all test -C buildopenmpi_dir V=1 MPIEXEC='%{_builddir}/%{name}-%{version}/buildopenmpi_dir/lib/petsc/bin/petscmpiexec -valgrind' +xvfb-run -a make MAKE_NP=$RPM_BUILD_NCPUS all test -C buildopenmpi_dir V=1 MPIEXEC='%{_builddir}/%{name}-%{version}/buildopenmpi_dir/lib/petsc/bin/petscmpiexec -valgrind' %else -xvfb-run -a make MAKE_NP=1 all test -C buildopenmpi_dir V=1 +xvfb-run -a make MAKE_NP=$RPM_BUILD_NCPUS all test -C buildopenmpi_dir V=1 %endif %endif @@ -1012,14 +1013,15 @@ export MPI_INTERFACE_HOSTNAME=localhost export OMPI_MCA_btl_base_warn_component_unused=0 export wPETSC_DIR=./ export DATAFILESPATH=%{_builddir}/%{name}-%{version}/buildmpich_dir/share/petsc/datafiles +RPM_BUILD_NCPUS="`%{_bindir}/getconf _NPROCESSORS_ONLN`" %if %{with debug} export PETSCVALGRIND_OPTIONS=" --tool=memcheck --leak-check=yes --track-origins=yes" export CFLAGS="-O0 -g -Wl,-z,now -fPIC" export CXXFLAGS="-O0 -g -Wl,-z,now -fPIC" export FFLAGS="-O0 -g -Wl,-z,now -fPIC -I${MPI_FORTRAN_MOD_DIR}" -xvfb-run -a make MAKE_NP=1 all test -C buildmpich_dir V=1 MPIEXEC='%{_builddir}/%{name}-%{version}/buildmpich_dir/lib/petsc/bin/petscmpiexec -valgrind' +xvfb-run -a make MAKE_NP=$RPM_BUILD_NCPUS all test -C buildmpich_dir V=1 MPIEXEC='%{_builddir}/%{name}-%{version}/buildmpich_dir/lib/petsc/bin/petscmpiexec -valgrind' %else -xvfb-run -a make MAKE_NP=1 all test -C buildmpich_dir V=1 +xvfb-run -a make MAKE_NP=$RPM_BUILD_NCPUS all test -C buildmpich_dir V=1 %endif %endif @@ -1048,14 +1050,15 @@ export PETSC_DIR=%{_builddir}/%{name}-%{version}/%{name}-%{version} export PETSC_ARCH=%{_arch} export wPETSC_DIR=./ export DATAFILESPATH=%{_builddir}/%{name}-%{version}/%{name}-%{version}/share/petsc/datafiles +RPM_BUILD_NCPUS="`%{_bindir}/getconf _NPROCESSORS_ONLN`" %if %{with debug} export PETSCVALGRIND_OPTIONS=" --tool=memcheck --leak-check=yes --track-origins=yes" export CFLAGS="-O0 -g -Wl,-z,now -fPIC" export CXXFLAGS="-O0 -g -Wl,-z,now -fPIC" export FFLAGS="-O0 -g -Wl,-z,now -fPIC -I%{_libdir}/gfortran/modules" -xvfb-run -a make MAKE_NP=1 all test -C %{name}-%{version} V=1 MPIEXEC='%{_builddir}/%{name}-%{version}/%{name}-%{version}/lib/petsc/bin/petscmpiexec -n `%{_bindir}/getconf _NPROCESSORS_ONLN` -valgrind' +xvfb-run -a make MAKE_NP=$RPM_BUILD_NCPUS all test -C %{name}-%{version} V=1 MPIEXEC='%{_builddir}/%{name}-%{version}/%{name}-%{version}/lib/petsc/bin/petscmpiexec -n $RPM_BUILD_NCPUS -valgrind' %else -xvfb-run -a make MAKE_NP=1 all test -C %{name}-%{version} V=1 MPIEXEC='%{_builddir}/%{name}-%{version}/%{name}-%{version}/lib/petsc/bin/petscmpiexec -n `%{_bindir}/getconf _NPROCESSORS_ONLN`' +xvfb-run -a make MAKE_NP=$RPM_BUILD_NCPUS all test -C %{name}-%{version} V=1 MPIEXEC='%{_builddir}/%{name}-%{version}/%{name}-%{version}/lib/petsc/bin/petscmpiexec -n $RPM_BUILD_NCPUS' %endif %if %{with arch64} @@ -1064,6 +1067,7 @@ export PETSC_DIR=%{_builddir}/%{name}-%{version}/build64 export PETSC_ARCH=%{_arch} export wPETSC_DIR=./ export DATAFILESPATH=%{_builddir}/%{name}-%{version}/build64/share/petsc/datafiles +RPM_BUILD_NCPUS="`%{_bindir}/getconf _NPROCESSORS_ONLN`" ## 'make test' needs to link against -lpetsc ## Crude fix: ln -s %{_builddir}/%{name}-%{version}/build64/%{_arch}/lib/libpetsc64.so %{_builddir}/%{name}-%{version}/build64/%{_arch}/lib/libpetsc.so @@ -1073,9 +1077,9 @@ export PETSCVALGRIND_OPTIONS=" --tool=memcheck --leak-check=yes --track-origins= export CFLAGS="-O0 -g -Wl,-z,now -fPIC" export CXXFLAGS="-O0 -g -Wl,-z,now -fPIC" export FFLAGS="-O0 -g -Wl,-z,now -fPIC -I%{_libdir}/gfortran/modules" -xvfb-run -a make MAKE_NP=1 all test -C build64 V=1 MPIEXEC='%{_builddir}/%{name}-%{version}/build64/lib/petsc/bin/petscmpiexec -n `%{_bindir}/getconf _NPROCESSORS_ONLN` -valgrind' +xvfb-run -a make MAKE_NP=$RPM_BUILD_NCPUS all test -C build64 V=1 MPIEXEC='%{_builddir}/%{name}-%{version}/build64/lib/petsc/bin/petscmpiexec -n $RPM_BUILD_NCPUS -valgrind' %else -xvfb-run -a make MAKE_NP=1 all test -C build64 V=1 MPIEXEC='%{_builddir}/%{name}-%{version}/build64/lib/petsc/bin/petscmpiexec -n `%{_bindir}/getconf _NPROCESSORS_ONLN`' +xvfb-run -a make MAKE_NP=$RPM_BUILD_NCPUS all test -C build64 V=1 MPIEXEC='%{_builddir}/%{name}-%{version}/build64/lib/petsc/bin/petscmpiexec -n $RPM_BUILD_NCPUS' %endif %endif %endif