Next: LAPACK-IEEE, Previous: LAPACK-references, Up: LAPACK
As described in Section 6.2 of the LAPACK User's Guide, block sizes and other parameters used by various LAPACK routines are returned by the LAPACK inquiry function ILAENV. In ACML, values returned by ILAENV have been chosen to achieve very good performance on a wide variety of hardware and problem sizes.
In general it is unlikely that you will want or need to be concerned with these parameters. However, in some cases it may be that a default value returned by ILAENV is not optimal for your particular hardware and problem size. Following the advice in the LAPACK User's Guide may enable you to choose a better value in some circumstances.
For convenience, ACML includes a subroutine which allows you to override default values returned by ILAENV if you have superior knowledge. The routine is named ILAENVSET and has the following specification.
— Input: INTEGER ISPEC
On input: ISPEC specifies the parameter to be set (see Section 6.2 of the LAPACK User's Guide for details).
— Input: CHARACTER* (*) NAME
On input: NAME specifies the name of the LAPACK subroutine for which the parameter is to be set.
— Input: INTEGER N1, N2, N3, N4
On input: N1, N2, N3 and N4 are problem dimensions. A value of -1 means that the dimension is unused or irrelevant.
— Input: INTEGER NVALUE
On input: NVALUE is the value to be set for the parameter specified by ISPEC. This value will be retrieved by any future call of
ILAENV
with similar arguments, including the call ofILAENV
coming directly from the routine specified by argument NAME. In most cases, but not all, the value set will apply irrespective of the values of arguments OPTS, N1, N2, N3 and N4.
All arguments of ILAENVSET
apart from the last two,
NVALUE and INFO, are identical to the arguments of ILAENV
.
ILAENVSET
should be called before you call the LAPACK
routine in question.
It should be noted that not all LAPACK routines make
use of the ILAENV
mechanism (because not all routines use
blocked algorithms or require other tuning parameters). Calls of
ILAENVSET
with argument NAME set to the name of such a routine
will fail with INFO=0. In addition, the ACML versions of some
important routines that do use blocked algorithms, such as
the QR factorization routine DGEQRF
, bypass ILAENV
because they make use of a different tuning system which is independent
of standard LAPACK. For all such routines, ILAENVSET
can still be called with no error exit, but calls will have no effect
on performance of the routine.
Below we give examples of how to call ILAENVSET
in both
FORTRAN and C.
Example (FORTRAN code):
INTEGER ILO, IHI, INFO, N, NS CHARACTER COMPZ, JOB INTEGER ILAENV EXTERNAL ILAENV, ILAENVSET JOB = 'E' COMPZ = 'I' N = 512 ILO = 1 IHI = 512 C Check the default shift parameter (ISPEC=4) used by DHSEQR NS = ILAENV(4, 'DHSEQR', JOB//COMPZ, N, ILO, IHI, -1) WRITE (*,*) 'Default NS = ', NS C Set a new value 5 for the shift parameter CALL ILAENVSET(4, 'DHSEQR', JOB//COMPZ, N, ILO, IHI, -1, 5, INFO) C Then check the shift parameter again NS = ILAENV(4, 'DHSEQR', JOB//COMPZ, N, ILO, IHI, -1) WRITE (*,*) 'Revised NS = ', NS END |
Example (C code):
#include <acml.h> #include <stdio.h> int main(void) { int n=512, ilo=1, ihi=512, ns, info; char compz = 'I', job = 'E', opts[3]; opts[0] = job; opts[1] = compz; opts[2] = '\0'; /* Check the default shift parameter (ISPEC=4) used by DHSEQR */ ns = ilaenv(4, "DHSEQR", opts, n, ilo, ihi, -1); printf("Default ns = %d\n", ns); /* Set a new value 5 for the shift parameter */ ilaenvset(4, "DHSEQR", opts, n, ilo, ihi, -1, 5, &info); /* Then check the shift parameter again */ ns = ilaenv(4, "DHSEQR", opts, n, ilo, ihi, -1); printf("Revised ns = %d\n", ns); return 0; } |