Skip to content

Commit

Permalink
try-catch to attempt to auto-detect the MPI library path on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
johnomotani committed Apr 23, 2024
1 parent a8655f2 commit 7944975
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions machines/shared/add_dependencies_to_project.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,21 @@ elseif Sys.isapple()
# path instead.
# ?? Could we attempt to auto-detect the MPI library before prompting the user??
if prompt_for_lib_paths
default_mpi_library_path = get(mk_preferences, "mpi_library_path", "")
mpi_library_path = get_input_with_path_completion(
"\nEnter the full path to your MPI library (e.g. something like "
* "'libmpi.dylib'): [$default_mpi_library_path]")
if mpi_library_path == ""
mpi_library_path = default_mpi_library_path
end
try
# See if MPIPreferences can auto-detect the system MPI library path
MPIPreferences.use_system_binary()
catch
println("Failed to auto-detect path of MPI library...")
default_mpi_library_path = get(mk_preferences, "mpi_library_path", "")
mpi_library_path = get_input_with_path_completion(
"\nEnter the full path to your MPI library (e.g. something like "
* "'libmpi.dylib'): [$default_mpi_library_path]")
if mpi_library_path == ""
mpi_library_path = default_mpi_library_path
end

MPIPreferences.use_system_binary(library_names=mpi_library_path)
MPIPreferences.use_system_binary(library_names=mpi_library_path)
end

# Just got the value for the setting, now write it to LocalPreferences.toml
mk_preferences["mpi_library_path"] = mpi_library_path
Expand Down

0 comments on commit 7944975

Please sign in to comment.