建立NAS基准测试时出错 [英] Error while building NAS benchmarks

查看:101
本文介绍了建立NAS基准测试时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Intel MPI建立NAS基准测试,下面是我正在使用的Makefile.

I am trying to build NAS benchmarks using Intel MPI and below is the makefile that I am using.

   #---------------------------------------------------------------------------
#
#                SITE- AND/OR PLATFORM-SPECIFIC DEFINITIONS. 
#
#---------------------------------------------------------------------------

#---------------------------------------------------------------------------
# Items in this file will need to be changed for each platform.
#---------------------------------------------------------------------------

#---------------------------------------------------------------------------
# Parallel Fortran:
#
# For CG, EP, FT, MG, LU, SP and BT, which are in Fortran, the following must 
# be defined:
#
# MPIF77     - Fortran compiler
# FFLAGS     - Fortran compilation arguments
# FMPI_INC   - any -I arguments required for compiling MPI/Fortran 
# FLINK      - Fortran linker
# FLINKFLAGS - Fortran linker arguments
# FMPI_LIB   - any -L and -l arguments required for linking MPI/Fortran 
# 
# compilations are done with $(MPIF77) $(FMPI_INC) $(FFLAGS) or
#                            $(MPIF77) $(FFLAGS)
# linking is done with       $(FLINK) $(FMPI_LIB) $(FLINKFLAGS)
#---------------------------------------------------------------------------

#---------------------------------------------------------------------------
# This is the fortran compiler used 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/share/apps/intel/impi/5.0.2.044/intel64/lib -lmpi


#---------------------------------------------------------------------------
# These macros are passed to the compiler to help find 'mpif.h'
#---------------------------------------------------------------------------
FMPI_INC = -I/share/apps/intel/impi/5.0.2.044/intel64/include

#---------------------------------------------------------------------------
# Global *compile time* flags for Fortran programs
#---------------------------------------------------------------------------
FFLAGS  = -O

#---------------------------------------------------------------------------
# Global *link time* flags. Flags for increasing maximum executable 
# size usually go here. 
#---------------------------------------------------------------------------
FLINKFLAGS = -O


#---------------------------------------------------------------------------
# Parallel C:
#
# For IS, which is in C, the following must be defined:
#
# MPICC      - C compiler 
# CFLAGS     - C compilation arguments
# CMPI_INC   - any -I arguments required for compiling MPI/C 
# CLINK      - C linker
# CLINKFLAGS - C linker flags
# CMPI_LIB   - any -L and -l arguments required for linking MPI/C 
#
# compilations are done with $(MPICC) $(CMPI_INC) $(CFLAGS) or
#                            $(MPICC) $(CFLAGS)
# linking is done with       $(CLINK) $(CMPI_LIB) $(CLINKFLAGS)
#---------------------------------------------------------------------------

#---------------------------------------------------------------------------
# This is the C compiler used for MPI programs
#---------------------------------------------------------------------------
MPICC = cc
# This links MPI C programs; usually the same as ${MPICC}
CLINK   = $(MPICC)

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

#---------------------------------------------------------------------------
# These macros are passed to the compiler to help find 'mpi.h'
#---------------------------------------------------------------------------
CMPI_INC = -I/usr/local/include

#---------------------------------------------------------------------------
# Global *compile time* flags for C programs
#---------------------------------------------------------------------------
CFLAGS  = -O

#---------------------------------------------------------------------------
# Global *link time* flags. Flags for increasing maximum executable 
# size usually go here. 
#---------------------------------------------------------------------------
CLINKFLAGS = -O


#---------------------------------------------------------------------------
# MPI dummy library:
#
# Uncomment if you want to use the MPI dummy library supplied by NAS instead 
# of the true message-passing library. The include file redefines several of
# the above macros. It also invokes make in subdirectory MPI_dummy. Make 
# sure that no spaces or tabs precede include.
#---------------------------------------------------------------------------
# include ../config/make.dummy


#---------------------------------------------------------------------------
# Utilities C:
#
# This is the C compiler used to compile C utilities.  Flags required by 
# this compiler go here also; typically there are few flags required; hence 
# there are no separate macros provided for such flags.
#---------------------------------------------------------------------------
CC  = cc -g


#---------------------------------------------------------------------------
# Destination of executables, relative to subdirs of the main directory. . 
#---------------------------------------------------------------------------
BINDIR  = ../bin


#---------------------------------------------------------------------------
# Some machines (e.g. Crays) have 128-bit DOUBLE PRECISION numbers, which
# is twice the precision required for the NPB suite. A compiler flag 
# (e.g. -dp) can usually be used to change DOUBLE PRECISION variables to
# 64 bits, but the MPI library may continue to send 128 bits. Short of
# recompiling MPI, the solution is to use MPI_REAL to send these 64-bit
# numbers, and MPI_COMPLEX to send their complex counterparts. Uncomment
# the following line to enable this substitution. 
# 
# NOTE: IF THE I/O BENCHMARK IS BEING BUILT, WE USE CONVERTFLAG TO
#       SPECIFIY THE FORTRAN RECORD LENGTH UNIT. IT IS A SYSTEM-SPECIFIC
#       VALUE (USUALLY 1 OR 4). UNCOMMENT THE SECOND LINE AND SUBSTITUTE
#       THE CORRECT VALUE FOR "length".
#       IF BOTH 128-BIT DOUBLE PRECISION NUMBERS AND I/O ARE TO BE ENABLED,
#       UNCOMMENT THE THIRD LINE AND SUBSTITUTE THE CORRECT VALUE FOR
#       "length"
#---------------------------------------------------------------------------
# CONVERTFLAG   = -DCONVERTDOUBLE
# CONVERTFLAG   = -DFORTRAN_REC_SIZE=length
# CONVERTFLAG   = -DCONVERTDOUBLE -DFORTRAN_REC_SIZE=length


#---------------------------------------------------------------------------
# The variable RAND controls which random number generator 
# is used. It is described in detail in README.install. 
# Use "randi8" unless there is a reason to use another one. 
# Other allowed values are "randi8_safe", "randdp" and "randdpvec"
#---------------------------------------------------------------------------
RAND   = randi8
# The following is highly reliable but may be slow:
# RAND   = randdp

当我尝试构建EP基准测试 使NPROCS = 8 EP CLASS = C 时,出现类似

When I try to build let's say EP benchmark make NPROCS=8 EP CLASS=C, I get an error like

 =========================================
   =      NAS Parallel Benchmarks 3.3      =
   =      MPI/F77/C                        =
   =========================================

cd EP; make NPROCS=8 CLASS=C
make[1]: Entering directory `/home/vaibhavs/NPB3.3/NPB3.3-MPI/EP'
make[2]: Entering directory `/home/vaibhavs/NPB3.3/NPB3.3-MPI/sys'
cc -g  -o setparams setparams.c
make[2]: Leaving directory `/home/vaibhavs/NPB3.3/NPB3.3-MPI/sys'
../sys/setparams ep 8 C
make.def modified. Rebuilding npbparams.h just in case
rm -f npbparams.h
../sys/setparams ep 8 C
gfortran -c -I/share/apps/intel/impi/5.0.2.044/intel64/include -O ep.f
gfortran -O -o ../bin/ep.C.8 ep.o ../common/print_results.o ../common/randi8.o ../common/timers.o -L/share/app                                                                               s/intel/impi/5.0.2.044/intel64/lib -lmpi
ep.o: In function `MAIN__':
ep.f:(.text+0x31): undefined reference to `mpi_init_'
ep.f:(.text+0x4b): undefined reference to `mpi_comm_rank_'
ep.f:(.text+0x65): undefined reference to `mpi_comm_size_'
ep.f:(.text+0x347): undefined reference to `mpi_abort_'
ep.f:(.text+0x3df): undefined reference to `mpi_barrier_'
ep.f:(.text+0x803): undefined reference to `mpi_allreduce_'
ep.f:(.text+0x842): undefined reference to `mpi_allreduce_'
ep.f:(.text+0x879): undefined reference to `mpi_allreduce_'
ep.f:(.text+0x935): undefined reference to `mpi_allreduce_'
ep.f:(.text+0xc70): undefined reference to `mpi_finalize_'
../common/timers.o: In function `timer_stop_':
timers.f:(.text+0x27): undefined reference to `mpi_wtime_'
../common/timers.o: In function `timer_start_':
timers.f:(.text+0x57): undefined reference to `mpi_wtime_'
collect2: ld returned 1 exit status
make[1]: *** [../bin/ep.C.8] Error 1
make[1]: Leaving directory `/home/vaibhavs/NPB3.3/NPB3.3-MPI/EP'
make: *** [ep] Error 2

有人可以帮助我解决这个问题吗?

Can anybody please help me in resolving this issue?

谢谢

推荐答案

如果您的MPI库是Intel MPI,并且是由intel fortran编译器构建的,那么当您尝试构建MPI应用程序时,您会感到很伤心使用gfortran.

If your MPI library is Intel MPI, and was built by the intel fortran compiler, then you're going to be sad when you try to build your MPI application with gfortran.

很长一段时间以来,一直没有从C调用fortran符号的标准方法.某些编译器在符号上加一个,两个或零下划线.

For a long time there was no standard way to call fortran symbols from C. Some compilers put one, two, or zero underscores on the symbol.

您应该使用ifort构建NAS

You should build NAS with ifort

您可以 可以使用-fno-underscoring选项使事情正常运行,但是请认真留意gfortran手册页中的以下消息:

You might be able to make things work with the -fno-underscoring option , but heed well this message from the gfortran man page:

请注意,仅仅因为名称匹配并不意味着接口 由GNU Fortran实现的外部名称与接口匹配 由其他语言针对相同的名称实现.也就是说, GNU Fortran生成的代码链接到其他一些编译器生成的代码 使用此方法或任何其他方法仅占整体的一小部分 解决方案---使两个编译器生成的代码在问题上达成共识 除了命名以外,还需要花费大量精力,而且与命名不同 分歧,链接器通常无法检测到其他分歧 区域.

Note that just because the names match does not mean that the interface implemented by GNU Fortran for an external name matches the interface implemented by some other language for that same name. That is, getting code produced by GNU Fortran to link to code produced by some other compiler using this or any other method can be only a small part of the overall solution---getting the code generated by both compilers to agree on issues other than naming can require significant effort, and, unlike naming disagreements, linkers normally cannot detect disagreements in these other areas.

这篇关于建立NAS基准测试时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆