From 16069d69119d854d7dbbd58da86b80ca9392c4e2 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 18 Nov 2024 11:40:33 +0100 Subject: [PATCH] Fix fedora builds --- .packit.yaml | 2 - tests/do_regtest.py | 9 ++-- tools/fedora/cp2k.spec | 68 ++++++++----------------------- tools/fedora/tests/do_regtest.sh | 6 ++- tools/fedora/tests/regression.fmf | 3 +- 5 files changed, 27 insertions(+), 61 deletions(-) diff --git a/.packit.yaml b/.packit.yaml index d36f4917da..eda9bd720d 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -20,7 +20,6 @@ test_command: default_identifier: smoke targets: - # TODO: Match F40 release - fedora-development-x86_64 - fedora-development-aarch64 - fedora-latest-x86_64 @@ -36,7 +35,6 @@ jobs: trigger: commit branch: master project: nightly - update_release: true - &tests job: tests trigger: commit diff --git a/tests/do_regtest.py b/tests/do_regtest.py index 4ed7c0658c..f2f98dc1ed 100755 --- a/tests/do_regtest.py +++ b/tests/do_regtest.py @@ -250,7 +250,7 @@ class Config: default_ompthreads = 2 if "smp" in args.version else 1 self.ompthreads = args.ompthreads if args.ompthreads else default_ompthreads self.mpiranks = args.mpiranks if self.use_mpi else 1 - self.num_workers = int(args.maxtasks / self.ompthreads / self.mpiranks) + self.num_workers = int(args.maxtasks / self.ompthreads / self.mpiranks) or 1 self.workers = Semaphore(self.num_workers) self.cp2k_root = Path(__file__).resolve().parent.parent self.mpiexec = args.mpiexec @@ -306,11 +306,8 @@ class Config: env["CUDA_VISIBLE_DEVICES"] = ",".join(visible_gpu_devices) env["HIP_VISIBLE_DEVICES"] = ",".join(visible_gpu_devices) env["OMP_NUM_THREADS"] = str(self.ompthreads) - exe_path = Path(f"{exe_stem}.{self.version}") - if exe_path.is_absolute(): - cmd = [str(exe_path)] - else: - cmd = [str(self.binary_dir / f"{exe_stem}.{self.version}")] + exe_name = f"{exe_stem}.{self.version}" + cmd = [str(self.binary_dir / exe_name)] if self.valgrind: cmd = ["valgrind", "--error-exitcode=42", "--exit-on-first-error=yes"] + cmd if self.use_mpi: diff --git a/tools/fedora/cp2k.spec b/tools/fedora/cp2k.spec index cf7d4035f1..53094505b6 100644 --- a/tools/fedora/cp2k.spec +++ b/tools/fedora/cp2k.spec @@ -1,16 +1,5 @@ -# No openmpi on i668 with openmpi 5 in Fedora 40+ -%ifarch %{ix86} -%bcond_with openmpi -%else -%bcond_without openmpi -%endif - -%ifarch x86_64 -%bcond_without libxsmm -%else -# See https://bugzilla.redhat.com/show_bug.cgi?id=1515404 -%bcond_with libxsmm -%endif +# libxsmm is designed for x86_64 architectures only, see project's README +%bcond libxsmm %[ "%{_arch}" == "x86_64" ] # Disable LTO due to https://bugzilla.redhat.com/show_bug.cgi?id=2243158 %global _lto_cflags %nil @@ -23,39 +12,31 @@ License: GPL-2.0-or-later URL: https://www.cp2k.org/ Source0: https://github.com/cp2k/cp2k/releases/download/v%{version}/cp2k-%{version}.tar.bz2 -# Remove testing packages that were previously packaged -# Can be removed at the end of F40 -# Provides should not be necessary but might as well be thorough -Provides: cp2k-testing = 2024.1-5 -Obsoletes: cp2k-testing < 2024.1-5 -Provides: cp2k-mpich-testing = 2024.1-5 -Obsoletes: cp2k-mpich-testing < 2024.1-5 -Provides: cp2k-openmpi-testing = 2024.1-5 -Obsoletes: cp2k-openmpi-testing < 2024.1-5 - +# Drop 32bit architectures # Flaky MPI issues on s390x, and upstream do not officially support it yet # https://github.com/cp2k/cp2k/issues/3362 -ExcludeArch: s390x +ExcludeArch: %{ix86} s390x # Build dependencies BuildRequires: cmake +BuildRequires: gcc BuildRequires: gcc-gfortran BuildRequires: gcc-c++ BuildRequires: ninja-build BuildRequires: python3-fypp # Project dependencies BuildRequires: flexiblas-devel -BuildRequires: dbcsr-devel >= 2.6.0 -BuildRequires: fftw-devel +BuildRequires: cmake(DBCSR) +BuildRequires: pkgconfig(fftw3) %if %{with libxsmm} -BuildRequires: libxsmm-devel >= 1.8.1-3 +BuildRequires: pkgconfig(libxsmm) %endif -BuildRequires: libxc-devel >= 5.1.0 -BuildRequires: spglib-devel +# cmake(Libxc) technically fails +# https://github.com/cp2k/cp2k/issues/3767 +BuildRequires: libxc-devel +BuildRequires: cmake(Spglib) # Test dependencies BuildRequires: python3 -# For pathfix.py -BuildRequires: python3-devel Requires: %{name}-common = %{version}-%{release} @@ -92,7 +73,6 @@ Requires: %{name}%{?_isa} = %{version}-%{release} The %{name}-devel package contains libraries and header files for developing applications that use %{name}. -%if %{with openmpi} %package openmpi Summary: Molecular simulations software - openmpi version BuildRequires: openmpi-devel @@ -117,8 +97,6 @@ Requires: %{name}-openmpi%{?_isa} = %{version}-%{release} The %{name}-devel package contains libraries and header files for developing applications that use %{name}. -%endif - %package mpich Summary: Molecular simulations software - mpich version BuildRequires: mpich-devel @@ -149,13 +127,8 @@ developing applications that use %{name}. rm tools/build_utils/fypp rm -r exts/dbcsr -# Fix test files -%{__python3} %{_rpmconfigdir}/redhat/pathfix.py -i "%{__python3} -Es" -p $(find . -type f -name *.py) - # $MPI_SUFFIX will be evaluated in the loops below, set by mpi modules %global _vpath_builddir %{_vendor}-%{_target_os}-build${MPI_SUFFIX:-_serial} -# We are running the module load/unload manually until there is a macro-like way to expand this -. /etc/profile.d/modules.sh %build @@ -172,7 +145,7 @@ cmake_common_args=( "-DCP2K_USE_LIBINT2:BOOL=OFF" # Detection is broken "-DCP2K_USE_SPGLIB:BOOL=ON" ) -for mpi in '' mpich %{?with_openmpi:openmpi}; do +for mpi in '' mpich openmpi; do if [ -n "$mpi" ]; then module load mpi/${mpi}-%{_arch} cmake_mpi_args=( @@ -199,7 +172,7 @@ for mpi in '' mpich %{?with_openmpi:openmpi}; do done %install -for mpi in '' mpich %{?with_openmpi:openmpi}; do +for mpi in '' mpich openmpi; do [ -n "$mpi" ] && module load mpi/${mpi}-%{_arch} %cmake_install [ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch} @@ -207,9 +180,7 @@ done # TODO: Properly separate the installation of unit tests rm -f %{_buildrootdir}/**/%{_bindir}/*_unittest.* -%if %{with openmpi} rm -f %{_buildrootdir}/**/%{_libdir}/openmpi/bin/*_unittest.* -%endif rm -f %{_buildrootdir}/**/%{_libdir}/mpich/bin/*_unittest.* @@ -219,10 +190,9 @@ export CP2K_DATA_DIR=%{buildroot}%{_datadir}/cp2k/data export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe test_common_args=( "--skip_regtests" - "--maxtasks 4" # Hard-coding maxtasks to avoid hanging. oversubscription should not matter "--ompthreads 2" ) -for mpi in '' mpich %{?with_openmpi:openmpi} ; do +for mpi in '' mpich openmpi ; do if [ -n "$mpi" ]; then # Another module load is done inside the do_regtest.sh. will use that instead module load mpi/${mpi}-%{_arch} @@ -231,21 +201,21 @@ for mpi in '' mpich %{?with_openmpi:openmpi} ; do # Note, final position arguments are also here test_mpi_args=( "--mpiranks 2" - "local_${mpi}" "psmp" ) else bindir=%{_bindir} libdir=%{_libdir} test_mpi_args=( - "local" "ssmp" ) fi # Run packaged do_regtest.sh with appropriate buildroot runpaths + # Note: Running unittests only in the spec file which are not packaged, + # so the binary folder should point to the build directory env PATH=%{buildroot}${bindir}:${PATH} \ LD_LIBRARY_PATH=%{buildroot}${libdir} \ - tests/do_regtest.py %{buildroot}${bindir} ${test_mpi_args[@]} + tests/do_regtest.py ${test_common_args[@]} %{_vpath_builddir}/bin ${test_mpi_args[@]} [ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch} done @@ -270,7 +240,6 @@ done %{_libdir}/libcp2k.so %{_libdir}/pkgconfig/libcp2k.pc -%if %{with openmpi} %files openmpi %{_libdir}/openmpi/bin/cp2k.psmp %{_libdir}/openmpi/bin/dumpdcd.psmp @@ -286,7 +255,6 @@ done %{_libdir}/openmpi/lib/cmake/cp2k/ %{_libdir}/openmpi/lib/libcp2k.so %{_libdir}/openmpi/lib/pkgconfig/libcp2k.pc -%endif %files mpich %{_libdir}/mpich/bin/cp2k.psmp diff --git a/tools/fedora/tests/do_regtest.sh b/tools/fedora/tests/do_regtest.sh index a39a6065e0..a0239725e2 100755 --- a/tools/fedora/tests/do_regtest.sh +++ b/tools/fedora/tests/do_regtest.sh @@ -7,7 +7,7 @@ rlJournalStart rlPhaseStartTest [[ -z "${CP2K_VARIANT}" ]] && rlDie "No CP2K_VARIANT environment variable set" - rlRun "cd ${TMT_TREE}/tests" 0 "cd to cp2k tests folder" + rlRun "pushd tests" 0 "cd to cp2k tests folder" rlRun "args=\"--maxtasks $(nproc) --ompthreads 2\"" 0 "Set base arguments" [[ "${CP2K_SKIP_UNITTEST,,}" == "true" ]] && rlRun "args=\"\$args --skip_unittests\"" 0 "Skip unit tests" @@ -16,12 +16,14 @@ rlJournalStart if [[ "${CP2K_VARIANT}" != "serial" ]]; then rlRun "module avail" 0 "Show available modules" - rlRun "module load mpi/${CP2K_VARIANT}" 0 "Load MPI module: ${CP2K_VARIANT}" + rlRun "module load mpi/${CP2K_VARIANT}-$(arch)" 0 "Load MPI module: ${CP2K_VARIANT}" rlRun "args=\"\$args --mpiranks 2\"" 0 "Set MPI arguments" rlRun "args=\"\$args $MPI_BIN psmp\"" 0 "Set run specific arguments" else rlRun "args=\"\$args /usr/bin ssmp\"" 0 "Set run specific arguments" fi rlRun "./do_regtest.py $args" 0 "Run regression tests" + + rlRun "popd" rlPhaseEnd rlJournalEnd diff --git a/tools/fedora/tests/regression.fmf b/tools/fedora/tests/regression.fmf index 513941c230..e3eb7a7677 100644 --- a/tools/fedora/tests/regression.fmf +++ b/tools/fedora/tests/regression.fmf @@ -1,6 +1,7 @@ summary: Run regression tests framework: beakerlib -test: ./do_regtest.sh +path: / +test: ./tools/fedora/tests/do_regtest.sh # TODO: Reduce the tests duration duration: 2h environment+: