-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for Cray MPI GPU-aware Co-authored-by: Simon Byrne <[email protected]> Co-authored-by: Valentin Churavy <[email protected]>
- Loading branch information
1 parent
abebf65
commit fd2c626
Showing
9 changed files
with
213 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
module CrayParser | ||
|
||
filter(f::Function)::Function = Base.Fix1(Base.filter, f) | ||
map(f::Function)::Function = Base.Fix1(Base.map, f) | ||
reduce(f::Function)::Function = Base.Fix1(Base.reduce, f) | ||
|
||
struct CrayPE | ||
libmpi::String | ||
libgtl::String | ||
cclibs::Vector{String} | ||
gtl_env_switch::String | ||
|
||
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" | ||
) | ||
end | ||
|
||
const libmpi_prefix = "mpi_" | ||
const libgtl_prefix = "mpi_gtl_" | ||
|
||
function cray_mpi(libs) | ||
x = libs |> | ||
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, libgtl_prefix)) | ||
return only(x) | ||
end | ||
|
||
function other_libs(libs) | ||
x = libs |> | ||
filter(x->!startswith(x, libmpi_prefix)) |> | ||
filter(x->!startswith(x, libgtl_prefix)) | ||
return x | ||
end | ||
|
||
function analyze_cray_cc() | ||
cray_opts = readchomp(Cmd(["cc", "--cray-print-opts=all"])) | ||
|
||
ld_paths = SubString{String}[] | ||
libs = SubString{String}[] | ||
for opt in split(cray_opts, " ") |> | ||
map(x->split(x, ",")) |> | ||
reduce(vcat) |> | ||
map(x->replace(x, "\n"=>"")) | ||
if startswith(opt, "-L") | ||
push!(ld_paths, @view opt[3:end]) | ||
end | ||
|
||
if startswith(opt, "-l") | ||
push!(libs, @view opt[3:end]) | ||
end | ||
end | ||
|
||
CrayPE(cray_mpi(libs), cray_gtl(libs), other_libs(libs)) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module Preloads | ||
|
||
any(f::Function)::Function = Base.Fix1(Base.any, f) | ||
|
||
using Preferences, Libdl | ||
|
||
const preloads = @load_preference("preloads") | ||
const preloads_env_switch = @load_preference("preloads_env_switch") | ||
|
||
|
||
function is_loaded(name) | ||
if dllist() |> any(x->endswith(x, name)) | ||
return true | ||
end | ||
return false | ||
end | ||
|
||
""" | ||
dlopen_preloads() | ||
|
||
dlopen's all preloads specified in the preloads section of MPIPreferences | ||
""" | ||
function dlopen_preloads() | ||
if !isnothing(preloads) | ||
if isnothing(preloads_env_switch) || get(ENV, preloads_env_switch, "0") == "1" | ||
for preload in preloads | ||
if is_loaded(preload) | ||
continue | ||
end | ||
|
||
try | ||
dlopen(preload, RTLD_LAZY | RTLD_GLOBAL) | ||
catch error | ||
@error """ | ||
$(preload) could not be loaded, see error message below. | ||
Use `MPIPreferences` to reconfigure the package and then restart Julia. | ||
""" error | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fd2c626
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register subdir=lib/MPIPreferences
fd2c626
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/88246
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:
fd2c626
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
fd2c626
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error while trying to register: "Tag with name
v0.20.12
already exists and points to a different commit"