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

deal with vendor=cray but no gtl #785

Merged
merged 3 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/MPIPreferences/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MPIPreferences"
uuid = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267"
authors = []
version = "0.1.9"
version = "0.1.10"

[deps]
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Expand Down
7 changes: 5 additions & 2 deletions lib/MPIPreferences/src/MPIPreferences.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,14 @@ function use_system_binary(;
preloads = []
preloads_env_switch = nothing
cclibs = []
if vendor === nothing
if isnothing(vendor)
elseif vendor == "cray"
cray_pe = CrayParser.analyze_cray_cc()
library_names = [cray_pe.libmpi]
preloads = [cray_pe.libgtl]
# if there is no preload, then set preloads to "nothing" instead of
# "[nothing]" -- the later of which would cause an error when trying to
# dump as toml
preloads = isnothing(cray_pe.libgtl) ? nothing : [cray_pe.libgtl]
preloads_env_switch = cray_pe.gtl_env_switch
cclibs = cray_pe.cclibs
else
Expand Down
35 changes: 28 additions & 7 deletions lib/MPIPreferences/src/parse_cray_cc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,59 @@ reduce(f::Function)::Function = Base.Fix1(Base.reduce, f)

struct CrayPE
libmpi::String
libgtl::String
libgtl::Union{String, Nothing}
cclibs::Vector{String}
gtl_env_switch::String

CrayPE(mpi_dl::T, gtl_dl::T, cclibs::Vector{T}) where T <:AbstractString = new(

CrayPE(
mpi_dl::T,
gtl_dl::T,
cclibs::Vector{T}
) where T <:AbstractString = new(
"lib" * mpi_dl * ".so", # Assuming Linux -- CrayPE is only avaialbe for linux anyway
"lib" * gtl_dl * ".so",
cclibs,
"MPICH_GPU_SUPPORT_ENABLED"
)
CrayPE(
mpi_dl::T,
gtl_dl::Nothing,
cclibs::Vector{T}
) where T <:AbstractString = new(
"lib" * mpi_dl * ".so", # Assuming Linux -- CrayPE is only avaialbe for linux anyway
nothing,
cclibs,
"MPICH_GPU_SUPPORT_ENABLED"
)
end

const libmpi_prefix = "mpi_"
const libgtl_prefix = "mpi_gtl_"

function only_or_nothing(iter)
if length(iter) == 0
return nothing
end
only(iter)
end

function cray_mpi(libs)
x = libs |>
filter(x-> startswith(x, libmpi_prefix)) |>
filter(x-> startswith(x, libmpi_prefix)) |>
filter(x->!startswith(x, libgtl_prefix))
return only(x)
end

function cray_gtl(libs)
x = libs |>
filter(x->startswith(x, libmpi_prefix)) |>
filter(x->startswith(x, libmpi_prefix)) |>
filter(x->startswith(x, libgtl_prefix))
return only(x)
return only_or_nothing(x)
end

function other_libs(libs)
x = libs |>
filter(x->!startswith(x, libmpi_prefix)) |>
filter(x->!startswith(x, libmpi_prefix)) |>
filter(x->!startswith(x, libgtl_prefix))
return x
end
Expand Down
Loading