Skip to content

Commit c5387ee

Browse files
committed
update publi
1 parent 0c9a757 commit c5387ee

File tree

1 file changed

+124
-116
lines changed

1 file changed

+124
-116
lines changed

docs/source/pages/installation.rst

Lines changed: 124 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,67 @@
22
Installation
33
============
44

5-
Bulding and installing 2decomp-fft
6-
==================================
7-
85
Building
96
===========
107

118
The build system is driven by `cmake`. It is good practice to directly point to the MPI Fortran wrapper that you would like to use to guarantee consistency between Fortran compiler and MPI. This can be done by setting the default Fortran environmental variable
12-
```
13-
export FC=my_mpif90
14-
```
9+
10+
``export FC=my_mpif90``
11+
1512
To generate the build system run
16-
```
17-
cmake -S $path_to_sources -B $path_to_build_directory -DOPTION1 -DOPTION2 ...
18-
```
19-
If the directory does not exist it will be generated and it will contain the configuration files. The configuration can be further
20-
edited by using the `ccmake` utility as
21-
```
22-
ccmake $path_to_build_directory
23-
```
24-
and editing as desired, variables that are likely of interest are: `CMAKE_BUILD_TYPE` and `FFT_Choice`;
25-
additional variables can be shown by entering "advanced mode" by pressing `t`.
26-
By default a `RELEASE` build will built, other options for `CMAKE_BUILD_TYPE` are `DEBUG` and `DEV` which
27-
turn on debugging flags and additionally try to catch coding errors at compile time, respectively.
13+
14+
``cmake -S $path_to_sources -B $path_to_build_directory -DOPTION1 -DOPTION2 ...``
15+
16+
If the directory does not exist it will be generated and it will contain the configuration files. The configuration can be further edited by using the `ccmake` utility as
17+
18+
``ccmake $path_to_build_directory``
19+
20+
and editing as desired, variables that are likely of interest are: `CMAKE_BUILD_TYPE` and `FFT_Choice`; additional variables can be shown by entering "advanced mode" by pressing `t`.
21+
22+
By default a `RELEASE` build will built, other options for `CMAKE_BUILD_TYPE` are `DEBUG` and `DEV` which turn on debugging flags and additionally try to catch coding errors at compile time, respectively.
23+
2824
The behaviour of debug and development versions of the library can be changed before the
29-
initialization using the variable ``decomp_debug`` or the environment variable ``DECOMP_2D_DEBUG``.
30-
The value provided with the environment variable must be a positive integer below 9999.
25+
initialization using the variable ``decomp_debug`` or the environment variable ``DECOMP_2D_DEBUG``. The value provided with the environment variable must be a positive integer below 9999.
3126

3227
Two `BUILD_TARGETS` are available namely `mpi` and `gpu`. For the `mpi` target no additional options should be required. whereas for `gpu` extra options are necessary at the configure stage. Please see section [GPU Compilation](#gpu-compilation)
3328

3429
Once the build system has been configured, you can build `2decomp&fft` by running
35-
```
36-
cmake --build $path_to_build_directory -j <nproc>
37-
```
30+
31+
``cmake --build $path_to_build_directory -j <nproc>``
32+
3833
appending `-v` will display additional information about the build, such as compiler flags.
3934

4035
After building the library can be tested. Please see section [Testing and examples](#testing-and-examples)
4136

4237
Options can be added to change the level of verbosity. Finally, the build library can be installed by running
43-
```
44-
cmake --install $path_to_build_directory
45-
```
46-
The default location for `libdecomp2d.a` is `$path_to_build_directory/opt/lib`or `$path_to_build_directory/opt/lib64` unless the variable `CMAKE_INSTALL_PREFIX` is modified.
38+
39+
``cmake --install $path_to_build_directory``
40+
41+
The default location for *libdecomp2d.a* is
42+
43+
``$path_to_build_directory/opt/lib`` or
44+
45+
``$path_to_build_directory/opt/lib64``
46+
47+
unless the variable *CMAKE_INSTALL_PREFIX* is modified.
48+
4749
The module files generated by the build process will similarly be installed to `$path_to_build_directory/opt/install`, users of the library should add this to the include paths for their program.
4850

4951
As indicated above, by default a static `libdecomp2d.a` will be compiled, if desired a shared library can be built by setting `BUILD_SHARED_LIBS=ON` either on the command line:
50-
```
51-
cmake -S $path_to_sources -B $path_to_build_directory -DBUILD_SHARED_LIBS=ON
52-
```
52+
53+
::
54+
55+
cmake -S $path_to_sources -B $path_to_build_directory -DBUILD_SHARED_LIBS=ON
56+
5357
or by editing the configuration using `ccmake`.
58+
5459
This might be useful for a centralised install supporting multiple users that is upgraded over time.
5560

5661
Occasionally a clean build is required, this can be performed by running
57-
```
58-
cmake --build $path_to_build_directory --target clean
59-
```
62+
63+
::
64+
65+
cmake --build $path_to_build_directory --target clean
6066

6167
GPU compilation
6268
===============
@@ -65,22 +71,23 @@ The library can perform multi GPU offoloading using the NVHPC compiler suite for
6571
The implementation is based on CUDA-aware MPI and NVIDIA Collective Communication Library (NCCL).
6672
The FFT is based on cuFFT.
6773

68-
To properly configure for GPU build the following needs to be used
69-
```
70-
cmake -S $path_to_sources -B $path_to_build_directory -DBUILD_TARGET=gpu
71-
```
74+
To properly configure for GPU build the following needs to be used
75+
76+
``cmake -S $path_to_sources -B $path_to_build_directory -DBUILD_TARGET=gpu``
77+
7278
Note, further configuration can be performed using `ccmake`, however the initial configuration of GPU builds must include the `-DBUILD_TARGET=gpu` flag as shown above.
7379

7480
By default CUDA aware MPI will be used together with `cuFFT` for the FFT library. The configure will automatically look for the GPU architecture available on the system. If you are building on a HPC system please use a computing node for the installation. Useful variables to be added are
7581

7682
- `-DENABLE_NCCL=yes` to activate the NCCL collectives
7783
- `-DENABLE_MANAGED=yes` to activate the automatic memory management form the NVHPC compiler
78-
If you are getting the following error
79-
```
80-
-- The CUDA compiler identification is unknown
84+
85+
If you are getting the following error
86+
87+
``-- The CUDA compiler identification is unknown
8188
CMake Error at /usr/share/cmake/Modules/CMakeDetermineCUDACompiler.cmake:633 (message):
82-
Failed to detect a default CUDA architecture.
83-
```
89+
Failed to detect a default CUDA architecture.``,
90+
8491
It is possible that your default C compiler is too recent and not supported by `nvcc` . You might be able to solve the issue by adding
8592
- `-DCMAKE_CUDA_HOST_COMPILER=$supported_gcc`
8693

@@ -89,75 +96,78 @@ It is possible that your default C compiler is too recent and not supported by `
8996
Linking from external codes
9097
==============================
9198

92-
Codes using Makefiles
93-
=========================
99+
**Codes using Makefiles**
100+
94101

95102
When building a code that links 2decomp-fft using a Makefile you will need to add the include and link paths as appropriate (`inlude/` and `lib/` under the installation directory, respectively).
96-
```
97-
DECOMP_ROOT = /path/to/2decomp-fft
98-
DECOMP_BUILD_DIR = $(DECOMP_ROOT)/build
99-
DECOMP_INSTALL_DIR ?= $(DECOMP_BUILD_DIR)/opt # Use default unless set by user
100103

101-
INC += -I$(DECOMP_INSTALL_DIR)/include
104+
::
105+
106+
DECOMP_ROOT = /path/to/2decomp-fft
107+
DECOMP_BUILD_DIR = $(DECOMP_ROOT)/build
108+
DECOMP_INSTALL_DIR ?= $(DECOMP_BUILD_DIR)/opt # Use default unless set by user
102109

103-
# Users build/link targets
104-
LIBS = -L$(DECOMP_INSTALL_DIR)/lib64 -L$(DECOMP_INSTALL_DIR)/lib -ldecomp2d
110+
INC += -I$(DECOMP_INSTALL_DIR)/include
105111

106-
OBJ = my_exec.o
112+
# Users build/link targets
113+
LIBS = -L$(DECOMP_INSTALL_DIR)/lib64 -L$(DECOMP_INSTALL_DIR)/lib -ldecomp2d
107114

108-
my_exec: $(OBJ)
109-
$(F90) -o $@ $(OBJ) $(LIBS)
115+
OBJ = my_exec.o
110116

111-
```
117+
my_exec: $(OBJ)
118+
$(F90) -o $@ $(OBJ) $(LIBS)
119+
112120
In case 2decomp-fft has been compiled with an external FFT, such as FFTW3, `LIBS` should also contain the following
113-
```
114-
FFTW3_PATH=/my_path_to_FFTW/lib
115-
LIBFFT=-L$(FFTW3_PATH) -lfftw3 -lfftw3f
116-
LIBS += $(LIBFFT)
117-
```
118-
In case of 2decomp-fft compiled for GPU with NVHPC, linking against cuFFT is mandatory
119-
```
120-
LIBS += -cudalib=cufft
121-
```
122-
In case of NCCL the following is required
123-
```
124-
LIBS += -cudalib=cufft,nccl
125-
```
126-
It is also possible to drive the build and installation of 2decomp-fft from a Makefile such as in the following example code
127-
```
128-
FC = mpif90
129-
BUILD = Release
130121

131-
DECOMP_ROOT = /path/to/2decomp-fft
132-
DECOMP_BUILD_DIR = $(DECOMP_ROOT)/build
133-
DECOMP_INSTALL_DIR ?= $(DECOMP_BUILD_DIR)/opt # Use default unless set by user
122+
::
123+
124+
FFTW3_PATH=/my_path_to_FFTW/lib
125+
LIBFFT=-L$(FFTW3_PATH) -lfftw3 -lfftw3f
126+
LIBS += $(LIBFFT)
134127

135-
INC += -I$(DECOMP_INSTALL_DIR)/include
128+
In case of 2decomp-fft compiled for GPU with NVHPC, linking against cuFFT is mandatory
136129

137-
# Users build/link targets
138-
LIBS = -L$(DECOMP_INSTALL_DIR)/lib64 -L$(DECOMP_INSTALL_DIR)/lib -ldecomp2d
130+
``LIBS += -cudalib=cufft``
139131

140-
# Building libdecomp.a
141-
$(DECOMP_INSTALL_DIR)/lib/libdecomp.a:
142-
FC=$(FC) cmake -S $(DECOMP_ROOT) -B $(DECOMP_BUILD_DIR) -DCMAKE_BUILD_TYPE=$(BUILD) -DCMAKE_INSTALL_PREFIX=$(DECOMP_INSTALL_DIR)
143-
cmake --build $(DECOMP_BUILD_DIR) --target decomp2d
144-
cmake --build $(DECOMP_BUILD_DIR) --target install
132+
In case of NCCL the following is required
145133

146-
# Clean libdecomp.a
147-
clean-decomp:
148-
cmake --build $(DECOMP_BUILD_DIR) --target clean
149-
rm -f $(DECOMP_INSTALL_DIR)/lib/libdecomp.a
150-
```
134+
``LIBS += -cudalib=cufft,nccl``
151135

136+
It is also possible to drive the build and installation of 2decomp-fft from a Makefile such as in the following example code
137+
::
138+
139+
FC = mpif90
140+
BUILD = Release
141+
142+
DECOMP_ROOT = /path/to/2decomp-fft
143+
DECOMP_BUILD_DIR = $(DECOMP_ROOT)/build
144+
DECOMP_INSTALL_DIR ?= $(DECOMP_BUILD_DIR)/opt # Use default unless set by user
145+
146+
INC += -I$(DECOMP_INSTALL_DIR)/include
147+
148+
# Users build/link targets
149+
LIBS = -L$(DECOMP_INSTALL_DIR)/lib64 -L$(DECOMP_INSTALL_DIR)/lib -ldecomp2d
150+
151+
# Building libdecomp.a
152+
$(DECOMP_INSTALL_DIR)/lib/libdecomp.a:
153+
FC=$(FC) cmake -S $(DECOMP_ROOT) -B $(DECOMP_BUILD_DIR) -DCMAKE_BUILD_TYPE=$(BUILD) -DCMAKE_INSTALL_PREFIX=$(DECOMP_INSTALL_DIR)
154+
cmake --build $(DECOMP_BUILD_DIR) --target decomp2d
155+
cmake --build $(DECOMP_BUILD_DIR) --target install
156+
157+
# Clean libdecomp.a
158+
clean-decomp:
159+
cmake --build $(DECOMP_BUILD_DIR) --target clean
160+
rm -f $(DECOMP_INSTALL_DIR)/lib/libdecomp.a
161+
152162
Profiling
153163
=========
154164

155165
Profiling can be activated via `cmake` configuration, the recommended approach is to run the initial configuration as follows:
156-
```
157-
export caliper_DIR=/path/to/caliper/install/share/cmake/caliper
166+
167+
``export caliper_DIR=/path/to/caliper/install/share/cmake/caliper
158168
export CXX=mpicxx
159-
cmake -S $path_to_sources -B $path_to_build_directory -DENABLE_PROFILER=caliper
160-
```
169+
cmake -S $path_to_sources -B $path_to_build_directory -DENABLE_PROFILER=caliper``
170+
161171
where `ENABLE_PROFILER` is set to the profiling tool desired, currently supported values are: `caliper`.
162172
Note that when using `caliper` a C++ compiler is required as indicated in the above command line.
163173

@@ -167,45 +177,45 @@ Miscellaneous
167177
List of preprocessor variables
168178
==============================
169179

170-
#### DEBUG
180+
**DEBUG**
171181

172182
This variable is automatically added in debug and dev builds. Extra information is printed when it is present.
173183

174-
#### DOUBLE_PREC
184+
**DOUBLE_PREC**
175185

176186
When this variable is not present, the library uses single precision. When it is present, the library uses double precision. This preprocessor variable is driven by the CMake on/off variable `DOUBLE_PRECISION`.
177187

178-
#### SAVE_SINGLE
188+
**SAVE_SINGLE**
179189

180190
This variable is valid for double precision builds only. When it is present, snapshots are written in single precision. This preprocessor variable is driven by the CMake on/off variable `SINGLE_PRECISION_OUTPUT`.
181191

182-
#### PROFILER
192+
**PROFILER**
183193

184194
This variable is automatically added when selecting the profiler. It activates the profiling sections of the code.
185195

186-
#### EVEN
196+
**EVEN**
187197

188198
This preprocessor variable is not valid for GPU builds. It leads to padded alltoall operations. This preprocessor variable is driven by the CMake on/off variable `EVEN`.
189199

190-
#### OVERWRITE
200+
**OVERWRITE**
191201

192202
This variable leads to overwrite the input array when computing FFT. The support of this flag does not always correspond to in-place transforms, depending on the FFT backend selected, as described above. This preprocessor variable is driven by the CMake on/off variable `ENABLE_INPLACE`.
193203

194-
#### HALO_DEBUG
204+
**HALO_DEBUG**
195205

196206
This variable is used to debug the halo operations. This preprocessor variable is driven by the CMake on/off variable `HALO_DEBUG`.
197207

198-
#### _GPU
208+
**_GPU**
199209

200210
This variable is automatically added in GPU builds.
201211

202-
#### _NCCL
212+
**_NCCL**
203213

204214
This variable is valid only for GPU builds. The NVIDIA Collective Communication Library (NCCL) implements multi-GPU and multi-node communication primitives optimized for NVIDIA GPUs and Networking.
205215

206-
## Optional dependencies
216+
**Optional dependencies**
207217

208-
### FFTW
218+
**FFTW**
209219

210220
The library [fftw](http://www.fftw.org/index.html) can be used as a backend for the FFT engine. The version 3.3.10 was tested, is supported and can be downloaded [here](http://www.fftw.org/download.html). Please note that one should build fftw and decomp2d against the same compilers. For build instructions, please check [here](http://www.fftw.org/fftw3_doc/Installation-on-Unix.html). Below is a suggestion for the compilation of the library in double precision (add `--enable-single` for a single precision build):
211221

@@ -219,14 +229,13 @@ make -j check
219229
make install
220230
```
221231
Please note that the resulting build is not compatible with CMake (https://github.com/FFTW/fftw3/issues/130). As a workaround, one can open the file `/path/to/fftw3/install/lib/cmake/fftw3/FFTW3Config.cmake` and comment the line
222-
```
223-
include ("${CMAKE_CURRENT_LIST_DIR}/FFTW3LibraryDepends.cmake")
224-
```
232+
233+
``include ("${CMAKE_CURRENT_LIST_DIR}/FFTW3LibraryDepends.cmake")``
225234

226235
To build `2decomp&fft` against fftw3, one can provide the package configuration for fftw3 in the `PKG_CONFIG_PATH` environment variable, this should be found under `/path/to/fftw3/install/lib/pkgconfig`. One can also provide the option `-DFFTW_ROOT=/path/to/fftw3/install`. Then either specify on the command line when configuring the build
227-
```
228-
cmake -S . -B build -DFFT_Choice=<fftw|fftw_f03> -DFFTW_ROOT=/path/to/fftw3/install
229-
```
236+
237+
``cmake -S . -B build -DFFT_Choice=<fftw|fftw_f03> -DFFTW_ROOT=/path/to/fftw3/install``
238+
230239
or modify the build configuration using `ccmake`.
231240

232241
Note the legacy `fftw` interface lacks interface definitions and will fail when stricter compilation flags are used (e.g. when `-DCMAKE_BUILD_TYPE=Dev`) for this it is recommended to use `fftw_f03` which provides proper interfaces.
@@ -236,21 +245,20 @@ Caliper
236245

237246
The library [caliper](https://github.com/LLNL/Caliper) can be used to profile the execution of the code. The version 2.9.1 was tested and is supported, version 2.8.0 has also been tested and is still expected to work. Please note that one must build caliper and decomp2d against the same C/C++/Fortran compilers and MPI libray. For build instructions, please check [here](https://github.com/LLNL/Caliper#building-and-installing) and [here](https://software.llnl.gov/Caliper/CaliperBasics.html#build-and-install). Below is a suggestion for the compilation of the library using the GNU compilers:
238247

239-
```
240-
git clone https://github.com/LLNL/Caliper.git caliper_github
248+
``git clone https://github.com/LLNL/Caliper.git caliper_github
241249
cd caliper_github
242250
git checkout v2.9.1
243251
mkdir build && cd build
244252
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_INSTALL_PREFIX=../../caliper_build_2.9.1 -DWITH_FORTRAN=yes -DWITH_MPI=yes -DBUILD_TESTING=yes ../
245253
make -j
246254
make test
247-
make install
248-
```
255+
make install``
249256

250257
After installing Caliper ensure to set `caliper_DIR=/path/to/caliper/install/share/cmake/caliper`.
251258
Following this the `2decomp-fft` build can be configured to use Caliper profiling as
252-
```
253-
cmake -S . -B -DENABLE_PROFILER=caliper
254-
```
259+
260+
``cmake -S . -B -DENABLE_PROFILER=caliper``
261+
255262
or by modifying the configuration to set `ENABLE_PROFILER=caliper` via `ccmake`.
256263

264+

0 commit comments

Comments
 (0)