首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >能否使用gfortran和openmpi在Linux中编译NASA并行基准(NPB)文件?

能否使用gfortran和openmpi在Linux中编译NASA并行基准(NPB)文件?
EN

Stack Overflow用户
提问于 2017-01-13 00:17:37
回答 1查看 417关注 0票数 1

我试图在我的RHEL7.3安装上运行NPB基准测试,但遇到了与这里提出的问题类似的问题。

Error while building NAS benchmarks

试图使在fortran中的BT基准测试,我得到以下错误:

代码语言:javascript
复制
cd BT; make NPROCS=16 CLASS=W SUBTYPE= VERSION=
make[1]: Entering directory '/mnt/npb_install/NPB3.3-MPI/BT'
make[2]: Entering directory '/mnt/npb_install/NPB3.3-MPI/sys'
make[2]: Nothing to be done for 'all'
make[2]: Leaving directory '/mnt/npb_install/NPB3.3-MPI/sys'
../sys/setparams bt 16 W
make[2]: Entering directory '/mnt/npb_install/NPB3.3-MPI/BT'
make[3]: Entering directory '/mnt/npb_install/NPB3.3-MPI/BT'
gfortran -O -o ../bin/bt.W.16 bt.o make_set.o initialize.o exact_solution.o exact_rhs.o set_constants.o adi.o define.o copy_faces.o rhs.o solve_subs.o x_solve.o y_solve.o z_solve.o add.o error.o verifiy.o setup_mpi.o ../common/print_results.o ../common/timers.o btio.o -L/usr/lib/openmpi-x84_64/ -lmpi
/bin/ld: cannot find -lmpi
collect2: error: ld returned 1 exit status
make[3]: *** [bt-bt] Error 1
make[3]: Leaving direc.......

然而,我使用的不是英特尔MPI,而是OpenMPI,尽管我并不完全理解这其中的含义。

我的make.def文件具有以下与mpi相关的设置

代码语言:javascript
复制
#-------------------------------------
# This is the fortran compiler usedd for MPI programs
#-----------------------------------------
MPIF77 = gfortran
# This links MPI fortran programs; usually the same as ${MPIF77}
FLINK = ${MPIF77}

#------------------------------------------
# These macros are passed to the linker to help link with MPI correctly
#-------------------------------------------
FMPI_LIB = -L/usr/lib/openmpi/lib/ -lmpi

#-----------------------------------------
# These macros are passed to the compiler to help find 'mpif.h'
#------------------------------------------
FMPI_INC = -I/usr/include/openmpi-x86_64/

类似于上述问题中的内容。

从错误中,我假设输入参数-lmpi在编译时不是gfortran的有效输入参数,但是删除它会导致屏幕上满是未定义的引用,如:

代码语言:javascript
复制
 file.f:(.text+0x123): undefined reference to 'mpi_whatever_'

可以用gfortran编译NPB吗?还是我在这里做错了什么?我已经看到使用ifort是另一种选择,但我想在采取可能的解决方案之前,我应该先问一下这个问题。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-01-13 03:38:07

在黑客攻击它之后,我用以下的修正解决了这个问题,不知道它是怎么做的。

OpenMPI可能没有正确安装(无法调用mpicc或其他包装器/comps),为了修复它,我运行了以下命令

代码语言:javascript
复制
module avail
#displayed the openmpi-x86_64 module
module add open-x86_64
which mpirun
#displayed location of mpirun

更可能的修复方法是简单地将gfortran在make.def文件中更改为mpif77

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41625406

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档