Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to use mpi_f08 MPI module #523

Merged
merged 24 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
03790c7
Swtich to mpi_f08 module. Add MPI_Comm DDT
DusanJovic-NOAA Mar 24, 2022
29ce545
Merge remote-tracking branch 'origin/main' into no_arg_mismatch
DusanJovic-NOAA May 13, 2022
15edfdd
Merge remote-tracking branch 'origin/main' into no_arg_mismatch
DusanJovic-NOAA Jun 14, 2022
fb895cc
Merge remote-tracking branch 'origin/main' into no_arg_mismatch
DusanJovic-NOAA Jul 5, 2022
39be461
Merge remote-tracking branch 'origin/main' into no_arg_mismatch
DusanJovic-NOAA Aug 10, 2022
47a1e9c
Fix local MPI_Comm type
DusanJovic-NOAA Sep 28, 2022
9fd0a45
Merge branch 'main' into no_arg_mismatch
DusanJovic-NOAA Oct 13, 2022
1e08927
If MPI is used, find package
climbfuji Nov 7, 2022
c3c4c7c
Fixed cmake if/endif mismatch
DusanJovic-NOAA Nov 18, 2022
202e4d0
Merge remote-tracking branch 'origin/main' into no_arg_mismatch
DusanJovic-NOAA Mar 16, 2023
583b243
Merge remote-tracking branch 'origin/main' into no_arg_mismatch
DusanJovic-NOAA May 4, 2023
1e25847
Merge remote-tracking branch 'origin/main' into no_arg_mismatch
DusanJovic-NOAA Nov 3, 2023
0793203
Merge remote-tracking branch 'origin/main' into no_arg_mismatch
DusanJovic-NOAA Dec 18, 2023
ad0b7c7
Merge remote-tracking branch 'origin/main' into no_arg_mismatch
DusanJovic-NOAA Jan 16, 2024
6fa909f
Merge branch 'main' of https://github.com/NCAR/ccpp-framework into HEAD
climbfuji Feb 23, 2024
2cee086
Make mpi_f08 a mandatory dependency of ccpp-framework
climbfuji Feb 23, 2024
a4524b5
Update test_prebuild/test_blocked_data test_prebuild/test_chunked_dat…
climbfuji Feb 23, 2024
c87dbb7
Merge branch 'main' into no_arg_mismatch
climbfuji Feb 23, 2024
ab3bf01
Merge branch 'no_arg_mismatch' of https://github.com/dusanjovic-noaa/…
climbfuji Feb 23, 2024
13ec121
Bump minimum cmake version required
climbfuji Feb 23, 2024
44eb919
Merge pull request #1 from climbfuji/no_arg_mismatch
DusanJovic-NOAA Feb 26, 2024
c911911
Remove C from MPI find_package
DusanJovic-NOAA Feb 26, 2024
fbec3a8
Merge remote-tracking branch 'origin/main' into no_arg_mismatch
DusanJovic-NOAA Mar 18, 2024
7384d92
Merge remote-tracking branch 'origin/main' into no_arg_mismatch
DusanJovic-NOAA Mar 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.10)

project(ccpp_framework
VERSION 5.0.0
Expand All @@ -10,6 +10,13 @@ set(PACKAGE "ccpp-framework")
set(AUTHORS "Dom Heinzeller" "Grant Firl" "Mike Kavulich" "Steve Goldhaber")
string(TIMESTAMP YEAR "%Y")

#------------------------------------------------------------------------------
# Set MPI flags for C/C++/Fortran with MPI F08 interface
find_package(MPI REQUIRED C Fortran)
if(NOT MPI_Fortran_HAVE_F08_MODULE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to check if this works - in my experience, if you as for MPI REQUIRED C Fortran you also need to define LANGUAGES C Fortran in line 5. Better would be to remove the C dependency here, since there is no C code in ccpp-framework?

message(FATAL_ERROR "MPI implementation does not support the Fortran 2008 mpi_f08 interface")
endif()

#------------------------------------------------------------------------------
# Set OpenMP flags for C/C++/Fortran
if (OPENMP)
Expand Down
3 changes: 3 additions & 0 deletions src/ccpp_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
!
module ccpp_types

use mpi_f08, only: MPI_Comm

!! \section arg_table_ccpp_types
!! \htmlinclude ccpp_types.html
!!
Expand All @@ -27,6 +29,7 @@ module ccpp_types

private
public :: ccpp_t, one
public :: MPI_Comm

!> @var Definition of constant one
integer, parameter :: one = 1
Expand Down
16 changes: 16 additions & 0 deletions src/ccpp_types.meta
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@
dimensions = ()
type = integer

########################################################################
[ccpp-table-properties]
name = MPI_Comm
type = ddt
dependencies =

[ccpp-arg-table]
name = MPI_Comm
type = ddt

########################################################################

[ccpp-table-properties]
Expand All @@ -79,3 +89,9 @@
units = 1
dimensions = ()
type = integer
[MPI_Comm]
standard_name = MPI_Comm
long_name = definition of type MPI_Comm
units = DDT
dimensions = ()
type = MPI_Comm
12 changes: 10 additions & 2 deletions test_prebuild/test_blocked_data/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
#------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.10)

project(ccpp_blocked_data
VERSION 1.0.0
LANGUAGES Fortran)
LANGUAGES C Fortran)
dustinswales marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note. I will clean this and line 14 up in a follow-up PR; similar for test_chunked_data.


#------------------------------------------------------------------------------
# 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})
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions test_prebuild/test_blocked_data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
```
12 changes: 10 additions & 2 deletions test_prebuild/test_chunked_data/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
#------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.10)

project(ccpp_chunked_data
VERSION 1.0.0
LANGUAGES Fortran)
LANGUAGES C Fortran)
dustinswales marked this conversation as resolved.
Show resolved Hide resolved

#------------------------------------------------------------------------------
# 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})
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions test_prebuild/test_chunked_data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
```
Loading