Go to main content
Oracle® Developer Studio 12.5: Performance Library User's Guide

Exit Print View

Updated: June 2016
 
 

Fortran Interfaces

Oracle Developer Studio Performance Library contains f95 interfaces and legacy f77 interfaces for maintaining compatibility with the standard LAPACK and BLAS libraries and existing codes. Oracle Developer Studio Performance Library f95 and legacy f77 interfaces use the following conventions:

  • All arguments are passed by reference.

  • Types of arguments must be consistent within a call. For example, do not mix REAL*8 and REAL*4 parameters in the same call.

  • Arrays are stored columnwise.

  • Indices are based at one, in keeping with standard Fortran practice.

Keep in mind the following information when calling Oracle Developer Studio Performance Library routines:

  • Do not prototype the subroutines with the Fortran 95 INTERFACE statement. Use the USE SUNPERF statement instead.

  • Do not use -ext_names=plain to compile routines that call routines from Oracle Developer Studio Performance Library.

Fortran SUNPERF Module for Use With Fortran 95

Oracle Developer Studio Performance Library provides a Fortran module for additional ease-of-use features with Fortran 95 programs. To use this module, include the following line in Fortran 95 codes.

USE SUNPERF

USE statements must precede all other statements in the code, except for the PROGRAM or SUBROUTINE statement.

The SUNPERF module contains interfaces that simplify the calling sequences and provides the following features:

  • Type Independence – Oracle Developer Studio Performance Library supports interfaces where the type of the data arguments will automatically be recognized, eliminating the need for type-dependent prefixes (S, D, C, or Z). In the FORTRAN 77 routines, the type must be specified as part of the routine name. For example, DGEMM is a double precision matrix multiply and SGEMM is a single precision matrix multiply. When calling GEMM with the Fortran 95 interfaces, Fortran will infer the type from the arguments that are passed. Passing single-precision arguments to GEMM gets results that are equivalent to specifying SGEMM, and passing double-precision arguments gets results that are equivalent to DGEMM. For example, CALL DSCAL(20,5.26D0,X,1) could be changed to CALL SCAL(20, 5.26D0, X, 1).

  • Compile-Time Checking – In FORTRAN 77, it is generally impossible for the compiler to determine what arguments should be passed to a particular routine. In Fortran 95, the USE SUNPERF statement allows the compiler to determine the number, type, size, and shape of each argument to each Oracle Developer Studio Performance Library routine. It can check the calls against the expected value and display errors during compilation.

  • 64-bit Integer Support – When using the 64-bit interfaces provided with Oracle Developer Studio Performance Library, integer arguments must be promoted to 64-bits, and the routine name must be modified by appending _64 to the routine name. With the SUNPERF module, 64-bit integers will automatically be recognized, which eliminates the need for appending _64 to the routine name, as shown in the following code example:

    SUBROUTINE SUB(N,ALPHA,X,Y)
    USE SUNPERF
    INTEGER(8) N
    REAL(8) ALPHA, X(N), Y(N)
    
    ! EQUIVALENT TO DAXPY_64(N,ALPHA,X,1_8,Y,1_8)
    CALL DAXPY(N,ALPHA,X,1_8,Y,1_8)
    
    END
    

For a detailed description of using the Oracle Developer Studio Performance Library 64-bit interfaces, see Compiling Code for a 64-Bit Enabled Operating Environments.

Because the sunperf.mod file is compiled with -dalign, any code that contains the USE SUNPERF statement must be compiled with -dalign. The following error occurs if the code is not compiled with -dalign.

 use sunperf
              ^     
    "test_code.f", Line = 2, Column = 11: ERROR: Procedure "SUNPERF" and this compilation must both be compiled with -dalign, or without -dalign.