linux - 是否可以使用 gfortran 和 openmpi 在 Linux 中编译 NASA Parallel Benchmarks (NPB) 文件?

标签 linux compiler-errors mpi benchmarking gfortran

我正尝试在我的 RHEL7.3 安装上运行 NPB 基准测试,但遇到了与此处提出的问题类似的问题

Error while building NAS benchmarks

尝试使用 Fortran 语言进行 BT 基准测试时,出现以下错误:

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.......

但是我没有使用 Intel MPI,而是使用 OpenMPI,尽管我不完全理解它的含义。

我的make.def文件有如下mpi相关设置

#-------------------------------------
# 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 的有效输入参数,但删除它会导致屏幕上充满 undefined reference ,例如:

 file.f:(.text+0x123): undefined reference to 'mpi_whatever_'

是否可以用 gfortran 编译 NPB?或者我显然在这里做错了什么? 我已经看到使用 ifort 是另一种选择,但我想在转向可能的解决方案之前我会问这个问题

最佳答案

在破解它之后,我通过以下修复解决了这个问题,但不确定是什么造成的。

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

module avail
#displayed the openmpi-x86_64 module
module add open-x86_64
which mpirun
#displayed location of mpirun

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

关于linux - 是否可以使用 gfortran 和 openmpi 在 Linux 中编译 NASA Parallel Benchmarks (NPB) 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41625406/

相关文章:

linux - 从 shell 脚本中的属性文件中读取数据

multithreading - 在线程构建 block 中进行调试

c++ - mpi hello world 上的 valgrind 段错误

C - 为什么我不能映射较小(256UL 或更小)的内存?

python - 如何使用 Python 成功地将从 MySQL 表中选择的行列插入到目标 MSSQL 表中?

c - 在一个文件夹中写入十亿个文件但出现 "(No space left on device)"错误

java - 变量可能尚未在 if/else if 语句中初始化

android - 在APK META-INF/maven/com.nineoldandroids/library/pom.xml中复制的重复文件

C++ 和 Project Euler #3 编译错误

c - 消息传递接口(interface),MPI_Recv() 方法