1
- # Memory Management in RAPIDS with RMM
1
+ # < div align = " left " >< img src = " img/rapids_logo.png " width = " 90px " /> & nbsp ; RMM: RAPIDS Memory</ div >
2
2
3
3
RAPIDS Memory Manager (RMM) is:
4
4
@@ -13,6 +13,73 @@ RMM is not:
13
13
- A replacement allocator for host memory (` malloc ` , ` new ` , ` cudaMallocHost ` ,
14
14
` cudaHostRegister ` ).
15
15
16
+ ## Install RMM
17
+
18
+ RMM currently must be built from source.
19
+
20
+ ## Building from Source
21
+
22
+ ### Get RMM Dependencies
23
+
24
+ Compiler requirements:
25
+
26
+ * ` gcc ` version 4.8 or higher recommended
27
+ * ` nvcc ` version 9.0 or higher recommended
28
+ * ` cmake ` version 3.12 or higher
29
+
30
+ CUDA/GPU requirements:
31
+
32
+ * CUDA 9.0+
33
+ * NVIDIA driver 396.44+
34
+ * Pascal architecture or better
35
+
36
+ You can obtain CUDA from [ https://developer.nvidia.com/cuda-downloads ] ( https://developer.nvidia.com/cuda-downloads )
37
+
38
+ ### Script to build RMM from source
39
+
40
+ To install RMM from source, ensure the dependencies are met and follow the steps below:
41
+
42
+ - Clone the repository and submodules
43
+ ``` bash
44
+ $ git clone --recurse-submodules https://github.com/rapidsai/rmm.git
45
+ $ cd rmm
46
+ $ export RMM_HOME=` pwd`
47
+ ```
48
+
49
+ Follow the instructions under "Create the conda development environment ` cudf_dev ` " in the [ cuDF README] ( https://github.com/rapidsai/cudf#build-from-source ) .
50
+
51
+ - Create the conda development environment ` cudf_dev `
52
+ ``` bash
53
+ # create the conda environment (assuming in base `cudf` directory)
54
+ $ conda env create --name cudf_dev --file conda/environments/dev_py35.yml
55
+ # activate the environment
56
+ $ source activate cudf_dev
57
+ ```
58
+
59
+ - Build and install ` librmm ` . CMake depends on the ` nvcc ` executable being on your path or defined in ` $CUDACXX ` .
60
+ ``` bash
61
+
62
+ $ mkdir build # make a build directory
63
+ $ cd build # enter the build directory
64
+ $ cmake .. -DCMAKE_INSTALL_PREFIX=/install/path # configure cmake ... use $CONDA_PREFIX if you're using Anaconda
65
+ $ make -j # compile the library librmm.so ... '-j' will start a parallel job using the number of physical cores available on your system
66
+ $ make install # install the library librmm.so to '/install/path'
67
+ ```
68
+
69
+ - To run tests (Optional):
70
+ ``` bash
71
+ $ make test
72
+ ```
73
+
74
+ - Build, install, and test cffi bindings:
75
+ ``` bash
76
+ $ make python_cffi # build CFFI bindings for librmm.so
77
+ $ make install_python # build & install CFFI python bindings. Depends on cffi package from PyPi or Conda
78
+ $ cd python && py.test -v # optional, run python tests on low-level python bindings
79
+ ```
80
+
81
+ Done! You are ready to develop for the RMM OSS project.
82
+
16
83
## Using RMM in C/C++ code
17
84
18
85
Using RMM in CUDA C++ code is straightforward. Include ` rmm.h ` and replace calls
@@ -46,14 +113,13 @@ The macro versions use the preprocessor to automatically specify these params.
46
113
47
114
### Using RMM with Thrust
48
115
49
- libcudf makes heavy use of Thrust. Thrust uses CUDA device memory in two
116
+ RAPIDS and other CUDA libraries make heavy use of Thrust. Thrust uses CUDA device memory in two
50
117
situations:
51
118
52
119
1 . As the backing store for ` thrust::device_vector ` , and
53
120
2 . As temporary storage inside some algorithms, such as ` thrust::sort ` .
54
121
55
- libcudf now includes a custom Thrust allocator in the file
56
- ` thrust_rmm_allocator.h ` . This defines the template class ` rmm_allocator ` , and
122
+ RMM includes a custom Thrust allocator in the file ` thrust_rmm_allocator.h ` . This defines the template class ` rmm_allocator ` , and
57
123
a custom Thrust CUDA device execution policy called ` rmm::exec_policy(stream) ` .
58
124
This instructs Thrust to use RMM for temporary memory allocation and execute on
59
125
the specified ` stream ` .
0 commit comments