Guang_han 2024-10-16 12:24 采纳率: 75%
浏览 41

使用Intel oneAPI编译器在Centos 7虚拟机上安装WRF报错

使用Intel oneAPI编译器在Centos 7虚拟机上安装WRF,
环境变量配置通过WRF官网的Test #1: Fortran + C + NetCDF和Test #2: Fortran + C + NetCDF + MPI两项测试,
但是WRF编译不成功,报错太多,
日志如下:


 make[1]: [../configure.wrf:371:../share/module_date_time.o] 错误 1 (已忽略)
rm -f ../share/module_optional_input.o
sed -e "s/^\!.*'.*//" -e "s/^ *\!.*'.*//" ../share/module_optional_input.F > ../share/module_optional_input.G
/lib/cpp -P -nostdinc -I/root/zhouy/wrf_test/WRFV4.5.2/inc -DEM_CORE=1 -DNMM_CORE=0 -DNMM_MAX_DIM=2600 -DDA_CORE=0 -DWRFPLUS=0 -DIWORDSIZE=4 -DDWORDSIZE=8 -DRWORDSIZE=4 -DLWORDSIZE=4 -DNONSTANDARD_SYSTEM_FUNC  -DWRF_USE_CLM -DUSE_NETCDF4_FEATURES -DWRFIO_NCD_LARGE_FILE_SUPPORT  -DDM_PARALLEL -DNETCDF -DHDF5 -DLANDREAD_STUB=1 -DUSE_ALLOCATABLES -Dwrfmodel -DGRIB1 -DINTIO -DKEEP_INT_AROUND -DLIMIT_ARGS -DBUILD_RRTMG_FAST=0 -DBUILD_RRTMK=0 -DBUILD_SBM_FAST=1 -DSHOW_ALL_VARS_USED=0 -DCONFIG_BUF_LEN=65536 -DMAX_DOMAINS_F=21 -DMAX_HISTORY=25 -DNMM_NEST=0  -I. -traditional-cpp -DUSE_NETCDF4_FEATURES -DWRFIO_NCD_LARGE_FILE_SUPPORT   ../share/module_optional_input.G  > ../share/module_optional_input.bb
/root/zhouy/wrf_test/WRFV4.5.2/tools/standard.exe ../share/module_optional_input.bb | /lib/cpp -P -nostdinc -traditional-cpp -DUSE_NETCDF4_FEATURES -DWRFIO_NCD_LARGE_FILE_SUPPORT > ../share/module_optional_input.f90
rm -f ../share/module_optional_input.G ../share/module_optional_input.bb
time mpiifx -f90=ifx -o ../share/module_optional_input.o -c -O3 -ip -fp-model precise -w -ftz -align all -fno-alias -FR -convert big_endian    -I../dyn_em  -I/root/zhouy/wrf_test/WRFV4.5.2/external/esmf_time_f90  -I/root/zhouy/wrf_test/WRFV4.5.2/main -I/root/zhouy/wrf_test/WRFV4.5.2/external/io_netcdf -I/root/zhouy/wrf_test/WRFV4.5.2/external/io_int -I/root/zhouy/wrf_test/WRFV4.5.2/frame -I/root/zhouy/wrf_test/WRFV4.5.2/share -I/root/zhouy/wrf_test/WRFV4.5.2/phys -I/root/zhouy/wrf_test/WRFV4.5.2/wrftladj -I/root/zhouy/wrf_test/WRFV4.5.2/chem -I/root/zhouy/wrf_test/WRFV4.5.2/inc -I/usr/local/netcdf-ifort/include  -real-size `expr 8 \* 4` -i4  ../share/module_optional_input.f90
../share/module_optional_input.f90(67): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_DOMAIN]
      USE module_domain    , ONLY : domain
----------^
../share/module_optional_input.f90(68): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_CONFIGURE]
      USE module_configure , ONLY : grid_config_rec_type
----------^
../share/module_optional_input.f90(72): error #6457: This derived type name has not been declared.   [DOMAIN]
      TYPE ( domain ) :: grid
-------------^
../share/module_optional_input.f90(73): error #6406: Conflicting attributes or multiple declaration of name.   [GRID_CONFIG_REC_TYPE]
      TYPE (grid_config_rec_type) :: config_flags
------------^
../share/module_optional_input.f90(115): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_IO_DOMAIN]
      USE module_io_domain
----------^
../share/module_optional_input.f90(116): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_CONFIGURE]
      USE module_configure       , ONLY : grid_config_rec_type
----------^
../share/module_optional_input.f90(117): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_DOMAIN]
      USE module_domain    , ONLY : domain
----------^
../share/module_optional_input.f90(121): error #6406: Conflicting attributes or multiple declaration of name.   [DOMAIN]
      TYPE ( domain ) :: grid
-------------^
../share/module_optional_input.f90(122): error #6457: This derived type name has not been declared.   [GRID_CONFIG_REC_TYPE]
      TYPE (grid_config_rec_type) :: config_flags
------------^
../share/module_optional_input.f90(267): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_IO_WRF]
      USE module_io_wrf
----------^
../share/module_optional_input.f90(271): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_IO_DOMAIN]
USE module_io_domain
----^
../share/module_optional_input.f90(268): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_DOMAIN]
      USE module_domain    , ONLY : domain
----------^
../share/module_optional_input.f90(270): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_CONFIGURE]
USE module_configure , ONLY : grid_config_rec_type
----^
../share/module_optional_input.f90(275): error #6457: This derived type name has not been declared.   [DOMAIN]
      TYPE ( domain ) :: grid
-------------^
../share/module_optional_input.f90(489): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_IO_WRF]
      USE module_io_wrf
----------^
../share/module_optional_input.f90(492): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_IO_DOMAIN]
USE module_io_domain
----^
../share/module_optional_input.f90(490): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_DOMAIN]
      USE module_domain    , ONLY : domain
----------^
../share/module_optional_input.f90(491): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_CONFIGURE]
USE module_configure , ONLY : grid_config_rec_type
----^
../share/module_optional_input.f90(496): error #6457: This derived type name has not been declared.   [DOMAIN]
      TYPE ( domain ) :: grid
-------------^
../share/module_optional_input.f90(542): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_IO_WRF]
      USE module_io_wrf
----------^
../share/module_optional_input.f90(545): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_IO_DOMAIN]
USE module_io_domain
----^
../share/module_optional_input.f90(543): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_DOMAIN]
      USE module_domain    , ONLY : domain
----------^
../share/module_optional_input.f90(544): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_CONFIGURE]
USE module_configure , ONLY : grid_config_rec_type
----^
../share/module_optional_input.f90(549): error #6457: This derived type name has not been declared.   [DOMAIN]
      TYPE ( domain ) :: grid
-------------^
../share/module_optional_input.f90(577): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_IO_WRF]
      USE module_io_wrf
----------^
../share/module_optional_input.f90(580): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_IO_DOMAIN]
USE module_io_domain
----^
../share/module_optional_input.f90(578): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_DOMAIN]
      USE module_domain    , ONLY : domain
----------^
../share/module_optional_input.f90(579): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_CONFIGURE]
USE module_configure , ONLY : grid_config_rec_type
----^
../share/module_optional_input.f90(584): error #6457: This derived type name has not been declared.   [DOMAIN]
      TYPE ( domain ) :: grid
-------------^
../share/module_optional_input.f90(703): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_IO_WRF]
      USE module_io_wrf
----------^
../share/module_optional_input.f90(1953): catastrophic error: Too many errors, exiting
compilation aborted for ../share/module_optional_input.f90 (code 1)

real    0m0.027s
user    0m0.016s
sys    0m0.011s
make[1]: [../configure.wrf:371:../share/module_optional_input.o] 错误 1 (已忽略)
rm -f tc_em.o
sed -e "s/^\!.*'.*//" -e "s/^ *\!.*'.*//" tc_em.F > tc_em.G
/lib/cpp -P -nostdinc -I/root/zhouy/wrf_test/WRFV4.5.2/inc -DEM_CORE=1 -DNMM_CORE=0 -DNMM_MAX_DIM=2600 -DDA_CORE=0 -DWRFPLUS=0 -DIWORDSIZE=4 -DDWORDSIZE=8 -DRWORDSIZE=4 -DLWORDSIZE=4 -DNONSTANDARD_SYSTEM_FUNC  -DWRF_USE_CLM -DUSE_NETCDF4_FEATURES -DWRFIO_NCD_LARGE_FILE_SUPPORT  -DDM_PARALLEL -DNETCDF -DHDF5 -DLANDREAD_STUB=1 -DUSE_ALLOCATABLES -Dwrfmodel -DGRIB1 -DINTIO -DKEEP_INT_AROUND -DLIMIT_ARGS -DBUILD_RRTMG_FAST=0 -DBUILD_RRTMK=0 -DBUILD_SBM_FAST=1 -DSHOW_ALL_VARS_USED=0 -DCONFIG_BUF_LEN=65536 -DMAX_DOMAINS_F=21 -DMAX_HISTORY=25 -DNMM_NEST=0  -I. -traditional-cpp -DUSE_NETCDF4_FEATURES -DWRFIO_NCD_LARGE_FILE_SUPPORT   tc_em.G  > tc_em.bb
/root/zhouy/wrf_test/WRFV4.5.2/tools/standard.exe tc_em.bb | /lib/cpp -P -nostdinc -traditional-cpp -DUSE_NETCDF4_FEATURES -DWRFIO_NCD_LARGE_FILE_SUPPORT > tc_em.f90
rm -f tc_em.G tc_em.bb
time mpiifx -f90=ifx -o tc_em.o -c -O3 -ip -fp-model precise -w -ftz -align all -fno-alias -FR -convert big_endian    -I../dyn_em  -I/root/zhouy/wrf_test/WRFV4.5.2/external/esmf_time_f90  -I/root/zhouy/wrf_test/WRFV4.5.2/main -I/root/zhouy/wrf_test/WRFV4.5.2/external/io_netcdf -I/root/zhouy/wrf_test/WRFV4.5.2/external/io_int -I/root/zhouy/wrf_test/WRFV4.5.2/frame -I/root/zhouy/wrf_test/WRFV4.5.2/share -I/root/zhouy/wrf_test/WRFV4.5.2/phys -I/root/zhouy/wrf_test/WRFV4.5.2/wrftladj -I/root/zhouy/wrf_test/WRFV4.5.2/chem -I/root/zhouy/wrf_test/WRFV4.5.2/inc -I/usr/local/netcdf-ifort/include  -real-size `expr 8 \* 4` -i4  tc_em.f90
tc_em.f90(4): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_MACHINE]
   USE module_machine
-------^
tc_em.f90(8): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_IO_DOMAIN]
   USE module_io_domain
-------^
tc_em.f90(10): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_DRIVER_CONSTANTS]
   USE module_driver_constants
-------^
tc_em.f90(5): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_DOMAIN]
   USE module_domain, ONLY : domain, alloc_and_configure_domain, &
-------^
tc_em.f90(9): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_INITIALIZE_REAL]
   USE module_initialize_real, ONLY : wrfu_initialize
-------^
tc_em.f90(11): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_CONFIGURE]
   USE module_configure, ONLY : grid_config_rec_type, model_config_rec, &
-------^
tc_em.f90(14): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_STATE_DESCRIPTION]
   USE module_state_description, ONLY: tconly
-------^
tc_em.f90(15): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_DM]
   USE module_dm, ONLY: wrf_dm_initialize
-------^
tc_em.f90(62): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MODULE_DOMAIN]
      USE module_domain, ONLY : domain
----------^
tc_em.f90(63): error #6406: Conflicting attributes or multiple declaration of name.   [DOMAIN]
      TYPE(domain), POINTER :: grid
-----------^
tc_em.f90(62): error #6580: Name in only-list does not exist or is not accessible.   [DOMAIN]
      USE module_domain, ONLY : domain
--------------------------------^
tc_em.f90(27): error #6457: This derived type name has not been declared.   [DOMAIN]
   TYPE(domain) , POINTER :: null_domain
--------^
tc_em.f90(28): error #6457: This derived type name has not been declared.   [DOMAIN]
   TYPE(domain) , POINTER :: grid , another_grid
--------^
tc_em.f90(29): error #6457: This derived type name has not been declared.   [DOMAIN]
   TYPE(domain) , POINTER :: grid_ptr , grid_ptr2
--------^
tc_em.f90(30): error #6457: This derived type name has not been declared.   [GRID_CONFIG_REC_TYPE]
   TYPE (grid_config_rec_type)              :: config_flags
---------^
tc_em.f90(72): error #6404: This name does not have a type, and must have an explicit type.   [PROGRAM_NAME]
   program_name = "TC_EM " // TRIM(release_version) // " PREPROCESSOR"
---^
tc_em.f90(72): error #6303: The assignment operation or the binary expression operation is invalid for the data types of the two operands.
   program_name = "TC_EM " // TRIM(release_version) // " PREPROCESSOR"
----------------------------------------------------^
tc_em.f90(86): error #6632: Keyword arguments are invalid without an explicit interface.   [DEFAULTCALKIND]
   CALL WRFU_Initialize( defaultCalKind=WRFU_CAL_GREGORIAN, rc=rc )
-------------------------^
tc_em.f90(86): error #6632: Keyword arguments are invalid without an explicit interface.   [RC]
   CALL WRFU_Initialize( defaultCalKind=WRFU_CAL_GREGORIAN, rc=rc )
------------------------------------------------------------^
tc_em.f90(124): error #6404: This name does not have a type, and must have an explicit type.   [TCONLY]
   CALL nl_set_use_wps_input ( 1 , TCONLY )
-----------------------------------^
tc_em.f90(128): error #6404: This name does not have a type, and must have an explicit type.   [NULL_DOMAIN]
   NULLIFY( null_domain )
------------^
tc_em.f90(130): error #6632: Keyword arguments are invalid without an explicit interface.   [DOMAIN_ID]
   CALL alloc_and_configure_domain ( domain_id  = 1           , &
-------------------------------------^
tc_em.f90(131): error #6632: Keyword arguments are invalid without an explicit interface.   [GRID]
                                     grid       = head_grid   , &
-------------------------------------^
tc_em.f90(131): error #6404: This name does not have a type, and must have an explicit type.   [HEAD_GRID]
                                     grid       = head_grid   , &
--------------------------------------------------^
tc_em.f90(132): error #6632: Keyword arguments are invalid without an explicit interface.   [PARENT]
                                     parent     = null_domain , &
-------------------------------------^
tc_em.f90(133): error #6632: Keyword arguments are invalid without an explicit interface.   [KID]
                                     kid        = -1            )
-------------------------------------^
tc_em.f90(135): error #6404: This name does not have a type, and must have an explicit type.   [GRID]
   grid => head_grid
---^
tc_em.f90(135): error #6796: The variable must have the TARGET attribute or be a subobject of an object with the TARGET attribute, or it must have the POINTER attribute.   [HEAD_GRID]
   grid => head_grid
-----------^
tc_em.f90(138): error #6404: This name does not have a type, and must have an explicit type.   [MODEL_CONFIG_REC]
   IF ( model_config_rec%interval_seconds .LE. 0 ) THEN
--------^
tc_em.f90(153): error #6632: Keyword arguments are invalid without an explicit interface.   [TIME_STEP_SECONDS]
                                time_step_seconds=model_config_rec%interval_seconds )
--------------------------------^
tc_em.f90(232): catastrophic error: Too many errors, exiting
compilation aborted for tc_em.f90 (code 1)

real    0m0.035s
user    0m0.023s
sys    0m0.012s



  • 写回答

1条回答 默认 最新

  • 越重天 新星创作者: Java技术领域 2024-10-16 12:36
    关注

    本答案参考 多次询问 ChatGPT-3.5 后选择的最佳回答,若是满意,还请采纳,谢谢

    1. 错误分析
      • 模块文件打开错误(#7002错误)
        • 从报错信息来看,大量的error #7002: Error in opening the compiled module file. Check INCLUDE paths.错误表明编译器在查找编译后的模块文件时遇到问题。这可能是由于编译选项中指定的包含路径(INCLUDE paths)不正确,导致编译器无法找到所需的模块文件。例如在../share/module_optional_input.f90中的USE module_domain语句,编译器找不到module_domain模块文件。
        • 可能的原因是在配置WRF编译环境时,某些环境变量设置错误,或者在编译命令中指定的包含目录没有包含所有需要的模块文件所在的目录。
      • 类型未声明错误(#6457错误)
        • error #6457: This derived type name has not been declared. [DOMAIN]这样的错误表示在使用某个派生类型(这里是DOMAIN)之前没有对其进行声明。这可能是由于包含路径问题导致类型定义的模块文件没有被正确包含,也可能是在代码结构上存在问题,例如模块的依赖关系没有正确处理。
      • 属性冲突或多重声明错误(#6406错误)
        • error #6406: Conflicting attributes or multiple declaration of name. [GRID_CONFIG_REC_TYPE]这种错误表明存在对同一个名称(这里是GRID_CONFIG_REC_TYPE)的属性冲突或者多次声明。这可能是由于头文件或模块被多次包含,并且其中对该类型的定义存在不一致的情况。
      • 其他错误
        • tc_em.f90中还存在如error #6404: This name does not have a type, and must have an explicit type.这种变量未定义类型的错误,例如program_name = "TC_EM " // TRIM(release_version) // " PREPROCESSOR"中的program_name没有定义类型就进行赋值操作。还有error #6632: Keyword arguments are invalid without an explicit interface.这种在没有明确接口的情况下使用关键字参数的错误。
    2. 解决步骤
      • 检查环境变量和包含路径
        • 重新检查WRF官网的Test #1: Fortran + C + NetCDFTest #2: Fortran + C + NetCDF + MPI测试中的环境变量设置步骤,确保所有必要的库路径(如NetCDFHDF5等相关库的路径)都正确设置。
        • 对于INCLUDE paths,检查编译命令中的-I选项指定的路径是否包含了所有WRF代码中USE语句所需要的模块文件所在的目录。例如,确保module_domain等模块文件所在的目录被包含在-I指定的路径中。
      • 检查代码结构和模块依赖关系
        • 检查WRF代码中模块的依赖关系是否正确。对于类型未声明的错误,可能需要调整模块的包含顺序或者确保模块在使用之前已经被正确编译。
        • 对于属性冲突或多重声明的错误,检查相关的头文件或模块是否被多次包含,并且保证类型定义的一致性。
      • 检查Fortran代码语法
        • 对于变量未定义类型等语法错误,仔细检查Fortran代码。例如,在tc_em.f90中为program_name定义合适的类型(如character(len = *)),并确保在使用关键字参数时对应的函数或子程序有明确的接口定义。
    评论

报告相同问题?

问题事件

  • 创建了问题 10月16日