【发布时间】:2014-06-29 08:10:31
【问题描述】:
为了在 gfortran 中编译 MPI 代码,我必须使用语法
include mpif.h
在我的代码中而不是
use mpi
一些网站表明此语法适用于 Fortran 77,但是,我使用 gfortran gcc 版本 4.7.2 (Debian 4.7.2-5) 和 mpfi90 用于 MPICH2 版本 1.4.1p1。
命令行
mpif90 test1.f90 -o test1.exe
产生以下错误
test1.f90:4.8: use mpi 1 Fatal Error: Parse error when checking module version for file 'mpi.mod' opened at (1)
test1.f90(来自 Coursera 的 HPC 课程)
program test1
use mpi !(fails to compile)
implicit none
include 'mpif.h' !(this works)
integer :: ierr, numprocs, proc_num
call mpi_init(ierr)
call mpi_comm_size(MPI_COMM_WORLD, numprocs, ierr)
call mpi_comm_rank(MPI_COMM_WORLD, proc_num, ierr)
print *, 'Hello from Process number', proc_num, &
' of ', numprocs, ' processes'
call mpi_finalize(ierr)
end program test1
【问题讨论】:
-
它以什么方式“失败”?
-
添加更多信息,我很乐意回复否决票。
-
您是从源代码构建 MPICH2 还是从 OS 包安装?
-
命令行 mpif90 test1.f90 -o test1.exe 产生以下错误 test1.f90:4.8: use mpi 1 Fatal Error: Parse error when checks module version for file 'mpi.mod' opens在 (1) 这就是我所说的失败的意思,应该说编译失败。
-
不,您应该包含完整的错误消息。 “编译失败。”什么也没说。请编辑问题以包含该信息。
标签: fortran mpi fortran90 gfortran