NAG Library, Mark 30.2, Multithreaded
NSW6I302EL - Licence Managed
Microsoft Windows x64, 64-bit, Intel Classic C/C++ or Microsoft C/C++ or Intel Classic Fortran, 32-bit integers, VS2019
Users' Note

1 Introduction

This document is essential reading for every user of the NAG Library implementation specified in the title. It provides implementation-specific detail that augments the information provided in the NAG Mark 30.2 Library Manual (which we will refer to as the Library Manual). Wherever that manual refers to the "Users' Note for your implementation", you should consult this note.
In addition, NAG recommends that before calling any Library routine you should read the following reference material from the Library Manual (see Section 5):
  1. (a)How to Use the NAG Library
  2. (b)Chapter Introduction
  3. (c)Routine Document

2 Supplementary Information

Please check the following URL:
https://support.nag.com/doc/inun/ns30/w6i2el/supplementary.html
for details of any new information related to the applicability or usage of this implementation.

3 General Information

This implementation of the NAG Library provides static and shareable libraries that use the Intel ® Math Kernel Library for Windows (MKL), a third-party vendor performance library, to provide Basic Linear Algebra Subprograms (BLAS) and Linear Algebra PACKage (LAPACK) routines (except for any routines listed in Section 4). It also provides static and shareable libraries that use self-contained NAG reference versions of these routines (referred to as the self-contained libraries). This implementation has been tested with version 2021.0.4 of MKL, which is supplied as a part of this product. Please see the Intel website for further information about MKL (https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html).
For best performance, we recommend that you use one of the variants of the NAG Library which is based on the supplied MKL vendor Library, i.e. nag_mkl_MT.lib, nag_mkl_MD.lib or NSW6I302E_mkl.lib/NSW6I302E_mkl.dll, in preference to using one of the self-contained NAG libraries, nag_nag_MT.lib, nag_nag_MD.lib or NSW6I302E_nag.lib/NSW6I302E_nag.dll.
Which static variant of the NAG Library you should use will also depend on how you wish to link to the Microsoft run-time libraries. For example, if you are linking with the multithreaded static run-time libraries, you should use nag_mkl_MT.lib or nag_nag_MT.lib, whereas if you are linking with the multithreaded dynamic link run-time libraries, you should use nag_mkl_MD.lib or nag_nag_MD.lib. Alternatively, if you wish to call a dynamic link library (DLL) variant of the NAG Library, you should link with the import library NSW6I302E_mkl.lib or NSW6I302E_nag.lib (and, at run time, make sure that the corresponding DLL, NSW6I302E_mkl.dll or NSW6I302E_nag.dll, is on your path). For more details, see Section 3.1.1.
The NAG AD Library is not included in this implementation.
Note that the NAG Library is carefully designed so that any memory used can be reclaimed – either by the Library itself or by the user invoking calls of NAG_FREE(). However, the Library does itself depend on the use of compiler run-time and other libraries which may sometimes leak memory, and memory tracing tools used on programs linked to the NAG Library may report this. The amount of memory leaked will vary from application to application, but should not be excessive and should never increase without limit as more calls are made to the NAG Library.
If you intend to use the NAG Library within a multithreaded application please refer to the document CL Interface Multithreading or FL Interface Multithreading (as appropriate) for more information.
Further information about using the supplied Intel MKL libraries with threaded applications is available at https://software.intel.com/content/www/us/en/develop/documentation/onemkl-windows-developer-guide/top/managing-performance-and-memory/improving-performance-with-threading.html.
The libraries supplied with this implementation have been compiled with OpenMP. However, the OpenMP run-time libraries of different compilers may not be compatible, thus you are recommended to only use this implementation in conjunction with your own OpenMP code (including any OpenMP statements required in the user-supplied functions of the routines listed in Section 4) when using the compiler and corresponding OpenMP run-time listed in Section 2.2 of the Installer's Note. Note that the system's default thread stacksize may not be sufficient for running all NAG Library routines within multithreaded applications; you may increase this stacksize using the OpenMP environment variable OMP_STACKSIZE.
Intel have introduced a conditional bitwise reproducibility (BWR) option in MKL. Provided a user's code adheres to certain conditions (see https://software.intel.com/content/www/us/en/develop/documentation/onemkl-windows-developer-guide/top/obtaining-numerically-reproducible-results/reproducibility-conditions.html), BWR can be forced by setting the MKL_CBWR environment variable. See the MKL documentation for further details. It should be noted, however, that many NAG routines do not adhere to these conditions. This means that for a given NAG library built on top of MKL, it may not be possible to ensure BWR for all NAG routines across different CPU architectures by setting MKL_CBWR. See Section 8.1 of How to Use the NAG Library for more general information on bitwise reproducibility.

3.1 Accessing the Library

In this section we assume that the Library has been installed in the default folder, namely
  C:\Program Files\NAG\NL30\nsw6i302el
The actual name of the "Program Files" folder may appear differently, depending on your locale. If the above folder does not exist, please consult the system manager (or the person who did the installation). In some of the following subsections, this folder is referred to as install_dir.
We also assume that the shortcut for the Library command prompt is in the NAG Library (NSW6I302EL) section of the Start Menu or All apps under:
      NAG NSW6I302EL Command Prompt
If this shortcut does not exist, please consult the system manager (or the person who did the installation). (Other shortcuts created as part of the Library installation procedure are also assumed to be in this location.)
If you are using a DLL form of the Library (see Section 3.1.1), you need to ensure that the NAG DLL (NSW6I302E_mkl.dll or NSW6I302E_nag.dll) is accessible at run time; therefore the install_dir\bin folder must be on the path. The install_dir\rtl\bin folder must be on the path too (unless you have the appropriate Intel run-time libraries on your path already). If an MKL-based version of the Library is to be used, the install_dir\mkl\bin folder must also be on the path, but should appear later in the path than the install_dir\bin folder, since the NAG versions of a few BLAS / LAPACK routines may be included in the NAG Libraries to avoid problems with the vendor versions. (See Section 4 for details.)
To check the accessibility of the NAG DLLs, run the program NAG_Library_DLL_info.exe which is available from the Start Menu or All apps shortcut
      Check NAG NSW6I302EL DLL Accessibility
See Section 4.2.2 of the Installer's Note for details of this utility.

3.1.0 Setting the Number of Threads to Use

This implementation of the NAG Library, and MKL, make use of OpenMP to implement threading in some of the Library routines. The number of threads that will be used at run time can be controlled by setting the environment variable OMP_NUM_THREADS to the appropriate value.
You can set an environment variable in a command window:
  set OMP_NUM_THREADS=N
where N is the number of threads required. Environment variables can also be set in the usual way via the Windows Control Panel. The environment variable OMP_NUM_THREADS may be re-set between each execution of the program, as desired. If you wish to change the number of threads to use for different parts of your program during execution, routines are provided in Chapter X06 of the NAG Library to assist with this process.
Multiple levels of OpenMP parallelism may be present in some NAG Library and MKL routines, and you may also call these multithreaded routines from within an OpenMP parallel region in your own application. By default, OpenMP nested parallelism is disabled, so only the outermost parallel region will actually be active, using N threads in the example above. The inner level(s) will not be active, i.e. they will run on one thread. You can check if OpenMP nested parallelism is enabled and choose to enable/disable it by either querying and setting the OMP_NESTED OpenMP environment variable or using the appropriate routines in Chapter X06. If OpenMP nested parallelism is enabled, the above example will create N threads at each parallel region for each thread at a higher level, thus N*N threads in total if there are two levels of OpenMP parallelism, etc. To provide more detailed control of nested parallelism, the environment variable OMP_NUM_THREADS can be set to be a comma-separated list to specify the number of threads desired at each level. e.g.
  set OMP_NUM_THREADS=N,P
This will create N threads for the first level of parallelism, and then P threads for each outer level thread when an inner level of parallelism is encountered.
Note: If the environment variable OMP_NUM_THREADS is not set, the default value can vary from compiler to compiler, and for different vendor libraries, usually to either be 1 or else equal to the maximum number of cores available on your system. The latter could be an issue if you are sharing the system with other users, or are running a higher level of parallelism within your own application. Thus it is recommended that you always set OMP_NUM_THREADS explicitly to your desired value.
In general, the maximum number of threads you are recommended to use is the number of physical cores on your shared memory system. However, most Intel processors support a facility known as Hyperthreading, which allows each physical core to support up to two threads at the same time and thus appear to the operating system as two logical cores. It may be beneficial to make use of this functionality, but this choice will depend on the particular algorithms and problem size(s) used. You are advised to benchmark performance-critical applications with and without making use of the additional logical cores, to determine the best choice for you. This can normally be achieved simply by an appropriate choice for the number of threads to use, via OMP_NUM_THREADS. Completely disabling Hyperthreading normally requires setting the desired choice in the BIOS on your system at boot time.
The supplied Intel MKL libraries include additional environment variables to allow greater control of the threading within MKL. These are discussed at https://www.intel.com/content/www/us/en/docs/onemkl/developer-guide-windows/2023-0/onemkl-specific-env-vars-for-openmp-thread-ctrl.html. Many NAG routines make calls to routines within MKL, thus the MKL environment variables may indirectly affect the operation of the NAG Library as well. The default settings of the MKL environment variables should be suitable for most purposes, thus it is recommended that you do not explicitly set these variables. Instead users are recommended to use Chapter X06 routines. These apply equally to OpenMP in the calling program, NAG routines and MKL. Please contact NAG for further advice if required.

3.1.1 From a Command Window

To access this implementation from a command window some environment variables need to be set.
The shortcut:
      NAG NSW6I302EL Command Prompt
may be used to start a command prompt window with the correct settings for the INCLUDE, LIB and PATH environment variables for the Library and the supplied MKL. The environment variable NAG_NSW6I302EL, which is needed by the nag_example_*.bat batch files is also set.
If the shortcut is not used, you can set the environment variables by running the batch file envvars.bat for this implementation. The default location for this file is:
  C:\Program Files\NAG\NL30\nsw6i302el\batch\envvars.bat
If this file is not in the default location, you can locate it by searching for the file envvars.bat containing nsw6i302el.
You may then compile and link to the NAG Library on the command line using one of the following commands:
  cl /MD driver.c NSW6I302E_mkl.lib
  ifort  /MD driver.f90 NSW6I302E_mkl.lib

  cl /MD driver.c NSW6I302E_nag.lib
  ifort  /MD driver.f90 NSW6I302E_nag.lib

  cl /MT driver.c nag_mkl_MT.lib mkl_intel_lp64.lib mkl_intel_thread.lib
     mkl_core.lib libiomp5md.lib user32.lib
     /link /nodefaultlib:ifconsol.lib /nodefaultlib:ifmodintr.lib /nodefaultlib:libifcoremt.lib
/nodefaultlib:libifport.lib /nodefaultlib:ifwin.lib ifort /MT driver.f90 nag_mkl_MT.lib mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib user32.lib cl /MT driver.c nag_nag_MT.lib user32.lib /link /nodefaultlib:ifconsol.lib /nodefaultlib:ifmodintr.lib /nodefaultlib:libifcoremt.lib
/nodefaultlib:libifport.lib /nodefaultlib:ifwin.lib ifort /MT driver.f90 nag_nag_MT.lib user32.lib cl /MD driver.c nag_mkl_MD.lib mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib user32.lib /link /nodefaultlib:ifconsol.lib /nodefaultlib:ifmodintr.lib /nodefaultlib:libifcoremd.lib
/nodefaultlib:libifportmd.lib /nodefaultlib:ifwin.lib ifort /MD driver.f90 nag_mkl_MD.lib mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib user32.lib cl /MD driver.c nag_nag_MD.lib user32.lib /link /nodefaultlib:ifconsol.lib /nodefaultlib:ifmodintr.lib /nodefaultlib:libifcoremd.lib
/nodefaultlib:libifportmd.lib /nodefaultlib:ifwin.lib ifort /MD driver.f90 nag_nag_MD.lib user32.lib
where driver.c or driver.f90 is your application program. (Note – we assume above use of the Microsoft C compiler cl. You may also use the Intel C compiler icl or icx. Options for both compilers are the same. Similary, the Intel ifx compiler may be used instead of ifort.)
The compiler/linker options:
/MD
means compile code to link with import libraries for multithreaded DLL versions of compiler run-time libraries
Please note this option must be specified when compiling/linking the c_header examples.
/MT
means compile code to link with static multithreaded versions of compiler run-time libraries
/nodefaultlib:
tells the linker not to complain about a missing (and here un-needed) run-time library
These options should be used consistently throughout your project.
NSW6I302E_mkl.lib is a DLL import library that makes use of MKL for BLAS/LAPACK routines. NSW6I302E_nag.lib is a DLL import library that includes NAG BLAS/LAPACK. Both libraries have been compiled with the /MD option. This option must be used when compiling applications to be linked with such libraries to ensure linking to the correct compiler run-time libraries.
nag_mkl_MT.lib is a static library that does not include BLAS/LAPACK and should be linked to the MKL static libraries. nag_nag_MT.lib is a static library that includes NAG BLAS/LAPACK. Both libraries have been compiled with the /MT option. This option must be used when compiling applications to be linked with such libraries to ensure linking to the correct compiler run-time libraries.
nag_mkl_MD.lib is a static library that does not include BLAS/LAPACK and should be linked to the MKL static libraries. nag_nag_MD.lib is a static library that includes NAG BLAS/LAPACK. Both libraries have been compiled with the /MD option. This option must be used when compiling applications to be linked with such libraries to ensure linking to the correct compiler run-time libraries.

3.1.2 From Microsoft Visual Studio

The following instructions apply to Microsoft Visual Studio 2019. If a different version of Visual Studio is being used the procedure may differ slightly.
If it is planned to use Microsoft Visual Studio to build programs that use the NAG Library, each user should set the appropriate options.
Start Visual Studio and create your project in the usual way. We assume that your project is going to make use of the NAG Library.
The Library is intended to be run in fully optimized mode, so to avoid any warning messages, you might decide to set the active configuration to Release. Once Visual Studio has been opened, you can do this from the Toolbar or alternatively via the Build|Configuration Manager menus. Note that if you work in Debug mode, you may receive a warning message about conflicting run-time libraries.
Make sure the Platform is set to x64 (to ensure compatibility with this 64-bit implementation of the NAG Library). This can be changed via the Configuration Manager... button on the Property Pages.
The following steps show how to add the NAG Library to the project:
  1. 1.Open the Property Pages for the project. There are several ways of doing this including:
  2. 2.Various folder locations need to be configured. From the form, click/expand Configuration Properties.
    If your project is a Microsoft or Intel C or C++ project:
    If your project is an Intel Fortran project:
    The default folders are as follows:
      C/C++ project Include Directories
        C:\Program Files\NAG\NL30\nsw6i302el\include
    
      Fortran project Additional Include Directories
        C:\Program Files\NAG\NL30\nsw6i302el\nag_interface_blocks
    
      C/C++ or Fortran project [Additional] Library Directories
        C:\Program Files\NAG\NL30\nsw6i302el\lib
        C:\Program Files\NAG\NL30\nsw6i302el\rtl\lib
        C:\Program Files\NAG\NL30\nsw6i302el\mkl\lib
    
    Click on the Apply button to accept the changes or click on the OK button to accept the changes and close the form.
  3. 3.The NAG Library and Intel run-time libraries (and possibly the MKL libraries) need to be specified in the linker options. From the Property Pages form, click/expand Linker in the leftmost panel (also under Configuration Properties) then select Input and add the appropriate library files to the Additional Dependencies list; please see the table below.
    Click on the Apply button to accept the changes or click on the OK button to accept the changes and close the form.
  4. 4.Additionally the appropriate run-time library option needs to be set. This must match the version of the NAG Library that you link to.
    If your project is a Microsoft or Intel C or C++ project:
    If your project is an Intel Fortran project:
  5. NAG Library MKL and other Libraries Run-time Libraries
    NSW6I302E_mkl.lib (not required at link time) Multi-threaded DLL (/MD)
    NSW6I302E_nag.lib (not required at link time) Multi-threaded DLL (/MD)
    nag_mkl_MT.lib mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib user32.lib Multi-threaded (/MT)
    nag_nag_MT.lib user32.lib Multi-threaded (/MT)
    nag_mkl_MD.lib mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib user32.lib Multi-threaded DLL (/MD)
    nag_nag_MD.lib user32.lib Multi-threaded DLL (/MD)
  6. 5. For a Microsoft C or C++ project, if you are linking to a static version of the NAG Library, i.e. nag_mkl_MT.lib or nag_mkl_MD.lib rather than a DLL, then it will also be necessary to change project settings to tell the linker to ignore some run-time libraries. Again in Configuration Properties, click/expand the Linker section in the left hand panel, then click on Input. On the right hand panel, select Ignore Specific Default Libraries, choose Edit and add the list of libraries shown as /nodefaultlib: in the commands in Section 3.1.1, choosing the set for /MD or /MT builds as appropriate (note that the sets are similar but not identical). Separate the library names with semi-colons.
    Click on the OK button to accept the changes and close the form.
The project should now compile and link using the appropriate choice from the Build menu.
To run a program from within the Microsoft Development Environment, the program may be executed via the Debug menu (by selecting Start Without Debugging (Ctrl+F5), for example). Note that the PATH environment variable must be set appropriately, as detailed in Section 3.1.1 above.
If a data file needs to be attached to the standard input or the output of a program needs to be redirected to the standard output, this can be achieved by selecting the Debugging section on the Properties form and inserting the appropriate commands in the Command Arguments field, e.g.
  < input_file > output_file
If the input and output files are not in the application's working directory, full or relative paths may need to be specified. For NAG examples that use an .opt file, this should be placed in the working directory. This directory may be set via the Working Directory field, which is also on the Debugging page of the Properties form.

3.1.3 Note on Fortran Module Files

The Fortran .mod module files supplied with this NAG Library implementation in the nag_interface_blocks folder were compiled with the Intel ifort compiler. Such module files are compiler-dependent and will not be suitable for use with other Fortran compilers. If you wish to use the NAG example programs, or use the interface blocks in your own programs, when using another compiler, you will first need to create your own module files. See Section 3.2 for details.

3.1.4 From NAG Fortran Builder

There are three cases to consider:

3.1.5 From Other Environments

Information on calling the NAG Library from environments not mentioned above may be available from the Supplementary Information page:
https://support.nag.com/doc/inun/ns30/w6i2el/supplementary.html

3.2 Fortran Interface Blocks

The NAG Library interface blocks define the type and arguments of each user-callable NAG Library Fortran routine. While they are not essential to calling the NAG Library from Fortran programs, their use is highly recommended, and they are essential if the supplied examples are used.
Their purpose is to allow the Fortran compiler to check that NAG Library routines are called correctly. The interface blocks enable the compiler to check that:
  1. (a)subroutines are called as such;
  2. (b)functions are declared with the right type;
  3. (c)the correct number of arguments are passed; and
  4. (d)all arguments match in type and structure.
The NAG Library interface block files are organised by Library chapter. They are aggregated into one module named
  nag_library
The modules are supplied in compiled form (.mod files) for use by the Intel Fortran compiler, ifort.
If you use the Library command prompt shortcut, or set the environment variables by running the batch file envvars.bat for this implementation (see Section 3.1.1), and the Intel ifort compiler, you can use any of the commands described in Section 3.1.1 to access these modules since the environment variable INCLUDE will be set.
The .mod module files were compiled with the Fortran compiler shown in Section 2.2 of the Installer's Note. Such module files are compiler-dependent, so if you wish to use the NAG example programs, or use the interface blocks in your own programs, when using a compiler that is incompatible with these modules, you will first need to create your own module files, as described here.
Create a folder named nag_interface_blocks_original in a location of your choice (the exact folder name is not important), and copy the contents of nag_interface_blocks to nag_interface_blocks_original, thus saving the original set of interface blocks.
Then in folder nag_interface_blocks recompile all the .f90 files into objects using your compiler. Because the interface blocks contain some inter-dependencies, the order of compilation is important, but the following compilation order should work, where FCOMP is the name of your Fortran compiler:
  FCOMP -c nag_precisions.f90
  FCOMP -c nag_a_ib.f90
  FCOMP -c nag_blast_ib.f90
  FCOMP -c nag_blas_consts.f90
  FCOMP -c nag_blas_ib.f90
  FCOMP -c nag_c_ib.f90
  FCOMP -c nag_d_ib.f90
  FCOMP -c nag_e_ib.f90
  FCOMP -c nag_f_ib.f90
  FCOMP -c nag_g_ib.f90
  FCOMP -c nag_h_ib.f90
  FCOMP -c nag_lapack_ib.f90
  FCOMP -c nag_m_ib.f90
  FCOMP -c nag_s_ib.f90
  FCOMP -c nag_x_ib.f90
  FCOMP -c nag_long_names.f90
  FCOMP -c nag_library.f90
The object files generated by the compilation may be discarded – only the module files are needed.
You should now be able to use the newly compiled module files in the usual way.

3.3 Example Programs

The example results distributed were generated at Mark 30.2 using the software described in Section 2.2 of the Installer's Note. These example results may not be exactly reproducible if the example programs are run in a slightly different environment (for example, a different C or Fortran compiler, a different compiler run-time library, or a different set of BLAS or LAPACK routines). The results which are most sensitive to such differences are: eigenvectors (which may differ by a scalar multiple, often -1, but sometimes complex); numbers of iterations and function evaluations; and residuals and other "small" quantities of the same order as the machine precision.
The distributed example results are those obtained with the static library nag_mkl_MD.lib (i.e. using the MKL BLAS and LAPACK routines). Running the examples with NAG BLAS or LAPACK may give slightly different results.
Note that the example material has been adapted, if necessary, from that published in the Library Manual, so that programs are suitable for execution with this implementation with no further changes. The distributed example programs should be used in preference to the versions in the Library Manual wherever possible.
The example programs are most easily accessed using the batch files nag_example_DLL.bat, nag_example_static_MT.bat and nag_example_static_MD.bat, which can be found in the install_dir\batch folder.
These batch files require that the environment variables for your C/C++ or Fortran compiler and the NAG Library are set. In particular, the environment variable NAG_NSW6I302EL needs to be set to the location of the NAG Library. Please see Section 3.1.1 for details of how to do this.
Each of the nag_example_*.bat batch files mentioned above will provide you with a copy of an example program (and its data and options file, if any), compile the program and link it with the appropriate libraries (showing you the compile command so that you can recompile your own version of the program). Finally, the executable program will be run (with appropriate arguments specifying data, options and results files as needed), with the results being sent to a file and to the command window.
Example programs in both C and Fortran are provided.
The example program concerned, and the number of OpenMP threads to use, are specified by the arguments to the command, e.g.
  nag_example_DLL e04ucc -nthreads 2
  nag_example_DLL e04ucf -nthreads 2
will copy the example program and its data and options files (e04ucce.c, e04ucce.d and e04ucce.opt for C, or e04ucfe.f90 and e04ucfe.d for Fortran) into the current folder, compile and link the program and run it using 2 threads to produce the example program results in the file e04ucce.r (for C) or e04ucfe.r (for Fortran). If the -nthreads switch is not used, the default behaviour is to run with a single thread.
nag_example_DLL.bat links to the DLL version of the NAG Library using NAG BLAS/LAPACK.
To link with the MKL version of the DLL, use the -mkl option, e.g.
  nag_example_DLL -mkl e04ucc -nthreads 2
  nag_example_DLL -mkl e04ucf -nthreads 2
The nag_example_static_MD.bat batch file is used in the same way and links to the static NAG library compiled with /MD.
  nag_example_static_MD e04ucc -nthreads 2
  nag_example_static_MD e04ucf -nthreads 2
Again, it is possible to link the MKL BLAS/LAPACK by using the -mkl option
  nag_example_static_MD -mkl e04ucc -nthreads 2
  nag_example_static_MD -mkl e04ucf -nthreads 2
The nag_example_static_MT.bat batch file links to the static library compiled with /MT, e.g.
  nag_example_static_MT e04ucc -nthreads 2
  nag_example_static_MT e04ucf -nthreads 2
  nag_example_static_MT -mkl e04ucc -nthreads 2
  nag_example_static_MT -mkl e04ucf -nthreads 2
To invoke the Intel C/C++ compiler instead of the Microsoft C/C++ compiler, add the -icl option to the batch file command.

3.4 Maintenance Level

The maintenance level of the Library can be determined by compiling and executing the example that calls a00aaf or a00aac, or you could call one of the nag_example_*.bat batch files with the argument a00aaf or a00aac. See Section 3.3. This example prints out details of the implementation, including title and product code, compiler and precision used, mark and maintenance level.
Alternatively, run the diagnostic program NAG_Library_DLL_info.exe which itself calls a00aac and a00aaf (see Section 4.2.2 of the Installer's Note).

3.5 C Data Types

In this implementation, the NAG C types Integer and Pointer are defined as follows:
NAG Type C Type Size (bytes)
Integer int 4
Pointer void * 8
The values for sizeof(Integer) and sizeof(Pointer) are also given by the a00aac example program. Information on other NAG data types is available in Section 3.1.1 of the NAG CL Interface Introduction component of the Library Manual (see Section 5 below).

3.6 Fortran Data Types and Interpretation of Bold Italicised Terms

This implementation of the NAG Library includes libraries for 32-bit integers only. The libraries are located in install_dir\lib.
The NAG Library and documentation use parameterized types for floating-point variables. Thus, the type
      REAL(KIND=nag_wp)
appears in the documentation of all NAG Library routines, where nag_wp is a Fortran KIND parameter. The value of nag_wp will vary between implementations, and its value can be obtained by use of the nag_library module. We refer to the type nag_wp as the NAG Library "working precision" type, because most floating-point arguments and internal variables used in the Library are of this type.
In addition, a small number of routines use the type
      REAL(KIND=nag_rp)
where nag_rp stands for "reduced precision" type. Another type, not currently used in the Library, is
      REAL(KIND=nag_hp)
for "higher precision" type or "additional precision" type.
For correct use of these types, see almost any of the example programs distributed with the Library.
For this implementation, these types have the following meanings:
      REAL (kind=nag_rp)      means REAL (i.e. single precision)
      REAL (kind=nag_wp)      means DOUBLE PRECISION
      COMPLEX (kind=nag_rp)   means COMPLEX (i.e. single precision complex)
      COMPLEX (kind=nag_wp)   means double precision complex (e.g. COMPLEX*16)
In addition, the FL Interface section of the Manual has adopted a convention of using bold italics to distinguish some terms. See Section 2.5 of the NAG FL Interface Introduction for details.

3.7 Calling NAG Fortran Routines from C/C++

With care, the Fortran routines in the NAG Library may be used from within a C, C++ or compatible environment. Using the Fortran routines in this manner may be preferable to calling the C routines, either to access a legacy Fortran routine for which a C routine equivalent is not available, or to have a lower level C interface, using only elementary C data types, which may be more convenient for use from other languages. To assist the user make the mapping between Fortran and C types, a description of the Fortran interface from a C perspective (the C Header Interface) is included in each Fortran routine document. A C/C++ header file (install_dir\include\nag.h) is also provided. It is recommended that users wishing to use a NAG Fortran routine in this manner #include this header file in their application.
A document, alt_c_interfaces.html, giving advice on calling the Fortran routines in the NAG Library from C and C++ is also available. (In previous Marks of the NAG Library, this document was called techdoc.html.)

3.8 C declarations for LAPACK, BLAS, etc.

The NAG C/C++ header files include declarations for the LAPACK, BLAS and BLAS Technical Forum (BLAST) routines included in the NAG Library. Users may prefer to get these definitions from the C include files associated with other libraries, e.g. the supplied Intel MKL. In these circumstances, to avoid clashes between the different C header declarations, the NAG declarations of these routines may be disabled by adding the compile flags:
  -DNAG_OMIT_LAPACK_DECLARATION -DNAG_OMIT_BLAS_DECLARATION -DNAG_OMIT_BLAST_DECLARATION
to the C or C++ compile statements described in Section 3.1. Declarations for the alternative NAG F01, F06, F07 and F08 routine names will remain.

4 Routine-specific Information

Any further information which applies to one or more routines in this implementation is listed below, chapter by chapter.
  1. (a)Routines that call User Functions within OpenMP Parallel Regions
    In this implementation, the following routines make calls to user functions from within OpenMP parallel regions located inside the NAG routines.
    C routines:
      e05ucc  e05usc  f01elc  f01emc  f01f​lc  f01fmc  f01jbc  f01jcc
      f01kbc  f01kcc
    
    Fortran routines:
      d03raf  d03rbf  e05saf  e05sbf  e05ucf  e05usf  f01elf  f01emf
      f01f​lf  f01fmf  f01jbf  f01jcf  f01kbf  f01kcf
    
    Thus orphaned OpenMP directives can be used in user functions, unless you are using a different compiler from the one used to build your NAG Library implementation, as listed in Section 2.2 of the Installer's Note. You must also ensure that you use any user workspace arrays IUSER, RUSER and CPUSER in a thread safe manner, which is best achieved by only using them to supply read-only data to the user functions.
  2. (b)C06
    In this implementation, calls to the Intel Discrete Fourier Transforms Interface (DFTI) routines, from the supplied MKL library, are made whenever possible in the following NAG C routines:
     c06pac  c06pcc  c06pfc  c06pjc  c06pkc  c06ppc  c06pqc  c06prc
     c06psc  c06puc  c06pvc  c06pwc  c06pxc  c06pyc  c06pzc  c06rac  
     c06rbc  c06rcc  c06rdc
    
    and in the following NAG Fortran routines:
     c06paf  c06pcf  c06pf​f  c06pjf  c06pkf  c06ppf  c06pqf  c06prf
     c06psf  c06puf  c06pvf  c06pwf  c06pxf  c06pyf  c06pzf  c06raf  
     c06rbf  c06rcf  c06rdf
    
    The Intel DFTI routines allocate their own workspace internally, so no changes are needed to the size of workspace array WORK passed to the NAG Fortran routines listed above from that specified in their respective library documents.
  3. (c)F06, F07, F08 and F16
    In Chapters F06, F07, F08 and F16, alternative routine names are available for BLAS and LAPACK derived routines. For details of the alternative routine names please refer to the relevant Chapter Introduction. Note that applications should reference routines by their BLAS/LAPACK names, rather than their NAG-style names, for optimum performance.
    Many LAPACK routines have a "workspace query" mechanism which allows a caller to interrogate the routine to determine how much workspace to supply. Note that LAPACK routines from the MKL Library may require a different amount of workspace from the equivalent NAG reference versions of these routines. Care should be taken when using the workspace query mechanism.
    In this implementation, calls to BLAS and LAPACK routines in the non-self-contained NAG libraries are implemented by calls to MKL, except for the following routines:
    blas_damax_val  blas_damin_val  blas_daxpby     blas_ddot       blas_dmax_val
    blas_dmin_val   blas_dsum       blas_dwaxpby    blas_zamax_val  blas_zamin_val
    blas_zaxpby     blas_zsum       blas_zwaxpby
    dbdsvdx dgesvdx dgesvj  dsbgvd  zgejsv  zgesvdx zgesvj  zhbgvd
    
  4. (d)S07 - S21
    The behaviour of functions in these Chapters may depend on implementation-specific values.
    General details are given in the Library Manual, but the specific values used in this implementation are as follows:
    s07aa[f] (nag[f]_specfun_tan)
        F_1 = 1.0e+13
        F_2 = 1.0e-14
    
    s10aa[fc] (nag[f]_specfun_tanh)
        E_1 = 1.8715e+1
    s10ab[fc] (nag[f]_specfun_sinh)
        E_1 = 7.080e+2
    s10ac[fc] (nag[f]_specfun_cosh)
        E_1 = 7.080e+2
    
    s13aa[fc] (nag[f]_specfun_integral_exp)
        x_hi = 7.083e+2
    s13ac[fc] (nag[f]_specfun_integral_cos)
        x_hi = 1.0e+16
    s13ad[fc] (nag[f]_specfun_integral_sin)
        x_hi = 1.0e+17
    
    s14aa[fc] (nag[f]_specfun_gamma)
        ifail = 1 (NE_REAL_ARG_GT) if x > 1.70e+2
        ifail = 2 (NE_REAL_ARG_LT) if x < -1.70e+2
        ifail = 3 (NE_REAL_ARG_TOO_SMALL) if abs(x) < 2.23e-308
    s14ab[fc] (nag[f]_specfun_gamma_log_real)
        ifail = 2 (NE_REAL_ARG_GT) if x > x_big = 2.55e+305
    
    s15ad[fc] (nag[f]_specfun_erfc_real)
        x_hi = 2.65e+1
    s15ae[fc] (nag[f]_specfun_erf_real)
        x_hi = 2.65e+1
    s15ag[fc] (nag[f]_specfun_erfcx_real)
        ifail = 1 (NW_HI) if x >= 2.53e+307
        ifail = 2 (NW_REAL) if 4.74e+7 <= x < 2.53e+307
        ifail = 3 (NW_NEG) if x < -2.66e+1
    
    s17ac[fc] (nag[f]_specfun_bessel_y0_real)
        ifail = 1 (NE_REAL_ARG_GT) if x > 1.0e+16
    s17ad[fc] (nag[f]_specfun_bessel_y1_real)
        ifail = 1 (NE_REAL_ARG_GT) if x > 1.0e+16
        ifail = 3 (NE_REAL_ARG_TOO_SMALL) if 0 < x <= 2.23e-308
    s17ae[fc] (nag[f]_specfun_bessel_j0_real)
        ifail = 1 (NE_REAL_ARG_GT) if abs(x) > 1.0e+16
    s17af[fc] (nag[f]_specfun_bessel_j1_real)
        ifail = 1 (NE_REAL_ARG_GT) if abs(x) > 1.0e+16
    s17ag[fc] (nag[f]_specfun_airy_ai_real)
        ifail = 1 (NE_REAL_ARG_GT) if x > 1.038e+2
        ifail = 2 (NE_REAL_ARG_LT) if x < -5.7e+10
    s17ah[fc] (nag[f]_specfun_airy_bi_real)
        ifail = 1 (NE_REAL_ARG_GT) if x > 1.041e+2
        ifail = 2 (NE_REAL_ARG_LT) if x < -5.7e+10
    s17aj[fc] (nag[f]_specfun_airy_ai_deriv)
        ifail = 1 (NE_REAL_ARG_GT) if x > 1.041e+2
        ifail = 2 (NE_REAL_ARG_LT) if x < -1.9e+9
    s17ak[fc] (nag[f]_specfun_airy_bi_deriv)
        ifail = 1 (NE_REAL_ARG_GT) if x > 1.041e+2
        ifail = 2 (NE_REAL_ARG_LT) if x < -1.9e+9
    s17dc[fc] (nag[f]_specfun_bessel_y_complex)
        ifail = 2 (NE_OVERFLOW_LIKELY) if abs(z) < 3.92223e-305
        ifail = 4 (NW_SOME_PRECISION_LOSS) if abs(z) or fnu+n-1 > 3.27679e+4
        ifail = 5 (NE_TOTAL_PRECISION_LOSS) if abs(z) or fnu+n-1 > 1.07374e+9
    s17de[fc] (nag[f]_specfun_bessel_j_complex)
        ifail = 2 (NE_OVERFLOW_LIKELY) if AIMAG(z) > 7.00921e+2
        ifail = 3 (NW_SOME_PRECISION_LOSS) if abs(z) or fnu+n-1 > 3.27679e+4
        ifail = 4 (NE_TOTAL_PRECISION_LOSS) if abs(z) or fnu+n-1 > 1.07374e+9
    s17dg[fc] (nag[f]_specfun_airy_ai_complex)
        ifail = 3 (NW_SOME_PRECISION_LOSS) if abs(z) > 1.02399e+3
        ifail = 4 (NE_TOTAL_PRECISION_LOSS) if abs(z) > 1.04857e+6
    s17dh[fc] (nag[f]_specfun_airy_bi_complex)
        ifail = 3 (NW_SOME_PRECISION_LOSS) if abs(z) > 1.02399e+3
        ifail = 4 (NE_TOTAL_PRECISION_LOSS) if abs(z) > 1.04857e+6
    s17dl[fc] (nag[f]_specfun_hankel_complex)
        ifail = 2 (NE_OVERFLOW_LIKELY) if abs(z) < 3.92223e-305
        ifail = 4 (NW_SOME_PRECISION_LOSS) if abs(z) or fnu+n-1 > 3.27679e+4
        ifail = 5 (NE_TOTAL_PRECISION_LOSS) if abs(z) or fnu+n-1 > 1.07374e+9
    
    s18ad[fc] (nag[f]_specfun_bessel_k1_real)
        ifail = 2 (NE_REAL_ARG_TOO_SMALL) if 0 < x <= 2.23e-308
    s18ae[fc] (nag[f]_specfun_bessel_i0_real)
        ifail = 1 (NE_REAL_ARG_GT) if abs(x) > 7.116e+2
    s18af[fc] (nag[f]_specfun_bessel_i1_real)
        ifail = 1 (NE_REAL_ARG_GT) if abs(x) > 7.116e+2
    s18dc[fc] (nag[f]_specfun_bessel_k_complex)
        ifail = 2 (NE_OVERFLOW_LIKELY) if abs(z) < 3.92223e-305
        ifail = 4 (NW_SOME_PRECISION_LOSS) if abs(z) or fnu+n-1 > 3.27679e+4
        ifail = 5 (NE_TOTAL_PRECISION_LOSS) if abs(z) or fnu+n-1 > 1.07374e+9
    s18de[fc] (nag[f]_specfun_bessel_i_complex)
        ifail = 2 (NE_OVERFLOW_LIKELY) if REAL(z) > 7.00921e+2
        ifail = 3 (NW_SOME_PRECISION_LOSS) if abs(z) or fnu+n-1 > 3.27679e+4
        ifail = 4 (NE_TOTAL_PRECISION_LOSS) if abs(z) or fnu+n-1 > 1.07374e+9
    
    s19aa[fc] (nag[f]_specfun_kelvin_ber)
        ifail = 1 (NE_REAL_ARG_GT) if abs(x) >= 5.04818e+1
    s19ab[fc] (nag[f]_specfun_kelvin_bei)
        ifail = 1 (NE_REAL_ARG_GT) if abs(x) >= 5.04818e+1
    s19ac[fc] (nag[f]_specfun_kelvin_ker)
        ifail = 1 (NE_REAL_ARG_GT) if x > 9.9726e+2
    s19ad[fc] (nag[f]_specfun_kelvin_kei)
        ifail = 1 (NE_REAL_ARG_GT) if x > 9.9726e+2
    
    s21bc[fc] (nag[f]_specfun_ellipint_symm_2)
        ifail = 3 (NE_REAL_ARG_LT) if an argument < 1.583e-205
        ifail = 4 (NE_REAL_ARG_GE) if an argument >= 3.765e+202
    s21bd[fc] (nag[f]_specfun_ellipint_symm_3)
        ifail = 3 (NE_REAL_ARG_LT) if an argument < 2.813e-103
        ifail = 4 (NE_REAL_ARG_GT) if an argument >= 1.407e+102
    
  5. (e)X01
    The values of the mathematical constants are:
    x01aa[fc] (nag[f]_math_pi)
         = 3.1415926535897932
    x01ab[fc] (nag[f]_math_euler)
         = 0.5772156649015328
    
  6. (f)X02
    The values of the machine constants are:
    The basic parameters of the model
    x02bh[fc] (nag[f]_machine_model_base)
         = 2
    x02bj[fc] (nag[f]_machine_model_digits)
         = 53
    x02bk[fc] (nag[f]_machine_model_minexp)
         = -1021
    x02bl[fc] (nag[f]_machine_model_maxexp)
         = 1024
    
    Derived parameters of the floating-point arithmetic
    x02aj[fc] (nag[f]_machine_precision)
         = 1.11022302462516e-16
    x02ak[fc] (nag[f]_machine_real_smallest)
         = 2.22507385850721e-308
    x02al[fc] (nag[f]_machine_real_largest)
         = 1.79769313486231e+308
    x02am[fc] (nag[f]_machine_real_safe)
         = 2.22507385850721e-308
    x02an[fc] (nag[f]_machine_complex_safe)
         = 2.22507385850721e-308
    
    Parameters of other aspects of the computing environment
    x02ah[fc] (nag[f]_machine_sinarg_max)
         = 1.42724769270596e+45
    x02bb[fc] (nag[f]_machine_integer_max)
         = 2147483647
    x02be[fc] (nag[f]_machine_decimal_digits)
         = 15
    
  7. (g)X04
    Fortran routines: The default output units for error and advisory messages for those routines which can produce explicit output are both Fortran Unit 6.
  8. (h)X06
    Chapter X06 routines also change the behaviour of MKL threading in this implementation of the Library.

5 Documentation

The Library Manual is accessible via the NAG website at NAG Library Manual, Mark 30.2.
The Library Manual is supplied in HTML5, a fully linked version of the manual using HTML and MathML. These documents can be accessed using your web browser.
Advice on viewing and navigating the documentation can be found in Guide to the NAG Library Documentation.
In addition the following are provided:
The Users' Note is available from the NAG Library (NSW6I302EL) section of the Start Menu or All apps under
  NAG NSW6I302EL Users' Note
by default.

6 Support from NAG

Please see
NAG Technical Support Service
for information about the NAG Technical Support Service, including details of the NAG Technical Support Service contact points. We would also be delighted to receive your feedback on NAG's products and services.

7 Contact Addresses

Please see
Worldwide Contact Information
for worldwide contact details for the Numerical Algorithms Group.