MPI + OpenACC 编译中遇到的问题



  • 最近在太湖之光做OpenAcc的优化,遇到了一些编译的问题。

    优化的地球系统模式是很多模块应该是和CESM重合的,之前的纯主核版本已经用mpicc/mpif90顺利跑起来了。

    按照openacc的手册,应该使用swacc和swafort编译 MPI+OpenACC。

    # run configure with correct arguments if necessary
      if ($runconf == 1) then
        echo "Running configure..."
        echo "for OS=$OS MACH=$MACH"
    #    $GMAKE -f $CASETOOLS/Makefile configure MODEL=mct MACFILE=$CASEROOT/Macros.$MACH
        $GMAKE -f $CASETOOLS/Makefile configure MODEL=mct MACFILE=$CASEROOT/Macros.taihulight
      endif
    

    Macros.xxx 这里其实就是改了一下 FC 和 CC

    ifeq ($(USE_MPISERIAL),TRUE)
       FC            := sw5f90
       CC            := sw5cc
     #  FC            := sw5gfortran
     #  CC            := sw5gcc
    else
       FC            := swafort #-axAVX
       CC            := swacc # -axAVX
    
    endif
    

    但是在编译到第一个mct的lib时,就出现了问题。
    出现的错误如下:

    checking whether we are cross compiling... no
    checking for suffix of executables... 
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether swacc  accepts -g... yes
    checking for swacc  option to accept ANSI C... none needed
    checking Fortran 90 filename extension... .F90
    checking whether we are using the GNU Fortran 90 compiler... yes
    checking for mpxlf90_r... no
    checking for mpxlf90... no
    checking for mpxlf95... no
    checking for mpif90... mpif90
    checking for MPI_Init... yes
    checking for mpif.h... yes
    checking how to get the version output from swafort ... -V
    checking whether byte ordering is bigendian... no
    checking whether fortran .mod file is uppercase... yes
    checking for Fortran 90 name-mangling scheme... lower case, underscore
    checking for cpp... cpp
    checking if Fortran 90 compiler performs preprocessing... no
    checking if C preprocessor can work with Fortran compiler... no
    configure: WARNING: FORTRAN SOURCE PREPROCESSING HAS FAILED
    Hostname=psn013
    Machine=x86_64
    OS=Linux
    configure: WARNING: UNKNOWN FORTRAN 90 COMPILER
    
    Output Variables: {CC=swacc } {ALLCFLAGS=-DFORTRAN_UNDERSCORE_ -DSYSLINUX -DCPRUNKNOWNCPR -O} {FPP=cpp} {FPPFLAGS=-P -C -N -traditional} {FC=swafort } {F90=swafort } {FCFLAGS=} {F90FLAGS=} {MACHDEFS=-DSYSLINUX -DCPRUNKNOWNCPR} {OPT=} {REAL8=} {BIT64=} {ENDIAN=} {MPIF90=mpif90} {MPILIBS=} {MPIHEADER=} {INCLUDEFLAG=-I} {INCLUDEPATH=-I/usr/sw-mpp/include} {AR=ar cq} {BABELROOT=} {COMPILER_ROOT=} {PYTHON=} {PYTHONOPTS=} {FORT_SIZE=} {prefix=NONE}
    
    configure: creating ./config.status
    config.status: creating Makefile.conf
    Please check the Makefile.conf
    Have a nice day!
    
    make[1]: Entering directory `/home/export/online1/para018/caohang/leap_mpi3_CAS-ESM3D_4test_200402/HSfd05/mct/mpeu'
    swacc  -c -DFORTRAN_UNDERSCORE_ -DSYSLINUX -DCPRUNKNOWNCPR -O  get_zeits.c
    make[1]: *** 没有规则可以创建“libmpeu.a”需要的目标“m_FcComms.o”。 停止。
    make[1]: Leaving directory `/home/export/online1/para018/caohang/leap_mpi3_CAS-ESM3D_4test_200402/HSfd05/mct/mpeu'
    make: *** [subdirs] 错误 2
    

    报错位置在libmpeu.a的编译处。是一个No rule to make target ***.a, needed by ***.o的问题。

    这个点我试过用mpicc和mpiswgcc都是可以过的。

    另外我还尝试mct的Macros用mpif90和mpicc, 后面用acc的编译器;但是就会出现找不到 .rmod的错误。查了一下发现用acc编译器,每个module除了会生成 .mod文件还会有一个 .rmod的相当于修改了fortran某些语句格式的代码文件。

    所以看起来这样也行不通了。不知道是否有什么解决办法或者说没有注意到的点?



  • 正常用mpif90是这样的:
    20327c5a-e183-4b74-b7f7-547581c86950-image.png



  • 串并行编译器都要用acc,不然没有rmod编译不了



  • @swmore 你好,我也遇到了用swafort编译mpi+openacc时,提示找不到netcdf.rmod,请问应该怎么解决呢?需要用swafort重新编辑netcdf吗?

    编译器和选项是:
    dc5d564c-a59d-43dc-9a6e-579aae812902-image.png
    错误:

    swafort -c -o trc.o -I/home/export/online1/systest/swsduhpc/zhou_sc/nemo/nemo-v4.0.2/cfgs/GYRE_PISCES/BLD/inc -i4 -r8 -O2 -OPT:IEEE_arith=1 -g -I/usr/sw-mpp/apps/bin/WRF/netcdf/include -I/usr/sw-mpp/apps/lib/hdf5-lib/include -c /home/export/online1/systest/swsduhpc/zhou_sc/nemo/nemo-v4.0.2/cfgs/GYRE_PISCES/BLD/ppsrc/nemo/trc.f90
    File rmodFileName = netcdf.rmod NOT FOUND (expected to be present)
    error: No declaration found for the module: netcdf
    Error : cannot find the module (module should have been seen in a previously generated file) : netcdf
    swacc_real: ../../../../edg4x-rose/src/frontend/OpenFortranParser_SAGE_Connection/FortranParserActionROSE.C:17796: void c_action_use_stmt(Token_t*, Token_t*, Token_t*, Token_t*, Token_t*, ofp_bool, ofp_bool, ofp_bool): Assertion `false' failed.
    File rmodFileName = netcdf.rmod NOT FOUND (expected to be present)
    error: No declaration found for the module: netcdf
    Error : cannot find the module (module should have been seen in a previously generated file) : netcdf
    swacc_real: ../../../../edg4x-rose/src/frontend/OpenFortranParser_SAGE_Connection/FortranParserActionROSE.C:17796: void c_action_use_stmt(Token_t*, Token_t*, Token_t*, Token_t*, Token_t*, ofp_bool, ofp_bool, ofp_bool): Assertion `false' failed.
    /usr/sw-mpp/bin//swafort: line 79: 11427 Aborted                 (core dumped) $REAL_SWACC -D__SWACC__ -D_OPENACC=20160806 -I/usr/sw-mpp/mpi2/include -fortran_support -lfortran_slave $NEW_ARG
    fcm_internal compile failed (34304)make: *** [fliocom.o] Error 1make: *** Waiting for unfinished jobs....
    /usr/sw-mpp/bin//swafort: line 79: 11428 Aborted                 (core dumped) $REAL_SWACC -D__SWACC__ -D_OPENACC=20160806 -I/usr/sw-mpp/mpi2/include -fortran_support -lfortran_slave $NEW_ARG
    fcm_internal compile failed (34304)make: *** [flincom.o] Error 1
    


  • @坚强的鞋带MPI + OpenACC 编译中遇到的问题 中说:

    需要用swafort重新编辑netcdf吗?

    聪明。。。


Log in to reply