Hello, I am new to the fpm and experimenting with its functionality. It’s probably trivial but I am having troubles with building a project using Intel MPI library. Say I want to build the following hello_world using mpi:
program helloworld
use mpi
implicit none
integer :: rank, comsize, ierr
call MPI_Init(ierr)
call MPI_Comm_size(MPI_COMM_WORLD, comsize, ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr)
print *,'Hello World, from task ', rank, 'of', comsize
call MPI_Finalize(ierr)
end program helloworld
I tried multiple combinations of commands from fpm but I keep getting the following error message: <ERROR>*cmd_build*:target error:Unable to find source for module dependency: "mpi" used by "app/hello_mpi.f90"
I have Intel MPI loaded as a module on the cluster I am working on. Is there a way to build it using fpm? Thanks in advance.
Each MPI setup varies, and so how to run the program can vary from having
to use fpm run --runner ‘mpirun …’ to having to make a customized compiler
script but for a basic MPI program using the Intel software on Linux or Unix
it is just a matter of specifying mpiifort instead of ifort as your compiler
and specifying that the mpi module is external to your package.
You want to make sure to look at the fpm(1) manifest file format. In
particular:
In particular that means to add the ‘external-modules - “mpi”’ line to
your fpm.toml file.
Then, depending on which fpm(1) version you have you can set the FPM_FC
environment variable to “mpiifort”. Note the two "i"s.
If that does not work, add the “–compiler mpiifort” option to any build,
run, test subcommands.
For simpler projects you are ready to go. You may find setting some
of the options for more complex projects is done more easily through
an Intel ifort configuration variable or file, but try to do as much
with the fpm.toml file as possible, as it will not be a self-contained
package if it depends on such files and would be harder to make into a
remote dependency package for others to use.
Ahh, looks like this got answers while I was trying out some options with other MPI packages and platforms and got sidetracked. At least we all agree :>