CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Installation

[OpenFOAM.org] OpenFOAM with MPICH fatal error: mpi.h: No such file or directory

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 9, 2020, 08:23
Default OpenFOAM with MPICH fatal error: mpi.h: No such file or directory
  #1
New Member
 
Ariful Islam Pranto
Join Date: Jul 2020
Posts: 12
Rep Power: 6
Pranto is on a distinguished road
I am trying to build OpenFOAM from source with MPICH-3.3.2 but got


Code:

g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100  -I -IlnInclude -I. -I/home/pranto/OpenFOAM-dev/src/OpenFOAM/lnInclude -I/home/pranto/OpenFOAM-dev/src/OSspecific/POSIX/lnInclude   -fPIC -c PstreamGlobals.C -o /home/pranto/OpenFOAM-dev/platforms/linux64GccDPInt32OptSYSTEMMPI/src/Pstream/mpi/PstreamGlobals.o
UPstream.C:30:17: fatal error: mpi.h: No such file or directory
compilation terminated.
/home/pranto/OpenFOAM-dev/wmake/rules/General/transform:25: recipe for target '/home/pranto/OpenFOAM-dev/platforms/linux64GccDPInt32OptSYSTEMMPI/src/Pstream/mpi/UPstream.o' failed
make[4]: *** [/home/pranto/OpenFOAM-dev/platforms/linux64GccDPInt32OptSYSTEMMPI/src/Pstream/mpi/UPstream.o] Error 1
make[4]: *** Waiting for unfinished jobs....
In file included from PstreamGlobals.C:26:0:
PstreamGlobals.H:41:17: fatal error: mpi.h: No such file or directory
compilation terminated.
In file included from UIPread.C:30:0:
PstreamGlobals.H:41:17: fatal error: mpi.h: No such file or directory
compilation terminated.
Although I set

Code:
export WM_MPLIB=SYSTEMMPI
But with openmpi everything is ok.



What are the additional settings I have to consider to build OpenFOAM with MPICH-3.3.2?
Pranto is offline   Reply With Quote

Old   October 11, 2020, 08:00
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Your compilation indicates "SYSTEMMPI" but you claim to have mpich-3.3.2 installed. Where is it located?
olesen is offline   Reply With Quote

Old   October 11, 2020, 08:49
Default
  #3
New Member
 
Ariful Islam Pranto
Join Date: Jul 2020
Posts: 12
Rep Power: 6
Pranto is on a distinguished road
Basically, I want to compile OpenFOAM using my system installed MPI library which is in my case MPICH 3.3.2.


How am I supposed to tell OpenFOAM to use my system MPI library during compile?

etc/bashrc


Code:

#- MPI implementation:

#    WM_MPLIB = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPICH | MPICH-GM | HPMPI
#               | MPI | FJMPI | QSMPI | SGIMPI | INTELMPI


if [[ -z "${WM_MPLIB}" ]] then

           export WM_MPLIB=SYSTEMOPENMPIfi
export MPI_ARCH_PATH=$MPI_ROOT
Which I changed in
Code:
 export WM_MPLIB=MPICH
What are the additional things I have to consider to compile using my system installed MPI library?

Btw, I installed MPICH using the following command.
sudo apt install mpich libmpich-dev
Pranto is offline   Reply With Quote

Old   October 12, 2020, 08:48
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Pranto View Post
Basically, I want to compile OpenFOAM using my system installed MPI library which is in my case MPICH 3.3.2.

How am I supposed to tell OpenFOAM to use my system MPI library during compile?
...
What are the additional things I have to consider to compile using my system installed MPI library?

Btw, I installed MPICH using the following command.
sudo apt install mpich libmpich-dev

Configuring for different MPI versions and types is indeed quite a pain. We have some overrides for commonly used setups, but not for mpich. The file you want to examine and modify (yes, very ugly) is the etc/config.sh/mpi.


If you look for the various cases, you will see that MPI corresponds to the system mpi, stored under /opt and MPICH is a version of that is assumed to have been bundled into OpenFOAM's own ThirdParty directory.


You have something different and will need to adjust accordingly. If you devise a better of defining all of these different configs, I would be happy to adjust them.
olesen is offline   Reply With Quote

Old   October 12, 2020, 09:14
Default
  #5
New Member
 
Ariful Islam Pranto
Join Date: Jul 2020
Posts: 12
Rep Power: 6
Pranto is on a distinguished road
How am I supposed to adjust all these configs? Can you kindly help me?
Pranto is offline   Reply With Quote

Old   October 12, 2020, 12:40
Default
  #6
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Pranto View Post
How am I supposed to adjust all these configs? Can you kindly help me?

Take a look at what the other MPI things are doing (in the same file). You'll typically have to define MPI_ARCH_PATH, and make sure that the LD_LIBRARY_PATH makes sense.
olesen is offline   Reply With Quote

Old   April 13, 2021, 15:50
Default
  #7
New Member
 
Ariful Islam Pranto
Join Date: Jul 2020
Posts: 12
Rep Power: 6
Pranto is on a distinguished road
Quote:
Originally Posted by olesen View Post
Take a look at what the other MPI things are doing (in the same file). You'll typically have to define MPI_ARCH_PATH, and make sure that the LD_LIBRARY_PATH makes sense.

Sorry for the late reply here

Now I switched back to openmpi 2.2.1.

Code:
cp -r OpenFOAM-dev/etc/config.sh/example/prefs.sh OpenFOAM-dev/etc/

export WM_MPLIB=SYSTEMOPENMPI
Now I got the following error


Code:
 In file included from PstreamGlobals.H:41:0,                  

 from UIPread.C:30: /usr/lib/x86_64-linux-gnu/openmpi/include/mpi.h:330:37: error: conflicting declaration ‘typedef struct ompi_communicator_t* MPI_Comm’  typedef struct ompi_communicator_t *MPI_Comm;                                      ^~~~~~~~



Is there anything I missed here?
Pranto is offline   Reply With Quote

Old   April 20, 2021, 15:01
Default
  #8
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
With all the changes, you might have old symbols linked in. Best to wclean src/Pstream and rebuild it.
olesen is offline   Reply With Quote

Old   April 21, 2021, 09:01
Default
  #9
New Member
 
Ariful Islam Pranto
Join Date: Jul 2020
Posts: 12
Rep Power: 6
Pranto is on a distinguished road
I fixed the problem by manually installing MPICH. Just one more question, when I try to compile with system install mpich with the following env variable in etc/prefs.sh

Code:
export MPI_ROOT=/usr
export MPI_ARCH_LIBS="-L/usr/lib/x86_64-linux-gnu -lmpich"
export WM_MPLIB=SYSTEMMPI
export MPI_ARCH_FLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro"
export MPI_ARCH_INC="-I/usr/include -L/usr/lib/x86_64-linux-gnu"
I got mpi.h: no such file or directory. But With manually installing mpich and env variable
Code:
export MPI_ROOT=$HOME/MPICH
export MPI_ARCH_FLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro"
export MPI_ARCH_LIBS="-L$HOME/MPICH/lib -lmpich"
export MPI_ARCH_INC="-I$HOME/MPICH/include/ -L$HOME/MPICH/lib"
export WM_MPLIB=SYSTEMMPI
I didn't see the above error anymore. Why I got error in the first place and didn't see any error in the second place?
Pranto is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using PengRobinsonGas EoS with sprayFoam Jabo OpenFOAM Running, Solving & CFD 36 July 16, 2024 04:52
[swak4Foam] Problem installing swak_2.x for OpenFoam-2.4.0 towanda OpenFOAM Community Contributions 6 September 5, 2015 22:03
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 18:18
critical error during installation of openfoam Fabio88 OpenFOAM Installation 21 June 2, 2010 04:01
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 16:16


All times are GMT -4. The time now is 14:09.