MPI and Docker

89 views
Skip to first unread message

jack urombo

unread,
Dec 14, 2021, 3:54:42 AM12/14/21
to deal.II User Group
The current docker image is not finding mpi.h

[ 50%] Building CXX object CMakeFiles/cdr.dir/cdr.cc.o
In file included from /usr/include/deal.II/base/conditional_ostream.h:19,
                from /home/dealii/dealii/cdr/cdr.cc:1:
/usr/include/deal.II/base/config.h:490:12: fatal error: mpi.h: No such file or directory
 490 | #  include <mpi.h>
     |            ^~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/cdr.dir/build.make:63: CMakeFiles/cdr.dir/cdr.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/cdr.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
dealii@cdab72233c4c:~/dealii/cdr$

Chengjiang Yin

unread,
Dec 17, 2021, 12:44:38 AM12/17/21
to deal.II User Group
Hi Jack,

Not sure which image you are using. In dealii/dealii:master-focal, the openmpi include directory is within /usr/lib

$ ls -lh /usr/lib/x86_64-linux-gnu/openmpi/include/
total 352K
-rw-r--r-- 1 root root  597 Apr 15  2020 mpi-ext.h
-rw-r--r-- 1 root root 171K Apr 15  2020 mpi.h
-rw-r--r-- 1 root root  16K Apr 15  2020 mpi_portable_platform.h
-rw-r--r-- 1 root root 1.8K Apr 15  2020 mpif-c-constants-decl.h
-rw-r--r-- 1 root root 2.7K Apr 15  2020 mpif-config.h
-rw-r--r-- 1 root root  14K Apr 15  2020 mpif-constants.h
-rw-r--r-- 1 root root  683 Apr 15  2020 mpif-ext.h
-rw-r--r-- 1 root root 2.0K Apr 15  2020 mpif-externals.h
-rw-r--r-- 1 root root 7.9K Apr 15  2020 mpif-handles.h
-rw-r--r-- 1 root root 2.1K Apr 15  2020 mpif-io-constants.h
-rw-r--r-- 1 root root 1.2K Apr 15  2020 mpif-io-handles.h
-rw-r--r-- 1 root root 3.0K Apr 15  2020 mpif-sentinels.h
-rw-r--r-- 1 root root 104K Apr 15  2020 mpif-sizeof.h
-rw-r--r-- 1 root root 2.8K Apr 15  2020 mpif.h
drwxr-xr-x 6 root root  193 Sep  8  2020 openmpi

This should be autodetected if using cmake

$ ompi_info
                 Package: Debian OpenMPI
                Open MPI: 4.0.3
  Open MPI repo revision: v4.0.3
   Open MPI release date: Mar 03, 2020
                Open RTE: 4.0.3
  Open RTE repo revision: v4.0.3
   Open RTE release date: Mar 03, 2020
                    OPAL: 4.0.3
      OPAL repo revision: v4.0.3
       OPAL release date: Mar 03, 2020
                 MPI API: 3.1.0
            Ident string: 4.0.3
                  Prefix: /usr
 Configured architecture: x86_64-pc-linux-gnu
          Configure host: lcy01-amd64-020
           Configured by: buildd
           Configured on: Wed Apr 15 13:14:35 UTC 2020
          Configure host: lcy01-amd64-020
  Configure command line: '--build=x86_64-linux-gnu' '--prefix=/usr'
                          '--includedir=${prefix}/include'
                          '--mandir=${prefix}/share/man'
                          '--infodir=${prefix}/share/info'
                          '--sysconfdir=/etc' '--localstatedir=/var'
                          '--disable-silent-rules'
                          '--libdir=${prefix}/lib/x86_64-linux-gnu'
                          '--runstatedir=/run' '--disable-maintainer-mode'
                          '--disable-dependency-tracking'
                          '--disable-silent-rules'
                          '--disable-wrapper-runpath'
                          '--with-package-string=Debian OpenMPI'
                          '--with-verbs' '--with-libfabric' '--with-psm2'
                          '--with-jdk-dir=/usr/lib/jvm/default-java'
                          '--enable-mpi-java'
                          '--enable-opal-btl-usnic-unit-tests'
                          '--with-libevent=external'
                          '--with-pmix=/usr/lib/x86_64-linux-gnu/pmix'
                          '--disable-silent-rules' '--enable-mpi-cxx'
                          '--with-hwloc=/usr' '--with-libltdl'
                          '--with-devel-headers' '--with-slurm' '--with-sge'
                          '--without-tm' '--sysconfdir=/etc/openmpi'
                          '--libdir=${prefix}/lib/x86_64-linux-gnu/openmpi/lib'
                          '--includedir=${prefix}/lib/x86_64-linux-gnu/openmpi/include'

Better to provide more info about your container env to help diagnostic the problem.

Best,
Chengjiang Yin

Luca Heltai

unread,
Dec 31, 2021, 2:44:54 PM12/31/21
to deal.II User Group
This happened to me when I forgot to call `DEAL_II_SETUP_TARGET` from the CMakeLists.txt. Did you resolve this issue?

jack urombo

unread,
Apr 6, 2022, 12:38:57 AM4/6/22
to deal.II User Group
 I am running dealii in Docker container and because of issue to do with using filesystem under c++17 i have:
 
[  0%] Building CXX object source/CMakeFiles/rotatingMHD.dir/problem_class.cc.o
/home/dealii/rotmhd/source/problem_class.cc: In constructor ‘RMHD::Problem<dim>::Problem(const RMHD:
:RunTimeParameters::ProblemBaseParameters&)’:
/home/dealii/rotmhd/source/problem_class.cc:185:13: error: std::filesystem’ has not been declared
 185 |   if (!std::filesystem::exists(prm.graphical_output_directory) &&
     |             ^~~~~~~~~~
/home/dealii/rotmhd/source/problem_class.cc:190:12: error: std::filesystem’ has not been declared
 190 |       std::filesystem::create_directories(prm.graphical_output_directory);
     |            ^~~~~~~~~~
make[2]: *** [source/CMakeFiles/rotatingMHD.dir/build.make:206: source/CMakeFiles/rotatingMHD.dir/pr
oblem_class.cc.o] Error 1


Does the dealii Docker container support c++17?

SebG

unread,
Apr 6, 2022, 3:19:12 AM4/6/22
to deal.II User Group
Dear Jack,

this code has not yet been fully ported to deal.II-v9.3.0. I realize that I am using the dealii:v9.2.0-focal docker container in my github actions workflow. On this container, the code compiles. If you want to compile inside the dealii:v9.3.0-focal container you need to add

SET(CMAKE_CXX_STANDARD 20)

to line 13 of the main CMakeLists.txt file. This worked on my end.

Best wishes,
Sebastian
Reply all
Reply to author
Forward
0 new messages