2016-08-03 12:38:54 +01:00
# Grid
< table >
< tr >
< td > Last stable release< / td >
< td > < a href = "https://travis-ci.org/paboyle/Grid" >
< img src = "https://travis-ci.org/paboyle/Grid.svg?branch=master" > < / a >
< / td >
< / tr >
< tr >
< td > Development branch< / td >
2016-08-03 12:40:56 +01:00
< td > < a href = "https://travis-ci.org/paboyle/Grid" >
2016-08-03 12:38:54 +01:00
< img src = "https://travis-ci.org/paboyle/Grid.svg?branch=develop" > < / a >
< / td >
< / tr >
< / table >
**Data parallel C++ mathematical object library.**
Please send all pull requests to the `develop` branch.
License: GPL v2.
Last update 2016/08/03.
### Description
2015-03-07 07:20:12 +00:00
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.
* Identically shaped arrays then be processed with perfect data parallelisation.
* Such identically shapped arrays are called conformable arrays.
The transformation is based on the observation that Cartesian array processing involves
identical processing to be performed on different regions of the Cartesian array.
2015-04-18 12:21:37 +01:00
The library will both geometrically decompose into MPI tasks and across SIMD lanes.
Local vector loops are parallelised with OpenMP pragmas.
2015-03-07 07:20:12 +00:00
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.
2016-08-03 12:38:54 +01:00
Presently SSE4 (128 bit) AVX, AVX2 (256 bit) and IMCI and AVX512 (512 bit) targets are supported (ARM NEON and BG/Q QPX on the way).
2015-03-07 07:20:12 +00:00
2016-08-03 12:38:54 +01:00
These are presented as `vRealF` , `vRealD` , `vComplexF` , and `vComplexD` internal vector data types. These may be useful in themselves for other programmers.
The corresponding scalar types are named `RealF` , `RealD` , `ComplexF` and `ComplexD` .
2015-03-07 07:20:12 +00:00
2016-08-03 12:38:54 +01:00
MPI, OpenMP, and SIMD parallelism are present in the library.
Please see https://arxiv.org/abs/1512.03487 for more detail.
2015-03-07 07:20:12 +00:00
2016-08-03 12:38:54 +01:00
### Installation
First, start by cloning the repository:
2015-03-07 07:20:12 +00:00
2016-08-03 12:38:54 +01:00
``` bash
git clone https://github.com/paboyle/Grid.git
```
2015-03-07 07:20:12 +00:00
2016-08-03 12:38:54 +01:00
Then enter the cloned directory and set up the build system:
``` bash
cd Grid
./bootstrap.sh
```
Now you can execute the `configure` script to generate makefiles (here from a build directory):
``` bash
mkdir build; cd build
2016-08-04 16:27:02 +01:00
../configure --enable-precision=double --enable-simd=AVX --enable-comms=mpi-auto --prefix=< path >
2016-08-03 12:38:54 +01:00
```
2016-08-04 16:27:02 +01:00
where `--enable-precision=` set the default precision (`single` or `double` ),
`--enable-simd=` set the SIMD type (see possible values below), `--enable-
comms=` set the protocol used for communications (`none`, `mpi` , `mpi-auto` or
`shmem` ), and `<path>` should be replaced by the prefix path where you want to
install Grid. The `mpi-auto` communication option set `configure` to determine
automatically how to link to MPI. Other options are available, 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.
2016-08-03 12:38:54 +01:00
Finally, you can build and install Grid:
2015-03-07 07:20:12 +00:00
2016-08-03 12:38:54 +01:00
``` bash
make; make install
```
2015-03-07 07:20:12 +00:00
2016-08-03 12:38:54 +01:00
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:
2015-05-19 05:36:03 +01:00
2016-08-03 12:38:54 +01:00
``` bash
make -C tests/< subdir > tests
```
2015-03-07 07:20:12 +00:00
2016-08-03 12:38:54 +01:00
### Possible SIMD types
2015-03-07 07:20:12 +00:00
2016-08-03 12:38:54 +01:00
The following options can be use with the `--enable-simd=` option to target different SIMD instruction sets:
2016-02-10 02:37:03 +00:00
2016-08-03 12:38:54 +01:00
| String | Description |
| ----------- | -------------------------------------- |
| `GEN` | generic portable vector code |
| `SSE4` | SSE 4.2 (128 bit) |
| `AVX` | AVX (256 bit) |
| `AVXFMA4` | AVX (256 bit) + FMA |
| `AVX2` | AVX 2 (256 bit) |
| `AVX512` | AVX 512 bit |
| `AVX512MIC` | AVX 512 bit for Intel MIC architecture |
| `ICMI` | Intel ICMI instructions (512 bit) |
2016-02-10 02:37:03 +00:00
2016-08-03 12:38:54 +01:00
Alternatively, some CPU codenames can be directly used:
2016-02-10 02:37:03 +00:00
2016-08-03 12:38:54 +01:00
| String | Description |
| ----------- | -------------------------------------- |
| `KNC` | [Intel Knights Corner ](http://ark.intel.com/products/codename/57721/Knights-Corner ) |
| `KNL` | [Intel Knights Landing ](http://ark.intel.com/products/codename/48999/Knights-Landing ) |