From a4524b5314a142177d68d1a1e4ed96c98839d3ea Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Fri, 23 Feb 2024 13:55:45 -0700 Subject: [PATCH] Update test_prebuild/test_blocked_data test_prebuild/test_chunked_data now that mpi_f08 is a mandatory dependency --- test_prebuild/test_blocked_data/CMakeLists.txt | 10 +++++++++- test_prebuild/test_blocked_data/README.md | 3 +++ test_prebuild/test_chunked_data/CMakeLists.txt | 10 +++++++++- test_prebuild/test_chunked_data/README.md | 3 +++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/test_prebuild/test_blocked_data/CMakeLists.txt b/test_prebuild/test_blocked_data/CMakeLists.txt index 921c87e6..a429e404 100644 --- a/test_prebuild/test_blocked_data/CMakeLists.txt +++ b/test_prebuild/test_blocked_data/CMakeLists.txt @@ -3,12 +3,19 @@ cmake_minimum_required(VERSION 3.0) project(ccpp_blocked_data VERSION 1.0.0 - LANGUAGES Fortran) + LANGUAGES C Fortran) #------------------------------------------------------------------------------ # Request a static build option(BUILD_SHARED_LIBS "Build a shared library" OFF) +#------------------------------------------------------------------------------ +# Set MPI flags for C/C++/Fortran with MPI F08 interface +find_package(MPI REQUIRED C Fortran) +if(NOT MPI_Fortran_HAVE_F08_MODULE) + message(FATAL_ERROR "MPI implementation does not support the Fortran 2008 mpi_f08 interface") +endif() + #------------------------------------------------------------------------------ # Set the sources: physics type definitions set(TYPEDEFS $ENV{CCPP_TYPEDEFS}) @@ -57,6 +64,7 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O0 -fno-unsafe-math-optimizatio #------------------------------------------------------------------------------ add_library(ccpp_blocked_data STATIC ${SCHEMES} ${CAPS} ${API}) +target_link_libraries(ccpp_blocked_data PRIVATE MPI::MPI_Fortran) # Generate list of Fortran modules from defined sources foreach(source_f90 ${CAPS} ${API}) get_filename_component(tmp_source_f90 ${source_f90} NAME) diff --git a/test_prebuild/test_blocked_data/README.md b/test_prebuild/test_blocked_data/README.md index ad977913..ee7962e1 100644 --- a/test_prebuild/test_blocked_data/README.md +++ b/test_prebuild/test_blocked_data/README.md @@ -10,4 +10,7 @@ mkdir build cd build cmake .. 2>&1 | tee log.cmake make 2>&1 | tee log.make +./test_blocked_data.x +# On systems where linking against the MPI library requires a parallel launcher, +# use 'mpirun -np 1 ./test_blocked_data.x' or 'srun -n 1 ./test_blocked_data.x' etc. ``` diff --git a/test_prebuild/test_chunked_data/CMakeLists.txt b/test_prebuild/test_chunked_data/CMakeLists.txt index 0d055768..4d7456f1 100644 --- a/test_prebuild/test_chunked_data/CMakeLists.txt +++ b/test_prebuild/test_chunked_data/CMakeLists.txt @@ -3,12 +3,19 @@ cmake_minimum_required(VERSION 3.0) project(ccpp_chunked_data VERSION 1.0.0 - LANGUAGES Fortran) + LANGUAGES C Fortran) #------------------------------------------------------------------------------ # Request a static build option(BUILD_SHARED_LIBS "Build a shared library" OFF) +#------------------------------------------------------------------------------ +# Set MPI flags for C/C++/Fortran with MPI F08 interface +find_package(MPI REQUIRED C Fortran) +if(NOT MPI_Fortran_HAVE_F08_MODULE) + message(FATAL_ERROR "MPI implementation does not support the Fortran 2008 mpi_f08 interface") +endif() + #------------------------------------------------------------------------------ # Set the sources: physics type definitions set(TYPEDEFS $ENV{CCPP_TYPEDEFS}) @@ -57,6 +64,7 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O0 -fno-unsafe-math-optimizatio #------------------------------------------------------------------------------ add_library(ccpp_chunked_data STATIC ${SCHEMES} ${CAPS} ${API}) +target_link_libraries(ccpp_chunked_data PRIVATE MPI::MPI_Fortran) # Generate list of Fortran modules from defined sources foreach(source_f90 ${CAPS} ${API}) get_filename_component(tmp_source_f90 ${source_f90} NAME) diff --git a/test_prebuild/test_chunked_data/README.md b/test_prebuild/test_chunked_data/README.md index 40812515..16db6fc5 100644 --- a/test_prebuild/test_chunked_data/README.md +++ b/test_prebuild/test_chunked_data/README.md @@ -10,4 +10,7 @@ mkdir build cd build cmake .. 2>&1 | tee log.cmake make 2>&1 | tee log.make +./test_chunked_data.x +# On systems where linking against the MPI library requires a parallel launcher, +# use 'mpirun -np 1 ./test_chunked_data.x' or 'srun -n 1 ./test_chunked_data.x' etc. ```