Skip to content

Commit

Permalink
Add CUDA async memory resource as an option (#3447)
Browse files Browse the repository at this point in the history
* Add CUDA async memory resource as an option

Signed-off-by: Rong Ou <rong.ou@gmail.com>

* review feedback

Signed-off-by: Rong Ou <rong.ou@gmail.com>
  • Loading branch information
rongou authored Sep 14, 2021
1 parent b3f9773 commit aa9840e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Name | Description | Default Value
<a name="memory.gpu.maxAllocFraction"></a>spark.rapids.memory.gpu.maxAllocFraction|The fraction of total GPU memory that limits the maximum size of the RMM pool. The value must be greater than or equal to the setting for spark.rapids.memory.gpu.allocFraction. Note that this limit will be reduced by the reserve memory configured in spark.rapids.memory.gpu.reserve.|1.0
<a name="memory.gpu.minAllocFraction"></a>spark.rapids.memory.gpu.minAllocFraction|The fraction of total GPU memory that limits the minimum size of the RMM pool. The value must be less than or equal to the setting for spark.rapids.memory.gpu.allocFraction.|0.25
<a name="memory.gpu.oomDumpDir"></a>spark.rapids.memory.gpu.oomDumpDir|The path to a local directory where a heap dump will be created if the GPU encounters an unrecoverable out-of-memory (OOM) error. The filename will be of the form: "gpu-oom-<pid>.hprof" where <pid> is the process ID.|None
<a name="memory.gpu.pool"></a>spark.rapids.memory.gpu.pool|Select the RMM pooling allocator to use. Valid values are "DEFAULT", "ARENA", and "NONE". With "DEFAULT", `rmm::mr::pool_memory_resource` is used; with "ARENA", `rmm::mr::arena_memory_resource` is used. If set to "NONE", pooling is disabled and RMM just passes through to CUDA memory allocation directly. Note: "ARENA" is the recommended pool allocator if CUDF is built with Per-Thread Default Stream (PTDS), as "DEFAULT" is known to be unstable (https://github.com/NVIDIA/spark-rapids/issues/1141)|ARENA
<a name="memory.gpu.pool"></a>spark.rapids.memory.gpu.pool|Select the RMM pooling allocator to use. Valid values are "DEFAULT", "ARENA", "ASYNC", and "NONE". With "DEFAULT", the RMM pool allocator is used; with "ARENA", the RMM arena allocator is used; with "ASYNC", the new CUDA stream-ordered memory allocator in CUDA 11.2+ is used. If set to "NONE", pooling is disabled and RMM just passes through to CUDA memory allocation directly. Note: "ARENA" is the recommended pool allocator if CUDF is built with Per-Thread Default Stream (PTDS), as "DEFAULT" is known to be unstable (https://github.com/NVIDIA/spark-rapids/issues/1141)|ARENA
<a name="memory.gpu.pooling.enabled"></a>spark.rapids.memory.gpu.pooling.enabled|Should RMM act as a pooling allocator for GPU memory, or should it just pass through to CUDA memory allocation directly. DEPRECATED: please use spark.rapids.memory.gpu.pool instead.|true
<a name="memory.gpu.reserve"></a>spark.rapids.memory.gpu.reserve|The amount of GPU memory that should remain unallocated by RMM and left for system use such as memory needed for kernels, kernel launches or JIT compilation.|1073741824
<a name="memory.gpu.unspill.enabled"></a>spark.rapids.memory.gpu.unspill.enabled|When a spilled GPU buffer is needed again, should it be unspilled, or only copied back into GPU memory temporarily. Unspilling may be useful for GPU buffers that are needed frequently, for example, broadcast variables; however, it may also increase GPU memory usage|false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ object GpuDeviceManager extends Logging {
case c if "arena".equalsIgnoreCase(c) =>
features += "ARENA"
init | RmmAllocationMode.ARENA
case c if "async".equalsIgnoreCase(c) =>
features += "ASYNC"
init | RmmAllocationMode.CUDA_ASYNC
case c if "none".equalsIgnoreCase(c) =>
// Pooling is disabled.
init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,13 @@ object RapidsConf {
.createWithDefault(true)

val RMM_POOL = conf("spark.rapids.memory.gpu.pool")
.doc("Select the RMM pooling allocator to use. Valid values are \"DEFAULT\", \"ARENA\", and " +
"\"NONE\". With \"DEFAULT\", `rmm::mr::pool_memory_resource` is used; with \"ARENA\", " +
"`rmm::mr::arena_memory_resource` is used. If set to \"NONE\", pooling is disabled and RMM " +
.doc("Select the RMM pooling allocator to use. Valid values are \"DEFAULT\", \"ARENA\", " +
"\"ASYNC\", and \"NONE\". With \"DEFAULT\", the RMM pool allocator is used; with " +
"\"ARENA\", the RMM arena allocator is used; with \"ASYNC\", the new CUDA stream-ordered " +
"memory allocator in CUDA 11.2+ is used. If set to \"NONE\", pooling is disabled and RMM " +
"just passes through to CUDA memory allocation directly. Note: \"ARENA\" is the " +
"recommended pool allocator if CUDF is built with Per-Thread Default Stream (PTDS), " +
"as \"DEFAULT\" is known to be unstable (https://github.com/NVIDIA/spark-rapids/issues/1141)")
"recommended pool allocator if CUDF is built with Per-Thread Default Stream (PTDS), as " +
"\"DEFAULT\" is known to be unstable (https://github.com/NVIDIA/spark-rapids/issues/1141)")
.stringConf
.createWithDefault("ARENA")

Expand Down

0 comments on commit aa9840e

Please sign in to comment.