2013-03-14 110 views
0

我试图在远程超级计算机上运行一个程序,该程序在我的笔记本上运行良好。但该程序不在那里编译。试图追踪这个问题,我将程序降低到最低程度,但仍然给我一个编译错误。任何人有任何想法可能在这里出错?Fortran:CHARACTER声明中的语法错误

[[email protected] python_utilities]$cat test.f90 
program test 
character(:), allocatable :: out 
end program test 
[[email protected] python_utilities]$gfortran test.f90 
In file test.f90:3 

character(:), allocatable :: out 
     1 
Error: Syntax error in CHARACTER declaration at (1) 

我猜gfortran运行正常,当我这样做时,它的工作原理:

[[email protected] python_utilities]$cat test.f90 
program test 
print *, "Hello World!" 
end program test 
[[email protected] python_utilities]$gfortran test.f90 
[[email protected] python_utilities]$./a.out 
Hello World! 

在超级计算机编译器是:

[[email protected] 256]$gfortran --version 
GNU Fortran (GCC) 4.1.2 20080704 (Red Hat 4.1.2-51) 
Copyright (C) 2007 Free Software Foundation, Inc. 

回答

0

character(:), allocatable :: out正在申报的可分配定标器。这是Fortran 2003的一项新功能。超级计算机上的编译器可能不支持此新功能。

你意味着你正在使用gfortran。 http://gcc.gnu.org/wiki/GFortran列出了在gfortran 4.5版中添加的可分配缩放器(参见4.5/Fortran 2003)。目前的发行版本是4.7。

+0

我看,超级计算机上的编译器确实老了。它是:[k00603 @ fe01p08 256] $ gfortran --version GNU Fortran(GCC)4.1.2 20080704(Red Hat 4.1.2-51) 版权所有(C)2007自由软件基金会,Inc. – jhaprade 2013-03-14 06:33:54

+0

您应该得到SysAdmin升级。 gfortran 4.1版已经过时并且有错误。 4.3之前我不会使用任何版本。原则上你可以在你的用户区安装编译器,但这并不容易。 – 2013-03-14 07:16:47

1

CHARACTER(:)...是一个Fortran 2003功能,称为延迟长度字符。它最近才被添加到gfortran中,并且在某些区域的支持(延期长度字符组件)仍然不完整。

您的超级计算机可能运行的是旧版本的编译器,它缺少对此功能的支持。

+0

是否可以在我的用户帐户中安装gfortran的本地最新版本而不会破坏超级计算机的系统管理员? – jhaprade 2013-03-14 06:37:44

+0

也许。我在这里有我的用户帐户从源代码构建的gfortran的六个版本。 – IanH 2013-03-14 08:33:02