View all files | ||||
Data parallel C++ mathematical object library.
License: GPL v2.
Last update June 2017.
Please do not send pull requests to the master branch which is reserved for releases.
This library provides data parallel C++ container classes with internal memory layout that is transformed to map efficiently to SIMD architectures. CSHIFT facilities are provided, similar to HPF and cmfortran, and user control is given over the mapping of array indices to both MPI tasks and SIMD processing elements.
The transformation is based on the observation that Cartesian array processing involves identical processing to be performed on different regions of the Cartesian array.
The library will both geometrically decompose into MPI tasks and across SIMD lanes. Local vector loops are parallelised with OpenMP pragmas.
Data parallel array operations can then be specified with a SINGLE data parallel paradigm, but optimally use MPI, OpenMP and SIMD parallelism under the hood. This is a significant simplification for most programmers.
The layout transformations are parametrised by the SIMD vector length. This adapts according to the architecture. Presently SSE4, ARM NEON (128 bits) AVX, AVX2, QPX (256 bits), IMCI and AVX512 (512 bits) targets are supported.
These are presented as vRealF, vRealD, vComplexF, and vComplexD internal vector data types. The corresponding scalar types are named RealF, RealD, ComplexF and ComplexD.
MPI, OpenMP, and SIMD parallelism are present in the library. Please see this paper for more detail.
Intel ICPC v16.0.3 and later
Clang v3.5 and later (need 3.8 and later for OpenMP)
GCC v4.9.x (recommended)
GCC v6.3 and later
The Wiki contains specific instructions for some Summit, Tesseract and GPU compilation
Some versions of GCC appear to have a bug under high optimisation (-O2, -O3).
The safety of these compiler versions cannot be guaranteed at this time. Follow Issue 100 for details and updates.
GCC v5.x
GCC v6.1, v6.2
To help us tracking and solving more efficiently issues with Grid, please report problems using the issue system of GitHub rather than sending emails to Grid developers.
When you file an issue, please go though the following checklist:
Grid requires:
GMP,
Bootstrapping grid downloads and uses for internal dense matrix (non-QCD operations) the Eigen library.
Grid optionally uses:
LIME for ILDG and SciDAC file format support.
FFTW either generic version or via the Intel MKL library.
LAPACK either generic version or Intel MKL library.
First, start by cloning the repository:
Then enter the cloned directory and set up the build system:
Now you can execute the configure script to generate makefiles (here from a build directory):
where --enable-simd= set the SIMD type, --enable- comms=, and <path> should be replaced by the prefix path where you want to install Grid. Other options are detailed in the next section, you can also use configure --help to display them. Like with any other program using GNU autotool, the CXX, CXXFLAGS, LDFLAGS, ... environment variables can be modified to customise the build.
Finally, you can build, check, and install Grid:
To minimise the build time, only the tests at the root of the tests directory are built by default. If you want to build tests in the sub-directory <subdir> you can execute:
If you want to build all the tests at once just use make tests.
The following options can be use with the --enable-comms= option to target different communication interfaces:
| none | no communications |
| mpi[-auto] | MPI communications |
| mpi3[-auto] | MPI communications using MPI 3 shared memory |
| shmem | Cray SHMEM communications |
For the MPI interfaces the optional -auto suffix instructs the configure scripts to determine all the necessary compilation and linking flags. This is done by extracting the informations from the MPI wrapper specified in the environment variable MPICXX (if not specified configure will scan though a list of default names). The -auto suffix is not supported by the Cray environment wrapper scripts. Use the standard versions instead.
The following options can be use with the --enable-simd= option to target different SIMD instruction sets:
| GEN | generic portable vector code |
| SSE4 | SSE 4.2 (128 bit) |
| AVX | AVX (256 bit) |
| AVXFMA | AVX (256 bit) + FMA |
| AVXFMA4 | AVX (256 bit) + FMA4 |
| AVX2 | AVX 2 (256 bit) |
| AVX512 | AVX 512 bit |
| NEONv8 | ARM NEON (128 bit) |
| QPX | IBM QPX (256 bit) |
Alternatively, some CPU codenames can be directly used:
| KNL | Intel Xeon Phi codename Knights Landing |
| SKL | Intel Skylake with AVX512 extensions |
| BGQ | Blue Gene/Q |
The following configuration is recommended for the Intel Knights Landing platform:
The MKL flag enables use of BLAS and FFTW from the Intel Math Kernels Library.
If you are working on a Cray machine that does not use the mpiicpc wrapper, please use:
If gmp and mpfr are NOT in standard places (/usr/) these flags may be needed:
where <path> is the UNIX prefix where GMP and MPFR are installed.
Knight's Landing with Intel Omnipath adapters with two adapters per node presently performs better with use of more than one rank per node, using shared memory for interior communication. This is the mpi3 communications implementation. We recommend four ranks per node for best performance, but optimum is local volume dependent.
The following configuration is recommended for the Intel Haswell platform:
The MKL flag enables use of BLAS and FFTW from the Intel Math Kernels Library.
If gmp and mpfr are NOT in standard places (/usr/) these flags may be needed:
where <path> is the UNIX prefix where GMP and MPFR are installed.
If you are working on a Cray machine that does not use the mpiicpc wrapper, please use:
Since Dual socket nodes are commonplace, we recommend MPI-3 as the default with the use of one rank per socket. If using the Intel MPI library, threads should be pinned to NUMA domains using
This is the default.
The following configuration is recommended for the Intel Skylake platform:
The MKL flag enables use of BLAS and FFTW from the Intel Math Kernels Library.
If gmp and mpfr are NOT in standard places (/usr/) these flags may be needed:
where <path> is the UNIX prefix where GMP and MPFR are installed.
If you are working on a Cray machine that does not use the mpiicpc wrapper, please use:
Since Dual socket nodes are commonplace, we recommend MPI-3 as the default with the use of one rank per socket. If using the Intel MPI library, threads should be pinned to NUMA domains using
This is the default.
mpirun -n 2 benchmarks/Benchmark_dwf --grid 16.16.16.16 --mpi 2.1.1.1 --cacheblocking 2.2.2.2 --dslash-asm --shm 1024 --threads 18
TBA
The AMD EPYC is a multichip module comprising 32 cores spread over four distinct chips each with 8 cores. So, even with a single socket node there is a quad-chip module. Dual socket nodes with 64 cores total are common. Each chip within the module exposes a separate NUMA domain. There are four NUMA domains per socket and we recommend one MPI rank per NUMA domain. MPI-3 is recommended with the use of four ranks per socket, and 8 threads per rank.
The following configuration is recommended for the AMD EPYC platform.
If gmp and mpfr are NOT in standard places (/usr/) these flags may be needed:
where <path> is the UNIX prefix where GMP and MPFR are installed.
Using MPICH and g++ v4.9.2, best performance can be obtained using explicit GOMP_CPU_AFFINITY flags for each MPI rank. This can be done by invoking MPI on a wrapper script omp_bind.sh to handle this.
It is recommended to run 8 MPI ranks on a single dual socket AMD EPYC, with 8 threads per rank using MPI3 and shared memory to communicate within this node:
mpirun -np 8 ./omp_bind.sh ./Benchmark_dwf --mpi 2.2.2.1 --dslash-unroll --threads 8 --grid 16.16.16.16 --cacheblocking 4.4.4.4
Where omp_bind.sh does the following:
Performance:
mpirun -np 8 ./omp_bind.sh ./Benchmark_dwf --threads 8 --mpi 2.2.2.1 --dslash-unroll --grid 16.16.16.16 --cacheblocking 4.4.4.4
TBA
To be written...
To be written...
Many versions of g++ and clang++ work with Grid, and involve merely replacing CXX (and MPICXX), and omit the enable-mkl flag.
Single node builds are enabled with
FFTW support that is not in the default search path may then enabled with
BLAS will not be compiled in by default, and Lanczos will default to Eigen diagonalisation.