MPI.jl icon indicating copy to clipboard operation
MPI.jl copied to clipboard

MPIPreferences + Test

Open carstenbauer opened this issue 2 years ago • 4 comments

Probably a more general/upstream issue but I'll post it here nonetheless, because this is where I encountered it. (UPDATE: https://github.com/JuliaLang/Pkg.jl/issues/3389)

In short, the issue is that ] test doesn't seem to respect the JULIA_LOAD_PATH variable and thus global preference files.

On our cluster, we provide a global Project.toml (say at /some/global/path/Project.toml) in which we set the MPI preferences, specifically

[extras]
MPIPreferences = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267"

[preferences.MPIPreferences]
_format = "1.0"
abi = "OpenMPI"
binary = "system"
libmpi = "libmpi"
mpiexec = "mpiexec"

We then automatically set JULIA_LOAD_PATH=:/some/gobal/path when the user loads the julia module. This works just fine in a regular Julia session where one gets

LOAD_PATH == ["@", "@v#.#", "@stdlib", "/some/global/path"]

However, when running ] test the JULIA_LOAD_PATH env variable is ignored and one only gets

LOAD_PATH == ["@", "/tmp/jl_KwLRNl"]

This means that the global MPI preferences are not respected, leading to undesired behavior and, in my specific case, an indefinite hang.

carstenbauer avatar Feb 23 '23 09:02 carstenbauer

Okay, so the advice should generally be that if your package uses MPI in its tests, it should have MPIPreferences in its test dependencies?

simonbyrne avatar Mar 27 '23 23:03 simonbyrne

@simonbyrne Until it's fixed upstream, yes, that's the recommendation.

carstenbauer avatar Mar 28 '23 05:03 carstenbauer

@carstenbauer : so putting the following in the project.toml of a package would work?

[targets]
test = ["Test", "MPIPreferences"]

omlins avatar Oct 12 '23 17:10 omlins

Yes, you also need:

[extras]
MPIPreferences = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267"

simonbyrne avatar Oct 12 '23 17:10 simonbyrne