在国家超级计算中心的天河服务器上编译OpenFOAM2.1.0 - 悲催的科学匠人 - 冷水's blog
在国家超级计算中心的天河服务器上编译OpenFOAM2.1.0
OpenFOAM默认使用gcc和openmpi,但是天河上是Intel编译器和特制的mpich。
按照OpenFOAM源代码编译说明,设置好环境变量后,需要做如下修改
在$OPENFOAM/OpenFOAM-2.1.0/etc/bashrc中设置
66行: export WM_COMPILER=Icc
84行:export WM_MPLIB=MPI
关键是对MPI的具体设置,在$OPENFOAM/OpenFOAM-2.1.0/etc/config/settings.sh中找到585行左右有关对MPI的设置
486 export FOAM_MPI=mpi
487 export MPI_ARCH_PATH=/usr/local/mpi
491 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpi
然后是针对本地的mpi添加一个编译选项文件,路径是 wmake/rules/General/linux64Icc/mplibMPI,内容为
PFLAGS = -fPIC
PINC = -I/usr/local/mpi/include
PLIBS = -L/usr/local/glex/lib -L/usr/local/mpi/lib -lmpichcxx -lmpich -lopa -lpmi -lglex -lpthread -lrt -luuid -lrt
于是就ok了。只要执行 source ~/.bashrc后,环境变量就更新了,可以进行wmake了
最后在编译 src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C时会出现一点错误,只要将extern "C"{}里面的 #include "mpi.h"移到外面来就可以了。
OpenFoam十分巨大,编译要半天左右,因此可以利用其自带的并行编译功能来加速。详细的参考网站上有关
2014年4月12日 01:50
您好,请问我在天河二号下面用icc编译openfoam怎么总是在编译过程中显示无法找到库文件,类似 ld:cannot find -lfinitevolume 这样的错误,您知道怎么解决吗,还有最后您说的并行编译能具体说下如何设置吗,谢谢
2014年4月21日 19:45
@reds111: 哎呀,这么久了,我都忘记得差不多了。出现这样找不到库的直接原因要么真的没有那个库,要么是库文件搜索路径没有设置对,编译器不知道到正确的目录下去找。间接的原因是你没有按照说明书设置环境变量。并行编译见网页 http://www.openfoam.org/download/source.php
2023年12月31日 01:47
Don't miss the chance to try 러시아마사지 today!
2024年1月01日 03:45
밤의민족's massage and relaxation section is fantastic. I've discovered some amazing spa experiences through this platform.
2024年1月17日 20:31
JNANABHUMI AP provides all latest educational updates and many more. The main concept or our aim behind this website has been the will to provide resources full information on each topic which can be accessed through Internet. To ensure that every readers get’s what important and worthy about the topic they search and link to hear from us. jnanabhumiap.in Jnanabhumi AP is a startup by passionate webmasters and bloggers who have passion to provide engaging content which is accurate, interesting and worthy to read. We are mope like a web community where you can find different information’s, resources, topics on day to day incidents or news. We provide you the finest of web content on each and every topics possible with help of editorial and content team.