File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -1146,8 +1146,12 @@ def _initialize_mpi_command_args(self):
1146
1146
installation_method = _infer_khiops_installation_method ()
1147
1147
# In Conda-based, but non-Conda environment, specify mpiexec path
1148
1148
if installation_method == "conda-based" :
1149
- mpiexec_path = os .environ .get ("KHIOPS_MPIEXEC_PATH" ) or os .path .join (
1150
- _infer_env_bin_dir_for_conda_based_installations (), "mpiexec"
1149
+ # Python `os.path.realpath` resolves symlinks recursively, like GNU
1150
+ # `readlink -f`; Python `os.readlink` does not
1151
+ mpiexec_path = os .environ .get ("KHIOPS_MPIEXEC_PATH" ) or os .path .realpath (
1152
+ os .path .join (
1153
+ _infer_env_bin_dir_for_conda_based_installations (), "mpiexec"
1154
+ )
1151
1155
)
1152
1156
if platform .system () == "Windows" and not os .path .splitext (mpiexec_path ):
1153
1157
mpiexec_path += ".exe"
@@ -1165,8 +1169,11 @@ def _initialize_mpi_command_args(self):
1165
1169
)
1166
1170
# In Conda or local installations, expect mpiexec in the PATH
1167
1171
else :
1168
- mpiexec_path = os .environ .get ("KHIOPS_MPIEXEC_PATH" ) or shutil .which (
1169
- "mpiexec"
1172
+ link_to_mpiexec = shutil .which ("mpiexec" )
1173
+ mpiexec_path = (
1174
+ os .environ .get ("KHIOPS_MPIEXEC_PATH" )
1175
+ or link_to_mpiexec
1176
+ and os .path .realpath (link_to_mpiexec )
1170
1177
)
1171
1178
# If mpiexec is not in the path, and the installation method is local,
1172
1179
# then try to load MPI environment module so that mpiexec is in the path
You can’t perform that action at this time.
0 commit comments