Skip to content
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
15 changes: 14 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ jobs:
ranks:
- 2
- 4
include:
# Instrument one existing cell; the other nine keep their normal cost.
- version: '1'
ranks: 2
coverage: true
steps:
- uses: actions/checkout@v7
- uses: julia-actions/setup-julia@v3
Expand All @@ -463,7 +468,15 @@ jobs:
- name: Instantiate CPU MPI environment
run: julia --project=test/mpi/env -e 'using Pkg; Pkg.develop([PackageSpec(path=pwd()), PackageSpec(path="lib/TimespanLogging")]); Pkg.instantiate()'
- name: Run CPU MPI tests
run: julia --project=test/mpi/env test/mpi/run.jl ${{ matrix.ranks }} 2 test/mpi/cpu.jl
run: julia ${{ matrix.coverage && '--code-coverage=user' || '' }} --project=test/mpi/env test/mpi/run.jl ${{ matrix.ranks }} 2 test/mpi/cpu.jl
- uses: julia-actions/julia-processcoverage@v1
if: matrix.coverage
- uses: codecov/codecov-action@v7
if: matrix.coverage
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false

mpi-opencl:
# OpenCL runs against a CPU-backed ICD (no physical GPU required), unlike
Expand Down
6 changes: 6 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1247,3 +1247,9 @@ this section verbatim). Each entry is one bullet starting with `- `.
bare `julia` through `PATH`, so select the driver's executable directory
around its calls before choosing version-dependent flags. Check actual
Distributed worker versions rather than assuming a remote path matches.

112. **Enable coverage in MPI ranks, not only in their launcher.** Selecting
`Base.julia_cmd().exec[1]` keeps the executable but drops coverage options.
A launcher can therefore be instrumented while the extension exercised by
every rank reports zero hits. Forward the enabled mode/path and merge the
PID-qualified rank reports.
16 changes: 15 additions & 1 deletion test/mpi/run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,23 @@ script = ARGS[3]
extra = ARGS[4:end]
project = Base.active_project()
juliabin = Base.julia_cmd().exec[1]
# Base.julia_cmd().exec[1] selects only the executable. Preserve enabled
# instrumentation explicitly so ranks emit coverage too. Each rank uses
# Julia's default PID-qualified .cov files, which the coverage action merges.
options = Base.JLOptions()
coverage_args = if options.code_coverage == 1
["--code-coverage=user"]
elseif options.code_coverage == 2
["--code-coverage=all"]
elseif options.code_coverage == 3
["--code-coverage=@$(unsafe_string(options.tracked_path))"]
else
String[]
end


MPI.mpiexec() do mpiexec
cmd = `$mpiexec -n $nranks $juliabin --project=$project --threads=$threads $script $extra`
cmd = `$mpiexec -n $nranks $juliabin $coverage_args --project=$project --threads=$threads $script $extra`
@info "Launching MPI job" nranks threads script
proc = run(ignorestatus(cmd))
exit(proc.exitcode)
Expand Down
Loading