Skip to content

Commit 719a2d1

Browse files
committed
deploy: b1f5bd3
0 parents  commit 719a2d1

File tree

1,958 files changed

+196109
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,958 files changed

+196109
-0
lines changed

.nojekyll

Whitespace-only changes.

docs/Developer/CMake.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Definitions
2+
3+
- Top level configuration file: CMakeLists.txt
4+
- Enable_language: enables stuff built-in to CMake
5+
- CMake documentation at (example for HDF5): https://cmake.org/cmake/help/v3.12/module/FindHDF5.html
6+
- Add_compile_definitions: preprocessor define
7+
- Include_directories: just for .h
8+
- Add_subdirectory: contain other CMakeLists.txt
9+
- Add_executable: what to generate, the main() .cpp
10+
- Target_link_libraries: indicates what needs to be linked with a target (1st arg).
11+
- Add_library: creating symbol (name for a bunch of code)
12+
- File: generates a list of files, 1st arg is name of list
13+
- List: manipulation utility
14+
- Find_package: loads a package that comes with CMake (like HDF5)
15+
16+
17+
# Current Configuration
18+
19+
20+
# Avenues for Future Enhancement
21+
22+
23+
# Hints
24+
25+
- Verbose output: https://sidvind.com/wiki/CMake/Verbose_output
26+
27+

docs/Developer/CMakeListsCuda.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
# Using CUDA and CMakeLists
3+
4+
This section contains information on a few things found to be necessary for the
5+
simulator CUDA code to build and run correctly when using CMakeLists. This is
6+
not a complete guide on using CMakeLists with CUDA.
7+
8+
## Static Libraries
9+
10+
Each library created in the CMakeLists.txt file that contains CUDA source code
11+
should be created with the STATIC keyword. More information on the difference
12+
between STATIC and SHARED type libraries can be found in the CMake documentation,
13+
and a short summary is available on the [add_library documentation page](https://cmake.org/cmake/help/latest/command/add_library.html). Libraries
14+
with no type specified will be assigned one automatically based on conditions
15+
listed in the documentation, but in the case of our simulator they can be observed
16+
as being SHARED if no type is specified.
17+
18+
If a library containing CUDA source files is created as SHARED, the linking of
19+
the corresponding CUDA device code will be done individually just before the
20+
step of linking the SHARED library it is a part of. Explicitly declaring libraries
21+
containing CUDA code as STATIC instead allows the linking of CUDA device code to
22+
be put off and done all together just before the final executable is linked and
23+
built. This change allows the linker for CUDA code to function correctly and
24+
prevents many errors that arise if the libraries are left as SHARED.
25+
26+
Example of creating a STATIC library:
27+
```add_library(Edges STATIC ${Edges_Source})```
28+
Where `${Edges_Source}` is a collection of source files
29+
30+
## Separable Compilation
31+
32+
CUDA separable compilation allows different pieces of CUDA code to be compiled
33+
into separate objects and then linked together later. More information can be
34+
found about Separate Compilation and Linking of CUDA code in this [NVIDIA developer
35+
blog post](https://developer.nvidia.com/blog/separate-compilation-linking-cuda-device-code/). This must be enabled in the CMakeLists.txt file individually for each
36+
library containing CUDA source code by setting the CUDA_SEPARABLE_COMPILATION
37+
property to ON. Information on this property can be found [here](https://cmake.org/cmake/help/latest/prop_tgt/CUDA_SEPARABLE_COMPILATION.html) in the CMake
38+
documentation.
39+
40+
It is set using the set_property command, for example like this:
41+
```set_property(TARGET Edges PROPERTY CUDA_SEPARABLE_COMPILATION ON)```
42+
Where `Edges` is a library containing CUDA source code.

0 commit comments

Comments
 (0)