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

New version of GtoL, using MPI Datatypes. #43

Closed
wants to merge 0 commits into from

Conversation

dmitrypek
Copy link

…Can be used to send individual levels or all levels at once.

@FussyDuck
Copy link

FussyDuck commented Nov 8, 2023

CLA assistant check
All committers have signed the CLA.

@samhatfield
Copy link
Collaborator

On ECMWF HPC at least, I need to add MPI as a required package for the MPI CMake feature, and MPI::MPI_Fortran as a private library on the trans_${prec} target. Otherwise compilation of trgtol_mod.F90 fails because mpi.mod is not on the include path (USE MPI has been added to this file).

@dmitrypek could you make these changes and push to your branch?

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 89c513c..f66ff1d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,8 @@ ecbuild_find_package( NAME fiat REQUIRED )

 ecbuild_add_option( FEATURE MPI
                     DESCRIPTION "Support for MPI distributed memory parallelism"
-                    CONDITION fiat_HAVE_MPI )
+                    CONDITION fiat_HAVE_MPI
+                    REQUIRED_PACKAGES "MPI COMPONENTS Fortran")

 ecbuild_add_option( FEATURE OMP
                     DEFAULT ON
diff --git a/src/trans/CMakeLists.txt b/src/trans/CMakeLists.txt
index 256ad41..b6592b3 100644
--- a/src/trans/CMakeLists.txt
+++ b/src/trans/CMakeLists.txt
@@ -59,6 +59,7 @@ foreach( prec sp dp )
                        $<INSTALL_INTERFACE:include/ectrans>
                        $<INSTALL_INTERFACE:include>
       PUBLIC_LIBS      fiat parkind_${prec}
+      PRIVATE_LIBS     MPI::MPI_Fortran
     )
     ectrans_target_fortran_module_directory(
       TARGET            trans_${prec}

Note that, for various reasons, we prefer not to use the MPI API directly from code in the IFS and dependencies, including ecTrans. Instead we prefer to use our own wrapper on top of MPI, MPL (part of the FIAT library). This is fine for now, but in future we should find a way to replace the MPI_ calls with equivalent MPL_ calls.

@samhatfield
Copy link
Collaborator

You should be able to git apply this file directly:

diff.patch

@samhatfield
Copy link
Collaborator

I built and ran a test, but it crashed with a segfault. The error suggests the problem is the IND variable of TRGTOL_COMM. This variable is referenced here before it's initialised. Looks like the commented-out code above initialises it. Could you look into this @dmitrypek ?

@dmitrypek
Copy link
Author

This problem should be fixed now. Please give it a try.

@samhatfield
Copy link
Collaborator

Thanks Dmitry - I was able to build and test it. By the way, there's a typo on line 778 - SEND_BY_LEVELS.

@dmitrypek
Copy link
Author

Thanks - typo fixed. Let me know if you have any questions.

@samhatfield
Copy link
Collaborator

Thanks @dmitrypek. I'm doing some benchmarks so we can discuss this in our next meeting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants