设置 G++或 Ubuntu 上 mpi.h 的 ICC
我从来没有在 VS08 之外做过任何主要的编程。
我正在尝试使用两个相关的 make 文件中的一个来编译一个名为 LAMMPS 的程序。一个称为 g++,另一个称为 icc(Intel 的编译器)。
icc 产生此错误:
icc -O -DLAMMPS_GZIP -DMPICH_SKIP_MPICXX -DFFT_FFTW -M write_restart.cpp > write_restart.d write_restart.cpp(15):灾难性错误:无法打开源文件“mpi.h” #include“mpi.h”
并且 g++ 抛出此错误
g++ -g -O -DLAMMPS_GZIP -DMPICH_SKIP_MPICXX -DFFT_FFTW -M verlet.cpp >韦尔莱特.d pointers.h:25: 致命错误: mpi.h: 没有这样的文件或目录 编译终止。
mpi.h 文件位于 /usr/lib/openmpi/include 中
据我所知,我需要设置 $PATH 变量,该变量读取
bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/opt/intel/bin:/ usr/lib/openmpi/include:
和当前读取的 $LD_LIBRARY_PATH
/usr/lib/openmpi/lib:
那么,如何包含 mpi.h 文件?那么 icc 或 g++ 可以找到它吗?
I have never done any major programing outside of VS08.
I am trying to compile a program called LAMMPS with either of the two relevant make files. One calls g++ and the other calls icc (Intel's compiler).
icc produces this error:
icc -O -DLAMMPS_GZIP -DMPICH_SKIP_MPICXX -DFFT_FFTW -M write_restart.cpp > write_restart.d
write_restart.cpp(15): catastrophic error: cannot open source file "mpi.h"
#include "mpi.h"
and g++ throws this error
g++ -g -O -DLAMMPS_GZIP -DMPICH_SKIP_MPICXX -DFFT_FFTW -M verlet.cpp > verlet.d
pointers.h:25: fatal error: mpi.h: No such file or directory
compilation terminated.
The mpi.h file is located in /usr/lib/openmpi/include
It is my understanding that I need to set that $PATH variable which reads
bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/opt/intel/bin:/usr/lib/openmpi/include:
and $LD_LIBRARY_PATH which currently reads
/usr/lib/openmpi/lib:
SO, how does one include the mpi.h file? So that either icc or g++ find it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
mpi.h 是 MPI 库的头文件。如果您在 makefile 中使用 mpic++ MPI 编译器包装器而不是 g++,则会包含该内容。 mpic++ 将调用适当的编译器。根据您的描述,您的 ubuntu 计算机上安装了 openmpi 软件包。
如需了解更多信息,您需要查阅手册,例如
http://lammps.sandia.gov /doc/Section_start.html#2_2 (对于 LAMMPS)
,也许您需要查看 openmpi 手册以了解如何设置其他编译器。不确定在 openmpi 本身构建完成后是否可以完成此操作。默认情况下,我认为在 Ubuntu 中 openmpi 编译器包装器只会调用 g++。 CMIIW。
mpi.h is a header for MPI library. That would be included if you use mpic++ MPI compiler wrapper instead of g++ in your makefile. mpic++ will call the appropriate compiler. From what you describe you have openmpi package installed on your ubuntu machine.
For more info, you need to consult the manual, e.g.
http://lammps.sandia.gov/doc/Section_start.html#2_2 (for LAMMPS)
and perhaps you need to see openmpi manual as to how to set up additional compiler. Not sure if this can be done after openmpi itself has been built. By default I think in Ubuntu openmpi compiler wrappers would only call g++. CMIIW.
好的,所以当我将 cc 设置为“mpic++.mpich2”而不是“mpic++”时,我让它与 g++ 一起工作
Okay, so I got it to work with g++ when setting up cc as "mpic++.mpich2" instead of "mpic++"
您可以尝试使用 /src/MAKE 中的 openmpi make 文件进行编译
在我的例子中, make openmpi
,这个选项是成功的
you can try compile using openmpi make file in /src/MAKE
make openmpi
in my case, this option was successful