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

Use env variables instead of hardcoded paths for ms-mpi search #327

Merged
merged 1 commit into from
Sep 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 37 additions & 13 deletions src/tools/mpi.jam
Original file line number Diff line number Diff line change
Expand Up @@ -246,35 +246,60 @@ rule init ( mpicxx ? : options * : mpirun-with-options * )
if ! $(mpicxx) && [ os.on-windows ]
{
# Paths for Microsoft MPI
local ms_mpi_path_native = "C:\\Program Files\\Microsoft MPI" ;
local ms_mpi_sdk_path_native = "C:\\Program Files (x86)\\Microsoft SDKs\\MPI" ;
# Treat them explicitly as native OS path references
local ms_mpi_bin_native = [ os.environ MSMPI_BIN ] ;
if $(ms_mpi_bin_native)
{
ms_mpi_bin_native = [ path.make $(ms_mpi_bin_native) ] ;
ms_mpi_bin_native = [ path.native $(ms_mpi_bin_native) ] ;
}

local ms_mpi_inc_native = [ os.environ MSMPI_INC ] ;
if $(ms_mpi_inc_native)
{
ms_mpi_inc_native = [ path.make $(ms_mpi_inc_native) ] ;
ms_mpi_inc_native = [ path.native $(ms_mpi_inc_native) ] ;
}

# Path for Microsoft Compute Cluster Pack
local cluster_pack_path_native = "C:\\Program Files\\Microsoft Compute Cluster Pack" ;

# Try to auto-configure Microsoft MPI
if [ GLOB $(ms_mpi_path_native)\\Bin : mpiexec.exe ] &&
[ GLOB $(ms_mpi_sdk_path_native)\\Include : mpi.h ]
if $(ms_mpi_bin_native) &&
$(ms_mpi_inc_native) &&
[ GLOB $(ms_mpi_bin_native) : mpiexec.exe ] &&
[ GLOB $(ms_mpi_inc_native) : mpi.h ]
{
if $(.debug-configuration)
{
ECHO "Found Microsoft MPI: $(ms_mpi_path_native)" ;
ECHO "Found Microsoft MPI SDK: $(ms_mpi_sdk_path_native)" ;
ECHO "Found Microsoft MPI and Microsoft MPI SDK" ;
}

local ms_mpi_lib32 = [ os.environ MSMPI_LIB32 ] ;
if $(ms_mpi_lib32)
{
ms_mpi_lib32 = [ path.make $(ms_mpi_lib32) ] ;
}

local ms_mpi_lib64 = [ os.environ MSMPI_LIB64 ] ;
if $(ms_mpi_lib64)
{
ms_mpi_lib64 = [ path.make $(ms_mpi_lib64) ] ;
}

local ms_mpi_sdk_path = [ path.make $(ms_mpi_sdk_path_native) ] ;
local ms_mpi_inc = [ path.make $(ms_mpi_inc_native) ] ;

# Pick up either the 32-bit or 64-bit library, depending on which address
# model the user has selected. Default to 32-bit.
options = <include>$(ms_mpi_sdk_path)/Include
<address-model>64:<library-path>$(ms_mpi_sdk_path)/Lib/x64
<library-path>$(ms_mpi_sdk_path)/Lib/x86
options = <include>$(ms_mpi_inc)
<address-model>64:<library-path>$(ms_mpi_lib64)
<library-path>$(ms_mpi_lib32)
<find-static-library>msmpi
<toolset>msvc:<define>_SECURE_SCL=0
;

# Setup the "mpirun" equivalent (mpiexec)
.mpirun = "\"$(ms_mpi_path_native)\\Bin\\mpiexec.exe"\" ;
.mpirun = "\"$(ms_mpi_bin_native)\\mpiexec.exe"\" ;
.mpirun_flags = -n ;
}
# Try to auto-configure to the Microsoft Compute Cluster Pack
Expand Down Expand Up @@ -302,8 +327,7 @@ rule init ( mpicxx ? : options * : mpirun-with-options * )
}
else if $(.debug-configuration)
{
ECHO "Did not find Microsoft MPI in $(ms_mpi_path_native)" ;
ECHO " and/or Microsoft MPI SDK in $(ms_mpi_sdk_path_native)." ;
ECHO "Did not find Microsoft MPI and/or Microsoft MPI SDK" ;
ECHO "Did not find Microsoft Compute Cluster Pack in $(cluster_pack_path_native)." ;
}
}
Expand Down