Reputation: 61
System:
Ubuntu 22.04.1 LTS (Jammy Jellyfish) 64-bit
Kernel Linux 5.15.0-46-generic x86_64
MATE 1.26.0
Installed packages:
gfortran --> gfortran-11
libgfortran-11-dev
libcaf-mpich-3
libcaf-openmpi-3
libcoarrays-dev
libcoarrays-mpich-dev
libcoarrays-openmpi-dev
Trying to compile a CoArrayFortran program via caf caf01.f90
results in the error
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: -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.
There is a directory /usr/lib/x86_64-linux-gnu/openmpi/lib/../../fortran/gfortran-mod-15/mpich/
, maybe this can be used instead, but how to tell the compiler?
Edit1:
$ LANG="C" 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: cannot find -lmpi_usempif08: No such file or directory
/usr/bin/ld: cannot find -lmpi_usempi_ignore_tkr: No such file or directory
/usr/bin/ld: cannot find -lmpi_mpifh: No such file or directory
/usr/bin/ld: cannot find -lopen-rte: No such file or directory
/usr/bin/ld: cannot find -lopen-pal: No such file or directory
/usr/bin/ld: cannot find -lhwloc: No such file or directory
/usr/bin/ld: cannot find -levent_core: No such file or directory
/usr/bin/ld: cannot find -levent_pthreads: No such file or directory
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.
The compile-command is caf
: /usr/bin/caf -> /etc/alternatives/caf -> /usr/bin/caf.openmpi -> /etc/alternatives/caf-openmpi -> /usr/lib/x86_64-linux-gnu/open-coarrays/openmpi/bin/caf. In this last file there are the lines
# Always make extensions module available, user can choose whether to `use` it or not
caf_pre_flags=("${mod_dir_flag}/usr/lib/x86_64-linux-gnu/fortran/")
but no line including gfortran-mod-15
.
Edit2:
I made a (symbolic) link
/usr/lib/x86_64-linux-gnu/openmpi/lib/../../fortran/gfortran-mod-15/openmpi/
->
/usr/lib/x86_64-linux-gnu/openmpi/lib/../../fortran/gfortran-mod-15/mpich/
.
The warning about the nonexistent include directory is gone, but the other errors remain:
LANG="C" caf caf01.f90
/usr/bin/ld: cannot find -lmpi_usempif08: No such file or directory
/usr/bin/ld: cannot find -lmpi_usempi_ignore_tkr: No such file or directory
/usr/bin/ld: cannot find -lmpi_mpifh: No such file or directory
/usr/bin/ld: cannot find -lopen-rte: No such file or directory
/usr/bin/ld: cannot find -lopen-pal: No such file or directory
/usr/bin/ld: cannot find -lhwloc: No such file or directory
/usr/bin/ld: cannot find -levent_core: No such file or directory
/usr/bin/ld: cannot find -levent_pthreads: No such file or directory
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.
Upvotes: 0
Views: 1292
Reputation: 61
Summing up "Using CoArrays with gfortran at Ubuntu 22.04" worked for me like this:
Installing the packages:
sudo apt-get install gfortran libcoarrays-dev libcoarrays-openmpi-dev libcaf-openmpi-3
Compiling:
gfortran -fcoarray=lib coarray-fortran-program.f90 -lcaf_openmpi
Running:
cafrun -n 3 a.out
(-n 3 = Number of Images) or with option
cafrun -n 3 --oversubscribe a.out
(if there is an error without this option). cafrun might be replaced with mpirun or mpiexec.
Upvotes: 0