Fix fedora builds

This commit is contained in:
Cristian Le 2024-11-18 11:40:33 +01:00 committed by GitHub
parent d41ea5a552
commit 16069d6911
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 61 deletions

View file

@ -20,7 +20,6 @@ test_command:
default_identifier: smoke default_identifier: smoke
targets: targets:
# TODO: Match F40 release
- fedora-development-x86_64 - fedora-development-x86_64
- fedora-development-aarch64 - fedora-development-aarch64
- fedora-latest-x86_64 - fedora-latest-x86_64
@ -36,7 +35,6 @@ jobs:
trigger: commit trigger: commit
branch: master branch: master
project: nightly project: nightly
update_release: true
- &tests - &tests
job: tests job: tests
trigger: commit trigger: commit

View file

@ -250,7 +250,7 @@ class Config:
default_ompthreads = 2 if "smp" in args.version else 1 default_ompthreads = 2 if "smp" in args.version else 1
self.ompthreads = args.ompthreads if args.ompthreads else default_ompthreads self.ompthreads = args.ompthreads if args.ompthreads else default_ompthreads
self.mpiranks = args.mpiranks if self.use_mpi else 1 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.workers = Semaphore(self.num_workers)
self.cp2k_root = Path(__file__).resolve().parent.parent self.cp2k_root = Path(__file__).resolve().parent.parent
self.mpiexec = args.mpiexec self.mpiexec = args.mpiexec
@ -306,11 +306,8 @@ class Config:
env["CUDA_VISIBLE_DEVICES"] = ",".join(visible_gpu_devices) env["CUDA_VISIBLE_DEVICES"] = ",".join(visible_gpu_devices)
env["HIP_VISIBLE_DEVICES"] = ",".join(visible_gpu_devices) env["HIP_VISIBLE_DEVICES"] = ",".join(visible_gpu_devices)
env["OMP_NUM_THREADS"] = str(self.ompthreads) env["OMP_NUM_THREADS"] = str(self.ompthreads)
exe_path = Path(f"{exe_stem}.{self.version}") exe_name = f"{exe_stem}.{self.version}"
if exe_path.is_absolute(): cmd = [str(self.binary_dir / exe_name)]
cmd = [str(exe_path)]
else:
cmd = [str(self.binary_dir / f"{exe_stem}.{self.version}")]
if self.valgrind: if self.valgrind:
cmd = ["valgrind", "--error-exitcode=42", "--exit-on-first-error=yes"] + cmd cmd = ["valgrind", "--error-exitcode=42", "--exit-on-first-error=yes"] + cmd
if self.use_mpi: if self.use_mpi:

View file

@ -1,16 +1,5 @@
# No openmpi on i668 with openmpi 5 in Fedora 40+ # libxsmm is designed for x86_64 architectures only, see project's README
%ifarch %{ix86} %bcond libxsmm %[ "%{_arch}" == "x86_64" ]
%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
# Disable LTO due to https://bugzilla.redhat.com/show_bug.cgi?id=2243158 # Disable LTO due to https://bugzilla.redhat.com/show_bug.cgi?id=2243158
%global _lto_cflags %nil %global _lto_cflags %nil
@ -23,39 +12,31 @@ License: GPL-2.0-or-later
URL: https://www.cp2k.org/ URL: https://www.cp2k.org/
Source0: https://github.com/cp2k/cp2k/releases/download/v%{version}/cp2k-%{version}.tar.bz2 Source0: https://github.com/cp2k/cp2k/releases/download/v%{version}/cp2k-%{version}.tar.bz2
# Remove testing packages that were previously packaged # Drop 32bit architectures
# 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
# Flaky MPI issues on s390x, and upstream do not officially support it yet # Flaky MPI issues on s390x, and upstream do not officially support it yet
# https://github.com/cp2k/cp2k/issues/3362 # https://github.com/cp2k/cp2k/issues/3362
ExcludeArch: s390x ExcludeArch: %{ix86} s390x
# Build dependencies # Build dependencies
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-gfortran BuildRequires: gcc-gfortran
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: ninja-build BuildRequires: ninja-build
BuildRequires: python3-fypp BuildRequires: python3-fypp
# Project dependencies # Project dependencies
BuildRequires: flexiblas-devel BuildRequires: flexiblas-devel
BuildRequires: dbcsr-devel >= 2.6.0 BuildRequires: cmake(DBCSR)
BuildRequires: fftw-devel BuildRequires: pkgconfig(fftw3)
%if %{with libxsmm} %if %{with libxsmm}
BuildRequires: libxsmm-devel >= 1.8.1-3 BuildRequires: pkgconfig(libxsmm)
%endif %endif
BuildRequires: libxc-devel >= 5.1.0 # cmake(Libxc) technically fails
BuildRequires: spglib-devel # https://github.com/cp2k/cp2k/issues/3767
BuildRequires: libxc-devel
BuildRequires: cmake(Spglib)
# Test dependencies # Test dependencies
BuildRequires: python3 BuildRequires: python3
# For pathfix.py
BuildRequires: python3-devel
Requires: %{name}-common = %{version}-%{release} Requires: %{name}-common = %{version}-%{release}
@ -92,7 +73,6 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
The %{name}-devel package contains libraries and header files for The %{name}-devel package contains libraries and header files for
developing applications that use %{name}. developing applications that use %{name}.
%if %{with openmpi}
%package openmpi %package openmpi
Summary: Molecular simulations software - openmpi version Summary: Molecular simulations software - openmpi version
BuildRequires: openmpi-devel BuildRequires: openmpi-devel
@ -117,8 +97,6 @@ Requires: %{name}-openmpi%{?_isa} = %{version}-%{release}
The %{name}-devel package contains libraries and header files for The %{name}-devel package contains libraries and header files for
developing applications that use %{name}. developing applications that use %{name}.
%endif
%package mpich %package mpich
Summary: Molecular simulations software - mpich version Summary: Molecular simulations software - mpich version
BuildRequires: mpich-devel BuildRequires: mpich-devel
@ -149,13 +127,8 @@ developing applications that use %{name}.
rm tools/build_utils/fypp rm tools/build_utils/fypp
rm -r exts/dbcsr 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 # $MPI_SUFFIX will be evaluated in the loops below, set by mpi modules
%global _vpath_builddir %{_vendor}-%{_target_os}-build${MPI_SUFFIX:-_serial} %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 %build
@ -172,7 +145,7 @@ cmake_common_args=(
"-DCP2K_USE_LIBINT2:BOOL=OFF" # Detection is broken "-DCP2K_USE_LIBINT2:BOOL=OFF" # Detection is broken
"-DCP2K_USE_SPGLIB:BOOL=ON" "-DCP2K_USE_SPGLIB:BOOL=ON"
) )
for mpi in '' mpich %{?with_openmpi:openmpi}; do for mpi in '' mpich openmpi; do
if [ -n "$mpi" ]; then if [ -n "$mpi" ]; then
module load mpi/${mpi}-%{_arch} module load mpi/${mpi}-%{_arch}
cmake_mpi_args=( cmake_mpi_args=(
@ -199,7 +172,7 @@ for mpi in '' mpich %{?with_openmpi:openmpi}; do
done done
%install %install
for mpi in '' mpich %{?with_openmpi:openmpi}; do for mpi in '' mpich openmpi; do
[ -n "$mpi" ] && module load mpi/${mpi}-%{_arch} [ -n "$mpi" ] && module load mpi/${mpi}-%{_arch}
%cmake_install %cmake_install
[ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch} [ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch}
@ -207,9 +180,7 @@ done
# TODO: Properly separate the installation of unit tests # TODO: Properly separate the installation of unit tests
rm -f %{_buildrootdir}/**/%{_bindir}/*_unittest.* rm -f %{_buildrootdir}/**/%{_bindir}/*_unittest.*
%if %{with openmpi}
rm -f %{_buildrootdir}/**/%{_libdir}/openmpi/bin/*_unittest.* rm -f %{_buildrootdir}/**/%{_libdir}/openmpi/bin/*_unittest.*
%endif
rm -f %{_buildrootdir}/**/%{_libdir}/mpich/bin/*_unittest.* 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 export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe
test_common_args=( test_common_args=(
"--skip_regtests" "--skip_regtests"
"--maxtasks 4" # Hard-coding maxtasks to avoid hanging. oversubscription should not matter
"--ompthreads 2" "--ompthreads 2"
) )
for mpi in '' mpich %{?with_openmpi:openmpi} ; do for mpi in '' mpich openmpi ; do
if [ -n "$mpi" ]; then if [ -n "$mpi" ]; then
# Another module load is done inside the do_regtest.sh. will use that instead # Another module load is done inside the do_regtest.sh. will use that instead
module load mpi/${mpi}-%{_arch} module load mpi/${mpi}-%{_arch}
@ -231,21 +201,21 @@ for mpi in '' mpich %{?with_openmpi:openmpi} ; do
# Note, final position arguments are also here # Note, final position arguments are also here
test_mpi_args=( test_mpi_args=(
"--mpiranks 2" "--mpiranks 2"
"local_${mpi}"
"psmp" "psmp"
) )
else else
bindir=%{_bindir} bindir=%{_bindir}
libdir=%{_libdir} libdir=%{_libdir}
test_mpi_args=( test_mpi_args=(
"local"
"ssmp" "ssmp"
) )
fi fi
# Run packaged do_regtest.sh with appropriate buildroot runpaths # 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} \ env PATH=%{buildroot}${bindir}:${PATH} \
LD_LIBRARY_PATH=%{buildroot}${libdir} \ 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} [ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch}
done done
@ -270,7 +240,6 @@ done
%{_libdir}/libcp2k.so %{_libdir}/libcp2k.so
%{_libdir}/pkgconfig/libcp2k.pc %{_libdir}/pkgconfig/libcp2k.pc
%if %{with openmpi}
%files openmpi %files openmpi
%{_libdir}/openmpi/bin/cp2k.psmp %{_libdir}/openmpi/bin/cp2k.psmp
%{_libdir}/openmpi/bin/dumpdcd.psmp %{_libdir}/openmpi/bin/dumpdcd.psmp
@ -286,7 +255,6 @@ done
%{_libdir}/openmpi/lib/cmake/cp2k/ %{_libdir}/openmpi/lib/cmake/cp2k/
%{_libdir}/openmpi/lib/libcp2k.so %{_libdir}/openmpi/lib/libcp2k.so
%{_libdir}/openmpi/lib/pkgconfig/libcp2k.pc %{_libdir}/openmpi/lib/pkgconfig/libcp2k.pc
%endif
%files mpich %files mpich
%{_libdir}/mpich/bin/cp2k.psmp %{_libdir}/mpich/bin/cp2k.psmp

View file

@ -7,7 +7,7 @@ rlJournalStart
rlPhaseStartTest rlPhaseStartTest
[[ -z "${CP2K_VARIANT}" ]] && rlDie "No CP2K_VARIANT environment variable set" [[ -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" rlRun "args=\"--maxtasks $(nproc) --ompthreads 2\"" 0 "Set base arguments"
[[ "${CP2K_SKIP_UNITTEST,,}" == "true" ]] && rlRun "args=\"\$args --skip_unittests\"" 0 "Skip unit tests" [[ "${CP2K_SKIP_UNITTEST,,}" == "true" ]] && rlRun "args=\"\$args --skip_unittests\"" 0 "Skip unit tests"
@ -16,12 +16,14 @@ rlJournalStart
if [[ "${CP2K_VARIANT}" != "serial" ]]; then if [[ "${CP2K_VARIANT}" != "serial" ]]; then
rlRun "module avail" 0 "Show available modules" 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 --mpiranks 2\"" 0 "Set MPI arguments"
rlRun "args=\"\$args $MPI_BIN psmp\"" 0 "Set run specific arguments" rlRun "args=\"\$args $MPI_BIN psmp\"" 0 "Set run specific arguments"
else else
rlRun "args=\"\$args /usr/bin ssmp\"" 0 "Set run specific arguments" rlRun "args=\"\$args /usr/bin ssmp\"" 0 "Set run specific arguments"
fi fi
rlRun "./do_regtest.py $args" 0 "Run regression tests" rlRun "./do_regtest.py $args" 0 "Run regression tests"
rlRun "popd"
rlPhaseEnd rlPhaseEnd
rlJournalEnd rlJournalEnd

View file

@ -1,6 +1,7 @@
summary: Run regression tests summary: Run regression tests
framework: beakerlib framework: beakerlib
test: ./do_regtest.sh path: /
test: ./tools/fedora/tests/do_regtest.sh
# TODO: Reduce the tests duration # TODO: Reduce the tests duration
duration: 2h duration: 2h
environment+: environment+: