Tech Tip: Getting the best performance from your NAG Library

With so many Fortran and SMP Library implementations now in the field, some users are asking about the alternative libraries provided.

Very often NAG provides at least two alternative libraries; one might feature ‘nag’ in the name and the other ‘acml’ or ‘mkl’. The appropriate Users' Note goes into greater and more specific detail, but the general concept is simple.

These alternative libraries contain specific and optimized implementations of the BLAS and LAPACK. For example, “acml” is optimized for use with processors from AMD, and “mkl” with those of Intel. Because they are associated with a specific processor or system vendor, they are often referred to as “performance” or “vendor” libraries. If such a library is provided by NAG, and you have the appropriate computing environment for it (as described in the Users' Note), in general we would recommend this as the appropriate library to choose for normal working. With such a library, if a user calls the BLAS DGETRF for example, then the ACML, MKL or other vendor BLAS (if present) will be called directly. If the user calls instead F07ADF, then this routine, internally, makes calls to BLAS routines such as DGEMM which reside in the performance libraries.

If, however, a performance library alternate is not available or the user elects to use a ‘pure’ nag library, then no optimized BLAS or LAPACK routines are called. Instead high level NAG code is used. The NAG versions are present to prove correctness of operation and are not designed, written or specially optimized (above the standard options described in the Installer's Note) for performance. This second library is therefore ‘steady and reliable’, rather than ‘fast and efficient’, but as we have tested the latter just as thoroughly as the former, the optimized “performance” library is the appropriate first choice if available, with the NAG-provided code as a slower but reliable alternative in case it is not.

For specific technical advice in using NAG's products, please contact our technical experts.

Return to Technical Tips & Hints index page.