@@ -570,31 +570,26 @@ logical function msmpi_init(this,compiler,error) result(found)
570
570
end if
571
571
572
572
! Check that the runtime is installed
573
- bindir = get_env(' MSMPI_BIN' )
573
+ bindir = " "
574
+ call get_absolute_path(get_env(' MSMPI_BIN' ),bindir,error)
574
575
575
- ! Always use DOS paths with no spaces
576
- if (len_trim (bindir)>0 ) then
577
- bindir = get_dos_path(' C:\Program Files\Microsoft MPI\Bin\mpiexec.exe' ,error)
578
- endif
579
-
580
- print * , ' bindir=' ,bindir
576
+ print * , ' + bindir=' ,bindir
577
+ print * , ' + windir=' ,windir
581
578
582
579
! In some environments, variable %MSMPI_BIN% is missing (i.e. in GitHub Action images).
583
- ! Do a second attempt: search for mpiexec.exe
584
- if (len_trim (bindir)<= 0 .or. .not. exists(bindir) .or. allocated (error)) then
585
- print * , ' + MSMPI_BIN path does not exist, searching mpiexec.exe ....'
586
- call find_command_location( ' mpiexec.exe' ,bindir,verbose = verbose,error = error)
580
+ ! Do a second attempt: search for the default location
581
+ if (len_trim (bindir)<= 0 .or. allocated (error)) then
582
+ print * , ' + MSMPI_BIN path does not exist, searching C:\Program Files\Microsoft MPI\Bin\ ....'
583
+ call get_absolute_path( ' C:\Program Files\Microsoft MPI\Bin\ mpiexec.exe' ,bindir,error)
587
584
endif
588
585
589
- ! Do a third attempt: search for mpiexec.exe in the default location
590
- if (len_trim (bindir)<= 0 .or. .not. exists(bindir) .or. allocated (error)) then
591
- print * , ' + MSMPI_BIN path does not exist, searching C:\Program Files\Microsoft MPI\Bin\mpiexec.exe....'
592
- windir = get_dos_path(' C:\Program Files\Microsoft MPI\Bin\mpiexec.exe' ,error)
586
+ ! Do a third attempt: search for mpiexec.exe in PATH location
587
+ if (len_trim (bindir)<= 0 .or. allocated (error)) then
593
588
594
- print * , ' windir= ' ,windir
589
+ call get_mpi_runner( windir,verbose,error)
595
590
596
591
if (.not. allocated (error)) then
597
- print * , ' + searching location of ' ,windir
592
+ print * , ' + searching location of mpi runner, ' ,windir
598
593
call find_command_location(windir,bindir,verbose= verbose,error= error)
599
594
endif
600
595
@@ -821,7 +816,7 @@ end subroutine find_command_location
821
816
! > Get MPI runner in $PATH
822
817
subroutine get_mpi_runner (command ,verbose ,error )
823
818
type (string_t), intent (out ) :: command
824
- logical , optional , intent (in ) :: verbose
819
+ logical , intent (in ) :: verbose
825
820
type (error_t), allocatable , intent (out ) :: error
826
821
827
822
character (* ), parameter :: try(* ) = [' mpiexec' ,' mpirun ' ]
0 commit comments