Fortran Coder

标题: I V F中Cray pointer 怎么用 [打印本页]

作者: yllf    时间: 2016-4-8 18:47
标题: I V F中Cray pointer 怎么用
I V F中Cray pointer 怎么用,或者怎么改成可执行的?

作者: fcode    时间: 2016-4-9 08:26
也许以下帮助文档里的内容可以给你启发:

Consider the following:
[Fortran] 纯文本查看 复制代码

pointer (pb, b)
pb = getstorage()
do i = 1, n
  b(i) = a(i) + 1
enddo

By default, the compiler assumes that b and a are aliased. To prevent such an assumption, specify the -safe-cray-ptr (Linux* OS and OS X*) or /Qsafe-cray-ptr (Windows* OS) option, and the compiler will treat b(i) and a(i) as independent of each other.

However, if the variables are intended to be aliased with Cray pointers, using the option produces incorrect results. In the following example, you should not use the option:
[Fortran] 纯文本查看 复制代码

pointer (pb, b)
pb = loc(a(2))
do i=1, n
  b(i) = a(i) +1
enddo





欢迎光临 Fortran Coder (http://bbs.fcode.cn/) Powered by Discuz! X3.2