# Features

## Language

NCSTAT is developed in the Fortran95/2003 language [fortran] and takes full advantage of the novel language features such as interface overloading, kind types, modules, etc. without any obsolescent Fortran77 features. Thus, you must have access to a Fortran95/2003 compiler in order to build the NCSTAT software.

NCSTAT has been built successfully on a variety of UNIX systems (including MacOs-X and AIX) with different Fortran95/2003 compilers and is believed to be a portable software.

## Parallelism

NCSTAT is a parallel, multi-threaded software based on the OpenMP standard [openmp]. Therefore, it will run on multi-core or, more generally, shared memory multi-processor computers. NCSTAT does not run on distributed memory (e.g., clusters) parallel computers and does not use Graphics Processing Units (GPUs), but this possibility may be included in future releases of NCSTAT.

Support for at least OpenMP 3 is requested for activation of OpenMP parallelism in NCSTAT. However, it is also possible to build sequential versions of NCSTAT (e.g., if OpenMP compilation is not activated or if an OpenMP-enabled Fortran compiler is not available), even if it is not recommended for efficiency reasons. The best place to view OpenMP support by a large range of Fortran compilers is OpenMP compilers.

More precisely, parallelism in NCSTAT is achieved and can be controlled at different levels:

> 1. By the use of the STATPACK software [statpack] for the computational routines used in NCSTAT. The STATPACK software provides parallel, multi-threaded subroutines and functions for nearly all the computations done in NCSTAT. STATPACK is also written in pure and portable Fortran 95/2003 and based on the OpenMP standard. If a multi-threaded version of STATPACK is used, NCSTAT will inherit automatically the parallel capacity and efficiency of STATPACK.
> 2. By the (optional) use of an optimized and multi-threaded BLAS library [blas], such the open-source OpenBLAS library [openblas] or BLIS library [blis] or, alternatively, vendor-like BLAS libraries [accelerate] [aocl] [arm] [mkl], in addition to the STATPACK software. Some of the operators available in NCSTAT, such as comp_svd_3d, can greatly benefit from such an optimized and multi-threaded BLAS library. NCSTAT will use directly a BLAS library if the UNIX preprocessor cpp macro, `_BLAS`, is defined at compilation of NCSTAT (see the section Preprocessor cpp macros for more details).
> 3. By allowing parallel reading of NetCDF files based on the OpenMP standard [openmp] when possible (e.g. if input NetCDF files are classic, 64-bit offset or cdf5 format files). NCSTAT will perform parallel reading of NetCDF files based on the OpenMP standard if the UNIX preprocessor cpp macro, `_PARALLEL_READ`, is defined at compilation of NCSTAT and input NetCDF files are not NetCDF-4/HDF5 format files (see the section Preprocessor cpp macros for details).

In the general case, the user is fully responsible for activating the threaded capabilities of their BLAS and STATPACK libraries, and NCSTAT software by using appropriate Shell (e.g., OpenMP) environment variables before executing the NCSTAT operators. More details on how to activate OpenMP support when building NCSTAT is given in sections OpenMP compilation and CCP macros below. The basic procedure for activating OpenMP parallelism, when executing the NCSTAT operators, is described in the section Parallel execution.

## Dependencies

The following additional libraries are required and must be available or installed before compiling and using NCSTAT:

> 1. The Unidata NetCDF library [netcdf], including the NetCDF Fortran90 interface [netcdf-f90] (from version 3.5 of the NetCDF library). This library is needed to read and write NetCDF files with NCSTAT. Do not use a MPI-based parallel version of the NetCDF library, such as [pnetcdf], with NCSTAT. Since NCSTAT is using OpenMP parallelism and not MPI [mpi] , NCSTAT will not compile correctly with the current parallel versions of the NetCDF library, which are all based on MPI. Information about installing NetCDF and its Fortran90 interface is available at NETCDF and several other web sites such as Libs4cdo.
> 2. The STATPACK library [statpack]. This library is required for all the mathematical and statistical computations performed in NCSTAT. At least version 2.3 of STATPACK is required for a successful compilation of version 2.3 of NCSTAT, but version 2.4 of STATPACK is recommended for efficiency reasons. Note, that the STATPACK library also determines the precision (e.g., single, double or eventually extended) of the computations performed in NCSTAT since NCSTAT directly uses the parameterized kind types defined in STATPACK for the specifications of constants and variables used in the executables, subroutines and functions available in NCSTAT. Information about installing STATPACK and the parameterized kind types used in this library is available at STATPACK.

As described above, some NCSTAT operators can also take advantage of an optimized and multi-threaded BLAS library, such as the OpenBLAS library [openblas], the ATLAS library [atlas] or vendor BLAS like Intel MKL [mkl].

Linking the object code of these nonstandard libraries with NCSTAT is usually done with the help of compiler options, which are passed directly to the UNIX linker, ld (see below the section Installation for further details).