@@ -838,6 +838,7 @@ subroutine get_mpi_runner(command,verbose,error)
838
838
type (error_t), allocatable , intent (out ) :: error
839
839
840
840
character (* ), parameter :: try(* ) = [' mpiexec ' ,' mpirun ' ,' mpiexec.exe' ,' mpirun.exe ' ]
841
+ character (:), allocatable :: bindir
841
842
integer :: itri
842
843
logical :: success
843
844
@@ -855,6 +856,25 @@ subroutine get_mpi_runner(command,verbose,error)
855
856
endif
856
857
end do
857
858
859
+ ! On windows, also search in %MSMPI_BIN%
860
+ if (get_os_type()==OS_WINDOWS) then
861
+ ! Check that the runtime is installed
862
+ bindir = " "
863
+ call get_absolute_path(get_env(' MSMPI_BIN' ),bindir,error)
864
+ if (verbose) print * , ' + %MSMPI_BIN%=' ,bindir
865
+ ! In some environments, variable %MSMPI_BIN% is missing (i.e. in GitHub Action images).
866
+ ! Do a second attempt: search for the default location
867
+ if (len_trim (bindir)<= 0 .or. allocated (error)) then
868
+ if (verbose) print * , ' + %MSMPI_BIN% empty, searching C:\Program Files\Microsoft MPI\Bin\ ...'
869
+ call get_absolute_path(' C:\Program Files\Microsoft MPI\Bin\mpiexec.exe' ,bindir,error)
870
+ endif
871
+ if (len_trim (bindir)>0 .and. .not. allocated (error)) then
872
+ ! MSMPI_BIN directory found
873
+ command% s = join_path(bindir,' mpiexec.exe' )
874
+ return
875
+ endif
876
+ endif
877
+
858
878
! No valid command found
859
879
call fatal_error(error,' cannot find a valid mpi runner command' )
860
880
return
0 commit comments