Supercomputing Networking Research Education Ohio Supercomputer Center Site Map Staff Directory Support
Supercomputing image

ACML - AMD Core Math Library

Introduction

The AMD Core Math Library (ACML) is a set of numerical routines tuned specifically for AMD64 platform processors (including OpteronTM and AthlonTM64 ). The routines, which are available via both FORTRAN 77 and C interfaces, include BLAS, LAPACK, FFT and RND.

Version

The version currently available at OSC is 3.6.0.

Availability

ACML is available on the Glenn Cluster and the BALE Cluster.

Usage

To use the ACML libraries type the commands below, based on the compiler you are using:

Compiler     Module Command
Portland Group Compilers module load acml-pgi
Intel Compilers module load acml-intel
GNU Compilers module load acml-gnu
  module load acml-gfortran

Use module show acml-<compiler> to view the environment varialbles set by the acml module.

Examples

In the C programming style, here is an example of the dot product of two complex vectors:


/* cdotu Example Program Text */
/*
* ACML version 1.0 Copyright AMD,NAG 2003
*/


#include <acml.h>
#include <stdio.h>


int main(void)
{
complex r;
complex x[3], y[3];
int n = 3;
int i;


printf("ACML example: dot product of two complex vectors using cdotu\n");
printf("------------------------------------------------------------\n");
printf("\n");

x[0] = compose_complex(1.0, 2.0);
x[1] = compose_complex(2.0, 1.0);
x[2] = compose_complex(1.0, 3.0);
y[0] = compose_complex(3.0, 1.0);
y[1] = compose_complex(1.0, 4.0);
y[2] = compose_complex(1.0, 2.0);

printf("Vector x: ");
for (i = 0; i < n; i++)
printf(" (%7.4f,%7.4f)\n", x[i].real, x[i].imag);
printf("Vector y: ");
for (i = 0; i < n; i++)
printf(" (%7.4f,%7.4f)\n", y[i].real, y[i].imag);

r = cdotu(n, x, 1, y, 1);

printf("r = x.y = (%12.3f,%12.3f)\n", r.real, r.imag);
return 0;
}

Using the Portland Group compiler, pgcc, the command sequence would be:
>> module load acml-pgi
>> pgcc $ACML_CFLAGS $ACML -lm -lpgftnrtl –lrt cdotu_c_example.c
>> ./a.out
ACML example: dot product of two complex vectors using cdotu
------------------------------------------------------------

Vector x: ( 1.0000, 2.0000)
(2.0000, 1.0000)
(1.0000, 3.0000)
Vector y: ( 3.0000, 1.0000)
(1.0000, 4.0000)
(1.0000, 2.0000)
r = x.y = (      -6.000,      21.000)
>> 

An example of initializing and generating random numbers, in the Fortran Programming Language:


C Simple DRANDINITIALIZE and DRANDUNIFORM example program
C .. Parameters ..
INTEGER MSTATE, MSEED, MN
PARAMETER (MSTATE=20,MSEED=10,MN=12)
C .. Local Scalars ..
DOUBLE PRECISION A, B
INTEGER GENID, I, INFO, LSEED, LSTATE, N, SUBID
C .. Local Arrays ..
DOUBLE PRECISION X(MN)
INTEGER SEED(MSEED), STATE(MSTATE)
C .. External Subroutines ..
EXTERNAL DRANDINITIALIZE, DRANDUNIFORM
C .. Executable Statements ..
CONTINUE

WRITE (*,FMT=*)
WRITE (*,FMT=99999)
* 'ACML example: DRANDINITIALIZE and DRANDUNIFORM'
WRITE (*,FMT=99999)
* '----------------------------------------------'
WRITE (*,FMT=*)

C Initialize the number of variates required
N = MN

C Use the basic generator as the base generator
GENID = 1
SUBID = 1

C Populate the SEED, basic generator needs one seed, and a
C STATE array of length 16
LSTATE = 16
LSEED = 1
SEED(1) = 122421

C Initialize the base generator
CALL DRANDINITIALIZE(GENID,SUBID,SEED,LSEED,STATE,LSTATE,INFO)

C Generate a sequence from a uniform U(0,1) distribution
A = 0.0D0
B = 1.0D0
CALL DRANDUNIFORM(N,A,B,STATE,X,INFO)

C Print the sequence
WRITE (*,FMT=99999) 'Numbers from a uniform U(0,1) distribution:'
WRITE (*,FMT=99998) X
C
99999 FORMAT (A)
99998 FORMAT (4F10.4)
END

Using the Portland Group compiler, pgf77, the command sequence would be:
>> module load acml-pgi
>> pgf77 dranduniform_example.f $ACML
>> ./a.out
ACML example: DRANDINITIALIZE and DRANDUNIFORM
----------------------------------------------

Numbers from a uniform U(0,1) distribution:
    0.6416    0.5516    0.2852    0.3752
    0.2618    0.5148    0.5048    0.6239
    0.6155    0.5263    0.4899    0.2464
>> 

Documentation

Documentation is available at: http://developer.amd.com/assets/acml_userguide.pdf