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

MPI: check presence of a runner command only with run and test apps #937

Merged
merged 13 commits into from
Jun 27, 2023
17 changes: 14 additions & 3 deletions src/fpm_meta.f90
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,15 @@ subroutine add_metapackage_model(model,package,settings,name,error)
call meta%resolve(settings,error)
if (allocated(error)) return

! If we need to run executables, there shouold be an MPI runner
perazz marked this conversation as resolved.
Show resolved Hide resolved
if (name=="mpi") then
select type (settings)
class is (fpm_run_settings) ! run, test
if (.not.meta%has_run_command) &
call fatal_error(error,"cannot find a valid mpi runner on the local host")
end select
endif

end subroutine add_metapackage_model

!> Resolve all metapackages into the package config
Expand Down Expand Up @@ -855,7 +864,7 @@ subroutine get_mpi_runner(command,verbose,error)

! Try several commands
do itri=1,size(try)
call find_command_location(trim(try(itri)),command%s,verbose=.true.,error=error)
call find_command_location(trim(try(itri)),command%s,verbose=verbose,error=error)
if (allocated(error)) cycle

! Success!
Expand Down Expand Up @@ -1006,8 +1015,10 @@ subroutine init_mpi_from_wrappers(this,compiler,mpilib,fort_wrapper,c_wrapper,cx

!> Add default run command, if present
this%run_command = mpi_wrapper_query(mpilib,fort_wrapper,'runner',verbose,error)
if (allocated(error)) return
this%has_run_command = len_trim(this%run_command)>0
this%has_run_command = (len_trim(this%run_command)>0) .and. .not.allocated(error)

!> Do not trigger a fatal error here if run command is missing
if (allocated(error)) deallocate(error)
minhqdao marked this conversation as resolved.
Show resolved Hide resolved

contains

Expand Down