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

Feature: Add MPI wrappers #85

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Feature: Add MPI wrappers #85

wants to merge 2 commits into from

Conversation

rouson
Copy link
Member

@rouson rouson commented May 14, 2024

Fixes #84

Prerequisite: fpm 0.10.1 to avoid unnecessary build repetition (see fortran-lang/fpm#1007).

To Do

  • Facilitate both serial builds and MPI-enabled parallel builds

As of commit b17c2c0, executing the following command

fpm test --compiler mpifort --runner "mpiexec -n 1"

passes all tests only if the changes below are applied. However, applying these changes breaks serial builds with fpm test.

 % git diff
diff --git a/test/command_line_test.F90 b/test/command_line_test.F90
index 01b80c9e..cc7a7b30 100644
--- a/test/command_line_test.F90
+++ b/test/command_line_test.F90
@@ -56,7 +56,7 @@ contains
     character(len=132) command_message
 
     call execute_command_line( &
-      command = "fpm run --example get-flag-value -- --input-file some_file_name", &
+      command = "fpm run --example get-flag-value --compiler mpifort --runner 'mpiexec -n 1' -- --input-file some_file_name", &
       wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message &
     )   
     test_passes = exit_status == 0 
@@ -68,7 +68,7 @@ contains
     character(len=132) command_message
 
     call execute_command_line( &
-      command = "fpm run --example handle-missing-flag -- --empty-flag", &
+      command = "fpm run --example handle-missing-flag --compiler mpifort --runner 'mpiexec -n 1' -- --empty-flag", &
       wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message &
     )   
     test_passes = exit_status == 0 
@@ -80,7 +80,7 @@ contains
     character(len=132) command_message
 
     call execute_command_line( &
-      command = "fpm run --example check-command-line-argument -- --some-argument", &
+      command = "fpm run --example check-command-line-argument --compiler mpifort --runner 'mpiexec -n 1' -- --some-argument", &
       wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message &
     )
     test_passes = exit_status == 0

@ktras
Copy link
Collaborator

ktras commented May 15, 2024

@rouson What version of mpifort were you using? I can't get this branch to compile. Did you make any other local changes (other than what is in the comment related to testing) that aren't represented in the remote branch?

This commit breaks non-MPI builds.  To build and test with MPI, run

fpm test \
  --compiler mpifort \
  --runner "mpiexec -n 1" \
  --flag "-DUSE_MPI" \
  --profile release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a module that replaces the non-coarray parallel features with MPI when necessary
2 participants