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

Exit Print View

Updated: June 2016
 
 

About Compiling

Compile with the most appropriate -xarch option for best performance. At link time, use the same -xarch option that was used at compile time to select the version of the Oracle Developer Studio Performance Library optimized for a specific instruction-set architecture.


Note -  The use of optimization options that are specific to the instruction set improves application performance on the selected instruction set architecture, but limits code portability.

For a detailed description of the different -xarch options, refer to the Oracle Developer Studio 12.5: Fortran User’s Guide or the Oracle Developer Studio 12.5: C User’s Guide.

The values for -xarch for SPARC and x86 instruction-set architectures are also listed in the man pages for fbe, cc, CC, and f95.

Compiling Code for a 64-Bit Enabled Operating Environments

To compile code for a 64-bit enabled operating environment, use -m64 and convert all integer arguments to 64-bit arguments. 64-bit routines require the use of 64-bit integers.

Oracle Developer Studio Performance Library provides 32-bit and 64-bit interfaces. To use the 64-bit interfaces:

  • Modify the Oracle Developer Studio Performance Library routine name. For C and Fortran 95 code, append _64 to the names of Oracle Developer Studio Performance Library routines (for example, rfftf_64 or CFFTB_64). For Fortran 95 code with the USE SUNPERF statement, the _64 suffix is not strictly required for specific interfaces, such as DGEMM. The _64 suffix is still required for the generic interfaces, such as GEMM.

  • Promote integers to 64 bits. Double precision variables and the real and imaginary parts of double complex variables are already 64 bits. Only the integers are promoted to 64 bits.

64-Bit Integer Arguments

These additional 64-bit-integer interfaces are available only when linking with -m64. Codes compiled for 32-bit operating environments (-m32) cannot call the 64-bit-integer interfaces.

To call the 64-bit-integer interfaces directly, append the suffix _64 to the standard library name. For example, use daxpy_64() in place of daxpy().

However, if calling the 64-bit integer interfaces indirectly, do not append _64 to the name of the Oracle Developer Studio Performance Library routine. Calls to the Performance Library routine will access a 32-bit wrapper that promotes the 32-bit integers to 64-bit integers, calls the 64-bit routine, and then demotes the 64-bit integers to 32-bit integers.

For best performance, call the routine directly by appending _64 to the routine name.

For C programs, use long instead of int arguments. The following code example shows calling the 64-bit integer interfaces directly.

#include <sunperf.h>
long n, incx, incy;
double alpha, *x, *y;
daxpy_64(n, alpha, x, incx, y, incy);

The following code example shows calling the 64-bit integer interfaces indirectly.

#include <sunperf.h>
int  n, incx, incy;
double alpha, *x, *y;
daxpy   (n, alpha, x, incx, y, incy);

For Fortran programs, use 64-bit integers for all integer arguments. The following methods can be used to convert integer arguments to 64-bits:

  • To promote all integers that are declared without explicit byte sizes and literal integer constants from 32 bits to 64 bits, compile with -xtypemap=integer:64.

  • To promote specific integer declarations, change INTEGER or INTEGER*4 to INTEGER*8.

  • To promote integer literal constants, append _8 to the constant.

Consider the following code example.

INTEGER*8 N
REAL*8 ALPHA, X(N), Y(N)

! _64 SUFFIX: N AND 1_8 ARE 64-BIT INTEGERS
CALL DAXPY_64(N,ALPHA,X,1_8,Y,1_8)

INTEGER*8 arguments cannot be used in a 32-bit environment. Routines in the 32-bit libraries, v8plusa, v8plusb, cannot be called with 64-bit arguments. However, the 64-bit routines can be called with 32-bit arguments.

When passing constants in Fortran 95 code that have not been compiled with -xtypemap, append _8 to literal constants to effect the promotion. For example, when using Fortran 95, change CALL DSCAL(20,5.26D0,X,1) to CALL DSCAL(20_8,5.26D0,X,1_8). This example assumes USE SUNPERF is included in the code, because the _64 has not been appended to the routine name.

The following code example shows calling CAXPY from Fortran 95 using 32-bit arguments.

       PROGRAM TEST
       COMPLEX ALPHA
       INTEGER,PARAMETER :: INCX=1, INCY=1, N=10
       COMPLEX X(N), Y(N)

       CALL CAXPY(N, ALPHA, X, INCX, Y, INCY) 

The following code example shows calling CAXPY from Fortran 95 (without the USE SUNPERF statement) using 64-bit arguments.

       PROGRAM TEST
       COMPLEX   ALPHA
       INTEGER*8, PARAMETER :: INCX=1, INCY=1, N=10
       COMPLEX   X(N), Y(N)

       CALL CAXPY_64(N, ALPHA, X, INCX, Y, INCY)

When using 64-bit arguments, the _64 must be appended to the routine name if the USE SUNPERF statement is not used.

The following Fortran 95 code example shows calling CAXPY using 64-bit arguments.

       PROGRAM TEST
       USE SUNPERF
       .
       .
       .
       COMPLEX   ALPHA
       INTEGER*8, PARAMETER :: INCX=1, INCY=1, N=10
       COMPLEX   X(N), Y(N)

       CALL CAXPY(N, ALPHA, X, INCX, Y, INCY)

In C routines, the size of long is 32 bits when compiling with -m32and 64 bits when compiling with -m64. The following code example shows calling the dgbcon routine using 32-bit arguments.

void dgbcon(char norm, int n, int nsub, int nsuper, double *da,
            int lda, int *ipivot, double danorm, double drcond, 
            int *info)

The following code example shows calling the dgbcon routine using 64-bit arguments.

void dgbcon_64 (char norm, long n, long nsub, long nsuper,
                  double *da, long lda, long *ipivot, double danorm,
                double *drcond, long *info)