Habe jetzt libcoarrays-openmpi-dev und libcaf-openmpi-3 installiert.
Der Compilier-Versuch mittels caf scheitert:
$ caf caf01.f90
f951: Warning: Nonexistent include directory ‘/usr/lib/x86_64-linux-gnu/openmpi/lib/../../fortran/gfortran-mod-15/openmpi’ [-Wmissing-include-dirs]
/usr/bin/ld: -lmpi_usempif08 kann nicht gefunden werden: Datei oder Verzeichnis nicht gefunden
/usr/bin/ld: -lmpi_usempi_ignore_tkr kann nicht gefunden werden: Datei oder Verzeichnis nicht gefunden
/usr/bin/ld: -lmpi_mpifh kann nicht gefunden werden: Datei oder Verzeichnis nicht gefunden
/usr/bin/ld: -lmpi kann nicht gefunden werden: Datei oder Verzeichnis nicht gefunden
/usr/bin/ld: -lopen-rte kann nicht gefunden werden: Datei oder Verzeichnis nicht gefunden
/usr/bin/ld: -lopen-pal kann nicht gefunden werden: Datei oder Verzeichnis nicht gefunden
/usr/bin/ld: -lhwloc kann nicht gefunden werden: Datei oder Verzeichnis nicht gefunden
/usr/bin/ld: -levent_core kann nicht gefunden werden: Datei oder Verzeichnis nicht gefunden
/usr/bin/ld: -levent_pthreads kann nicht gefunden werden: Datei oder Verzeichnis nicht gefunden
collect2: error: ld returned 1 exit status
Error: comand:
`/usr/bin/mpif90.openmpi -I/usr/lib/x86_64-linux-gnu/fortran/ -fcoarray=lib caf01.f90 /usr/lib/x86_64-linux-gnu/open-coarrays/openmpi/lib/libcaf_openmpi.a`
failed to compile.
Allerdings funktioniert es direkt mit gfortran (und der Angabe der richtigen library):
$ gfortran -fcoarray=lib caf01.f90 -lcaf_openmpi
Die Ausführung mittels cafrun funktioniert (zumindest teilweise):
$ cafrun -n 2 a.out
Hallo Welt! (von 2 / 2)
Hallo Welt! (von 1 / 2)
Teilweise deswegen, weil ich habe 4 Cores, aber:
$ cafrun -n 3 a.out
--------------------------------------------------------------------------
There are not enough slots available in the system to satisfy the 3
slots that were requested by the application:
a.out
Either request fewer slots for your application, or make more slots
available for use.
A "slot" is the Open MPI term for an allocatable unit where we can
launch a process. The number of slots available are defined by the
environment in which Open MPI processes are run:
1. Hostfile, via "slots=N" clauses (N defaults to number of
processor cores if not provided)
2. The --host command line parameter, via a ":N" suffix on the
hostname (N defaults to 1 if not provided)
3. Resource manager (e.g., SLURM, PBS/Torque, LSF, etc.)
4. If none of a hostfile, the --host command line parameter, or an
RM is present, Open MPI defaults to the number of processor cores
In all the above cases, if you want Open MPI to default to the number
of hardware threads instead of the number of processor cores, use the
--use-hwthread-cpus option.
Alternatively, you can use the --oversubscribe option to ignore the
number of available slots when deciding the number of processes to
launch.
--------------------------------------------------------------------------
Error: Command:
`/usr/bin/mpiexec -n 3 a.out`
failed to run.
Mit der --oversubscribe-Option geht's wieder:
$ cafrun -n 3 --oversubscribe a.out
Hallo Welt! (von 1 / 3)
Hallo Welt! (von 2 / 3)
Hallo Welt! (von 3 / 3)
$ cafrun -n 5 --oversubscribe a.out
Hallo Welt! (von 1 / 5)
Hallo Welt! (von 3 / 5)
Hallo Welt! (von 4 / 5)
Hallo Welt! (von 2 / 5)
Hallo Welt! (von 5 / 5)
So weit, so gut. (Siehe auch weiter unten "Zusammenfassung")
Zum Nichtfunktionieren von caf: das Verzeichnis /usr/lib/x86_64-linux-gnu/openmpi/lib/../../fortran/gfortran-mod-15/ enthält:
-rw-r--r-- 1 root root 4,2K Jän 26 2021 opencoarrays.mod
lrwxrwxrwx 1 root root 6 Aug 17 23:16 openmpi -> mpich/
D.h. das "Nonexistent include directory ‘/usr/lib/x86_64-linux-gnu/openmpi/lib/../../fortran/gfortran-mod-15/openmpi’" ist ein Link auf .../gfortran-mod-15/mpich/, das es nicht gibt. Ev. müssten dafür die Pakete libcoarrays-mpich-dev und libcaf-mpich-3 installiert werden (probiere ich später mal).
Was wrappt caf eigentlich:
$ caf -s
/usr/bin/mpif90.openmpi -I/usr/lib/x86_64-linux-gnu/fortran/ -fcoarray=lib ${@} /usr/lib/x86_64-linux-gnu/open-coarrays/openmpi/lib/libcaf_openmpi.a
D.h. es ruft den Befehl mpif90.openmpi auf (/usr/lib/x86_64-linux-gnu/fortran/ und /usr/lib/x86_64-linux-gnu/open-coarrays/openmpi/lib/libcaf_openmpi.a sind übrigens tatsächich vorhanden), dieser wiederum ist ein Link auf:
$ dir /usr/bin/mpif90.openmpi
lrwxrwxrwx 1 root root 12 Mär 4 13:35 /usr/bin/mpif90.openmpi -> opal_wrapper
$ dir /usr/bin/opal_wrapper
-rwxr-xr-x 1 root root 27K Mär 4 13:35 /usr/bin/opal_wrapper
Bei cafrun schaut's so aus:
/usr/bin/cafrun ->
/etc/alternatives/cafrun ->
/usr/bin/cafrun.openmpi ->
/etc/alternatives/cafrun-openmpi ->
-rwxr-xr-x 1 root root 11K Jän 26 2021 /usr/lib/x86_64-linux-gnu/open-coarrays/openmpi/bin/cafrun
Es gibt auch den Befehl mpirun (der sich bei mir genauso wie cafrun verhält, d.h. bei n>2 brauche ich --oversubscribe):
/usr/bin/mpirun ->
/etc/alternatives/mpirun ->
/usr/bin/mpirun.openmpi ->
orterun
-rwxr-xr-x 1 root root 15K Mär 4 13:35 /usr/bin/orterun
bzw. mpiexec:
/usr/bin/mpiexec ->
/etc/alternatives/mpiexec ->
/usr/bin/mpiexec.openmpi ->
orterun