From 7bf99f7a74f048b4aff4eeb5b3ccbd3d2fdc88a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Sch=C3=BCtt?= Date: Thu, 18 Dec 2025 12:56:38 +0100 Subject: [PATCH] Remove old flags __HAS_PATCHED_CUFFT_70, __NO_MPI_THREAD_SUPPORT_CHECK, and __MINGW --- src/base/machine.F | 20 +++------- src/cp2k_info.F | 9 ----- src/mpiwrap/message_passing.F | 50 ++++++------------------ tools/precommit/check_file_properties.py | 3 -- 4 files changed, 17 insertions(+), 65 deletions(-) diff --git a/src/base/machine.F b/src/base/machine.F index d61fa2e6f3..a668439c4a 100644 --- a/src/base/machine.F +++ b/src/base/machine.F @@ -420,15 +420,12 @@ CONTAINS !> \return ... ! ************************************************************************************************** FUNCTION m_procrun(pid) RESULT(run_on) - INTEGER, INTENT(IN) :: pid - INTEGER :: run_on -#if defined(__MINGW) - run_on = 0 -#else - INTEGER :: istat + INTEGER, INTENT(IN) :: pid + INTEGER :: run_on + INTEGER :: istat INTERFACE - FUNCTION kill(pid, sig) BIND(C, name="kill") RESULT(errno) + FUNCTION kill(pid, sig) RESULT(errno) BIND(C, name="kill") IMPORT INTEGER(KIND=C_INT), VALUE :: pid, sig INTEGER(KIND=C_INT) :: errno @@ -445,7 +442,6 @@ CONTAINS ELSE run_on = 0 ! error, process probably does not exist END IF -#endif END FUNCTION m_procrun ! ************************************************************************************************** @@ -594,11 +590,6 @@ CONTAINS ! ************************************************************************************************** SUBROUTINE m_hostnm(hname) CHARACTER(len=*), INTENT(OUT) :: hname -#if defined(__MINGW) - ! While there is a gethostname in the Windows (POSIX) API, it requires that winsocks is - ! initialised prior to using it via WSAStartup(..), respectively cleaned up at the end via WSACleanup(). - hname = "" -#else INTEGER :: istat, i CHARACTER(len=default_path_length) :: buf @@ -618,7 +609,6 @@ CONTAINS END IF i = INDEX(buf, c_null_char) - 1 hname = buf(1:i) -#endif END SUBROUTINE m_hostnm ! ************************************************************************************************** @@ -732,7 +722,7 @@ CONTAINS RETURN END IF - ! first remove target (needed on windows / mingw) + ! first remove target (needed on windows) istat = m_unlink(TARGET) ! ignore istat of unlink diff --git a/src/cp2k_info.F b/src/cp2k_info.F index bbf9b8f54e..78478aba4b 100644 --- a/src/cp2k_info.F +++ b/src/cp2k_info.F @@ -138,9 +138,6 @@ CONTAINS #if defined(__COSMA) flags = TRIM(flags)//" cosma" #endif -#if defined(__HAS_PATCHED_CUFFT_70) - flags = TRIM(flags)//" patched_cufft_70" -#endif #if defined(__ACE) flags = TRIM(flags)//" ace" #endif @@ -175,15 +172,9 @@ CONTAINS #if defined(__NO_SOCKETS) flags = TRIM(flags)//" no_sockets" #endif -#if defined(__NO_MPI_THREAD_SUPPORT_CHECK) - flags = TRIM(flags)//" no_mpi_thread_support_check" -#endif #if defined(__NO_STATM_ACCESS) flags = TRIM(flags)//" no_statm_access" #endif -#if defined(__MINGW) - flags = TRIM(flags)//" mingw" -#endif #if defined(__PW_CUDA_NO_HOSTALLOC) flags = TRIM(flags)//" pw_cuda_no_hostalloc" #endif diff --git a/src/mpiwrap/message_passing.F b/src/mpiwrap/message_passing.F index 84837dc809..6850f5cc21 100644 --- a/src/mpiwrap/message_passing.F +++ b/src/mpiwrap/message_passing.F @@ -1075,50 +1075,24 @@ CONTAINS SUBROUTINE mp_world_init(mp_comm) CLASS(mp_comm_type), INTENT(OUT) :: mp_comm #if defined(__parallel) - INTEGER :: ierr -!$ INTEGER :: provided_tsl -!$ LOGICAL :: no_threading_support + INTEGER :: ierr, provided_tsl -#if defined(__NO_MPI_THREAD_SUPPORT_CHECK) - ! Hack that does not request or check MPI thread support level. - ! User asserts that the MPI library will work correctly with - ! threads. -! -!$ no_threading_support = .TRUE. -#else - ! Does the right thing when using OpenMP: requests that the MPI - ! library supports serialized mode and verifies that the MPI library - ! provides that support. - ! - ! Developers: Only the master thread will ever make calls to the - ! MPI library. -! -!$ no_threading_support = .FALSE. -#endif -!$ IF (no_threading_support) THEN - CALL mpi_init(ierr) - IF (ierr /= 0) CALL mp_stop(ierr, "mpi_init @ mp_world_init") -!$ ELSE !$OMP MASTER #if defined(__DLAF) - ! DLA-Future requires that the MPI library supports - ! THREAD_MULTIPLE mode -!$ CALL mpi_init_thread(MPI_THREAD_MULTIPLE, provided_tsl, ierr) + ! DLA-Future requires that the MPI library supports THREAD_MULTIPLE mode + CALL mpi_init_thread(MPI_THREAD_MULTIPLE, provided_tsl, ierr) + IF (ierr /= 0) CALL mp_stop(ierr, "mpi_init_thread @ mp_world_init") + IF (provided_tsl < MPI_THREAD_MULTIPLE) THEN + CALL mp_stop(0, "MPI library does not support the requested level of threading (MPI_THREAD_MULTIPLE), required by DLA-Future. Build CP2K without DLA-Future.") + END IF #else -!$ CALL mpi_init_thread(MPI_THREAD_SERIALIZED, provided_tsl, ierr) -#endif -!$ IF (ierr /= 0) CALL mp_stop(ierr, "mpi_init_thread @ mp_world_init") -#if defined(__DLAF) -!$ IF (provided_tsl < MPI_THREAD_MULTIPLE) THEN -!$ CALL mp_stop(0, "MPI library does not support the requested level of threading (MPI_THREAD_MULTIPLE), required by DLA-Future. Build CP2K without DLA-Future.") -!$ END IF -#else -!$ IF (provided_tsl < MPI_THREAD_SERIALIZED) THEN -!$ CALL mp_stop(0, "MPI library does not support the requested level of threading (MPI_THREAD_SERIALIZED).") -!$ END IF + CALL mpi_init_thread(MPI_THREAD_SERIALIZED, provided_tsl, ierr) + IF (ierr /= 0) CALL mp_stop(ierr, "mpi_init_thread @ mp_world_init") + IF (provided_tsl < MPI_THREAD_SERIALIZED) THEN + CALL mp_stop(0, "MPI library does not support the requested level of threading (MPI_THREAD_SERIALIZED).") + END IF #endif !$OMP END MASTER -!$ END IF CALL mpi_comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN, ierr) IF (ierr /= 0) CALL mp_stop(ierr, "mpi_comm_set_errhandler @ mp_world_init") #endif diff --git a/tools/precommit/check_file_properties.py b/tools/precommit/check_file_properties.py index 7b1515e7b7..01bc53988f 100755 --- a/tools/precommit/check_file_properties.py +++ b/tools/precommit/check_file_properties.py @@ -81,12 +81,10 @@ FLAG_EXCEPTIONS = ( # See also https://github.com/cp2k/cp2k/issues/4611 r"__PW_FPGA", r"__PW_FPGA_SP", - r"__NO_MPI_THREAD_SUPPORT_CHECK", r"__NO_SOCKETS", r"__SCALAPACK_NO_WA", r"__CRAY_PM_ACCEL_ENERGY", r"__CRAY_PM_ENERGY", - r"__MINGW", r"__NO_STATM_ACCESS", r"__STATM_RESIDENT", r"__STATM_TOTAL", @@ -95,7 +93,6 @@ FLAG_EXCEPTIONS = ( r"__ELPA_NVIDIA_GPU", r"__CRAY_PM_ACCEL_ENERGY", r"__CRAY_PM_ENERGY", - r"__HAS_PATCHED_CUFFT_70", r"__OFFLOAD_PROFILING", r"__STATM_RESIDENT", r"__STATM_TOTAL",