Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
E77790.pdf
Скачиваний:
2
Добавлен:
16.05.2024
Размер:
1.29 Mб
Скачать

2.4 Library Interfaces and system.inc

integer, pointer :: p(:), q(:) !DIR$ IVDEP

do i = 1, n p(i) = q(i) a(i) = a(i-1)

end do

The assumed dependences between p(i) and q(i) and between p(i) and a(*) are ignored, but the obvious dependences between a(i) and a(i-1) are not. The loop can be divided into two loops and the resulting p(i) = q(i) loop can be microvectorized.

The IVDEP directive applies to the immediately following DO loop. No other code is allowed between the directive and the loop. !DIR$ IVDEP can also be applied to an array assignment, FORALL, or WHERE construct. If multiple directives are present for a particular loop (such as IVDEP and UNROLL), the compiler will obey all of them, if possible.

2.4Library Interfaces and system.inc

The Fortran compiler provides an include file, system.inc, that defines the interfaces for most non-intrinsic library routines. Declare this include file to insure that functions you call and their arguments are properly typed, especially when default data types are changed with -xtypemap.

For example, the following may produce an arithmetic exception because function getpid() is not explicitly typed:

integer(4) mypid mypid = getpid() print *, mypid

The getpid() routine returns an integer value but the compiler assumes it returns a real value if no explicit type is declared for the function. This value is further converted to integer, most likely producing a floating-point error.

To correct this you should explicitly type getuid() and functions like it that you call:

integer(4) mypid, getpid mypid = getpid()

print *, mypid

include ’system.inc’ integer(4) mypid mypid = getpid()

38 Oracle Developer Studio 12.6: Fortran User's Guide • July 2017

Соседние файлы в предмете Информационные и сетевые технологии