【问题标题】:File ‘mpi.mod’ opened at (1) is not a GNU Fortran module file在 (1) 处打开的文件‘mpi.mod’不是 GNU Fortran 模块文件
【发布时间】:2016-12-05 18:17:35
【问题描述】:

我正在尝试编译 RegCM4.5,我的配置看起来没有错误,但在编译时(通过 make 命令)我收到此错误

File ‘mpi.mod’ opened at (1) is not a GNU Fortran module file

我已经通过dnf install 包管理器安装了mpich。我该如何解决这个问题?

【问题讨论】:

  • 欢迎来到 Stack Overflow。 Read here 了解有关如何创建最小、完整和可验证问题的更多信息。
  • @Toby 一个 MCVE 很可能只是 use mpi; end
  • 您是否安装了其他 Fortran 编译器?你知道使用哪个编译器编译 MPICH 吗?你能试着编译一个只包含use mpi 的程序吗?
  • 亲爱的弗拉德米尔感谢您的关注。我不知道 MPICH 使用哪个编译器!我怎么知道?我没有明白你所说的使用 mpi 的意思!你能给我更多的指导吗?
  • 试试我要求的程序。

标签: fortran mpi gfortran mpich


【解决方案1】:

我最近遇到了这个问题。问题是我有不同版本的 gfortran 编译器,而 openmpi 没有指向正确的版本。用于编译我的程序的那个。所以使用use mpi 语句会导致该错误。键入以下命令将指示当前安装了哪些 Fortran 编译器:

dpkg -l | grep Fortran

我的输出是

ii  gfortran                                    4:5.3.1-1ubuntu1                              amd64        GNU Fortran 95 compiler
ii  gfortran-4.8                                4.8.5-4ubuntu2                                amd64        GNU Fortran compiler
ii  gfortran-5                                  5.4.1-2ubuntu1~16.04                          amd64        GNU Fortran compiler
ii  libgfortran-4.8-dev:amd64                   4.8.5-4ubuntu2                                amd64        Runtime library for GNU Fortran applications (development files)
ii  libgfortran-5-dev:amd64                     5.4.1-2ubuntu1~16.04                          amd64        Runtime library for GNU Fortran applications (development files)
ii  libgfortran3:amd64                          6.2.0-3ubuntu11~16.04                         amd64        Runtime library for GNU Fortran applications

您可以通过导出您实际使用的 fortran 编译器来解决此问题。就我而言,它是 gfortran-4.8,所以我只需输入

export FC=gfortran-4.8

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-20
    • 1970-01-01
    • 1970-01-01
    • 2017-03-11
    • 2023-03-09
    • 2021-12-02
    • 2011-11-28
    相关资源
    最近更新 更多