Skip to content

Commit fde7e7c

Browse files
committed
MPI: check run command only on run and test apps
1 parent 6d33e74 commit fde7e7c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/fpm_meta.f90

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,15 @@ subroutine add_metapackage_model(model,package,settings,name,error)
412412
call meta%resolve(settings,error)
413413
if (allocated(error)) return
414414

415+
! If we need to run executables, there shouold be an MPI runner
416+
if (name=="mpi") then
417+
select type (settings)
418+
class is (fpm_run_settings) ! run, test
419+
if (.not.meta%has_run_command) &
420+
call fatal_error(error,"cannot find a valid mpi runner on the local host")
421+
end select
422+
endif
423+
415424
end subroutine add_metapackage_model
416425

417426
!> Resolve all metapackages into the package config
@@ -1006,8 +1015,10 @@ subroutine init_mpi_from_wrappers(this,compiler,mpilib,fort_wrapper,c_wrapper,cx
10061015

10071016
!> Add default run command, if present
10081017
this%run_command = mpi_wrapper_query(mpilib,fort_wrapper,'runner',verbose,error)
1009-
if (allocated(error)) return
1010-
this%has_run_command = len_trim(this%run_command)>0
1018+
this%has_run_command = (len_trim(this%run_command)>0) .and. .not.allocated(error)
1019+
1020+
!> Do not trigger a fatal error here if run command is missing
1021+
if (allocated(error)) deallocate(error)
10111022

10121023
contains
10131024

0 commit comments

Comments
 (0)