-
Notifications
You must be signed in to change notification settings - Fork 1
/
mpiexecjl
executable file
·69 lines (64 loc) · 1.9 KB
/
mpiexecjl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
#
# Copyright (C) 2020 Simon Byrne, Mosè Giordano
# License is MIT "Expat"
#
### Commentary:
#
# Command line utility to call the `mpiexec` binary used by the `MPI.jl` version
# in the given Julia project. It has the same syntax as the `mpiexec` binary
# that would be called, with the additional `--project=...` flag to select a
# different Julia project.
#
# Examples of usage (the MPI flags available depend on the MPI implementation
# called):
#
# $ mpiexecjl --version
# $ mpiexecjl -n 40 julia mpi-script.jl
# $ mpiexecjl --project=my_experiment -n 80 --oversubscribe julia mpi-script.jl
#
### Code:
usage () {
echo "Usage: ${0} [--project=...] MPIEXEC_ARGUMENTS..."
echo "Call the mpiexec binary in the Julia environment specified by the --project option."
echo "If no project is specified, the MPI associated with the global Julia environment will be used."
echo "All other arguments are forwarded to mpiexec."
}
for arg; do
shift
case "${arg}" in
--project | --project=*)
PROJECT_ARG="${arg}"
;;
-h | --help)
usage
echo "Below is the help of the current mpiexec."
echo
set -- "${@}" "${arg}"
;;
*)
set -- "${@}" "${arg}"
;;
esac
done
if [ -z "${*}" ]; then
echo "ERROR: no arguments specified." 1>&2
echo
usage
exit 1
fi
# shellcheck disable=SC2016
SCRIPT='
using MPI
ENV["JULIA_PROJECT"] = dirname(Base.active_project())
MPI._mpiexec(exe -> run(`$exe $ARGS`), adjust_LIBPATH=false)'
if [ -n "${JULIA_BINDIR}" ]; then
JULIA_CMD="${JULIA_BINDIR}/julia"
else
JULIA_CMD="julia"
fi
if [ -n "${PROJECT_ARG}" ]; then
"${JULIA_CMD}" "${PROJECT_ARG}" --color=yes --startup-file=no -q --compile=min -O0 -e "${SCRIPT}" -- "${@}"
else
"${JULIA_CMD}" --color=yes --startup-file=no -q --compile=min -O0 -e "${SCRIPT}" -- "${@}"
fi