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

Add mpiexecjl for windows #783

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
84 changes: 83 additions & 1 deletion test/mpiexecjl.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,88 @@
using Test, Pkg
using MPI

function my_julia_cmd(julia=joinpath(Sys.BINDIR, Base.julia_exename()); cpu_target::Union{Nothing,String} = nothing)
opts = Base.JLOptions()
if cpu_target === nothing
cpu_target = unsafe_string(opts.cpu_target)
end
image_file = unsafe_string(opts.image_file)
addflags = String[]
let compile = if opts.compile_enabled == 0
"no"
elseif opts.compile_enabled == 2
"all"
elseif opts.compile_enabled == 3
"min"
else
"" # default = "yes"
end
isempty(compile) || push!(addflags, "--compile=$compile")
end
let depwarn = if opts.depwarn == 1
"yes"
elseif opts.depwarn == 2
"error"
else
"" # default = "no"
end
isempty(depwarn) || push!(addflags, "--depwarn=$depwarn")
end
let check_bounds = if opts.check_bounds == 1
"yes" # on
elseif opts.check_bounds == 2
"no" # off
else
"" # default = "auto"
end
isempty(check_bounds) || push!(addflags, "--check-bounds=$check_bounds")
end
opts.can_inline == 0 && push!(addflags, "--inline=no")
opts.use_compiled_modules == 0 && push!(addflags, "--compiled-modules=no")
opts.opt_level == 2 || push!(addflags, "-O$(opts.opt_level)")
opts.opt_level_min == 0 || push!(addflags, "--min-optlevel=$(opts.opt_level_min)")
push!(addflags, "-g$(opts.debug_level)")
if opts.code_coverage != 0
# Forward the code-coverage flag only if applicable (if the filename is pid-dependent)
coverage_file = (opts.output_code_coverage != C_NULL) ? unsafe_string(opts.output_code_coverage) : ""
if isempty(coverage_file) || occursin("%p", coverage_file)
if opts.code_coverage == 1
push!(addflags, "--code-coverage=user")
elseif opts.code_coverage == 2
push!(addflags, "--code-coverage=all")
elseif opts.code_coverage == 3
push!(addflags, "--code-coverage=@$(unsafe_string(opts.tracked_path))")
end
isempty(coverage_file) || push!(addflags, "--code-coverage=$coverage_file")
end
end
if opts.malloc_log == 1
push!(addflags, "--track-allocation=user")
elseif opts.malloc_log == 2
push!(addflags, "--track-allocation=all")
elseif opts.malloc_log == 3
push!(addflags, "--track-allocation=@$(unsafe_string(opts.tracked_path))")
end
if opts.color == 1
push!(addflags, "--color=yes")
elseif opts.color == 2
push!(addflags, "--color=no")
end
if opts.startupfile == 2
push!(addflags, "--startup-file=no")
end
if opts.use_sysimage_native_code == 0
push!(addflags, "--sysimage-native-code=no")
end
if opts.use_pkgimages == 0
push!(addflags, "--pkgimages=no")
else
# If pkgimage is set, malloc_log and code_coverage should not
@assert opts.malloc_log == 0 && opts.code_coverage == 0
end
return `$julia -C$cpu_target --sysimage=$image_file $addflags`
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only edited this part of the Base.julia_cmd() function

end

@testset "mpiexecjl" begin
mktempdir() do dir
# Install MPI locally, so that we can test the `--project` flag to
Expand Down Expand Up @@ -30,7 +112,7 @@ using MPI
end

# `Base.julia_cmd()` ensures keeping consistent flags when running subprocesses.
julia = Base.julia_cmd()
julia = my_julia_cmd()
example = joinpath(@__DIR__, "..", "docs", "examples", "01-hello.jl")
env = ["JULIA_BINDIR" => Sys.BINDIR]
p = withenv(env...) do
Expand Down
Loading