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

DRAFT: Build with MPI wrappers only when --compiler is mpifort, mpif90, or mpif77 #1042

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rouson
Copy link
Contributor

@rouson rouson commented Jun 3, 2024

When complete, this Pull Request (PR) will address #929 by making it possible for a project to build alternatively with or without the Message Passing Interface ([MPI]) wrappers.

To Do

Change fpm' behavior so that when the manifest [dependencies] block contains mpi = "*", fpm builds with the MPI wrappers and links to the MPI bindings only when
the --compiler argument is mpifort, mpif90, or mpif77.

  • Use MPI compiler wrappers only when the above condition is met and
  • Treat mpi as a metapackage only when the above condition is met.

The first commit in this PR accomplishes the first checked item above. To see this capability in action, one can start a new fpm project via fpm new optional-mpi and then adding the following lines to the manifest optional-mpi/fpm.toml:

[dependencies]
mpi = "*"

At the time of creating this daft PR, when the use of MPI is removed by a C-preprocessor macro such as in

#ifndef NO_MPI
use mpi_f08
#endif

building with the mpi = '*" terminates with an error

<ERROR> *cmd_run* Targets error: Unable to find source for module dependency: "mpi_f08" used by "././src/optional.F90"
STOP 1

because fpm parses files for internal dependencies before running the preprocessor.

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.

1 participant