因此,我尝试使用 NAS 基准对特定 MPI 实现进行性能测试。所以我去编译fortran代码,我遇到了障碍。每当我输入此命令进行编译时:
gfortran -O0 -Wall -I/home/stephen/trunk/include -I. -c ./TestData/common/timers.f
我得到这些编译器错误:
Warning: mpif.h:2: Illegal pdreprocessor directive
Warning: mpif.h:3: Illegal preprocessor directive
Warning: mpif.h:4: Illegal preprocessor directive
Warning: mpif.h:5: Illegal preprocessor directive
Warning: mpif.h:6: Illegal preprocessor directive
Warning: mpif.h:7: Illegal preprocessor directive
Warning: mpif.h:8: Illegal preprocessor directive
Warning: mpif.h:9: Illegal preprocessor directive
Warning: mpif.h:12: Illegal preprocessor directive
Warning: mpif.h:13: Illegal preprocessor directive
Warning: mpif.h:14: Illegal preprocessor directive
Warning: mpif.h:2: Illegal preprocessor directive
Warning: mpif.h:3: Illegal preprocessor directive
Warning: mpif.h:4: Illegal preprocessor directive
Warning: mpif.h:5: Illegal preprocessor directive
Warning: mpif.h:6: Illegal preprocessor directive
Warning: mpif.h:7: Illegal preprocessor directive
Warning: mpif.h:8: Illegal preprocessor directive
Warning: mpif.h:9: Illegal preprocessor directive
Warning: mpif.h:12: Illegal preprocessor directive
Warning: mpif.h:13: Illegal preprocessor directive
Warning: mpif.h:14: Illegal preprocessor directive
mpif.h:1.1:
Included at ./TestData/common/timers.f:30:
/*
1
Error: Non-numeric character in statement label at (1)
mpif.h:1.2:
Included at ./TestData/common/timers.f:30:
/*
1
Error: Invalid character in name at (1)
mpif.h:1.1:
Included at ./TestData/common/timers.f:50:
/*
1
Error: Non-numeric character in statement label at (1)
mpif.h:1.2:
Included at ./TestData/common/timers.f:50:
/*
1
Error: Invalid character in name at (1)
make: *** [cg] Error 1
这是错误的 timers.f 代码(第 30 和 50 行是包含行):
c---------------------------------------------------------------------
c---------------------------------------------------------------------
subroutine timer_start(n)
c---------------------------------------------------------------------
c---------------------------------------------------------------------
implicit none
integer n
include 'mpif.h'
double precision start(64), elapsed(64)
common /tt/ start, elapsed
start(n) = MPI_Wtime()
return
end
c---------------------------------------------------------------------
c---------------------------------------------------------------------
subroutine timer_stop(n)
c---------------------------------------------------------------------
c---------------------------------------------------------------------
implicit none
integer n
include 'mpif.h'
double precision start(64), elapsed(64)
common /tt/ start, elapsed
double precision t, now
now = MPI_Wtime()
t = now - start(n)
elapsed(n) = elapsed(n) + t
return
end
有任何想法吗?我已经为 gfortran 尝试了各种命令行参数来尝试让它进行不同类型的预处理(我承认其中大部分都是盲目地完成的)。对我来说奇怪的是,编译器在我的代码中没有的非数字字符 /* 上出错了,所以我很迷茫。
谢谢!