Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration to share JNI pinned pool with cuIO #10568

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023, NVIDIA CORPORATION.
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -386,6 +386,7 @@ object GpuDeviceManager extends Logging {

private def initializeOffHeapLimits(gpuId: Int, rapidsConf: Option[RapidsConf]): Unit = {
val conf = rapidsConf.getOrElse(new RapidsConf(SparkEnv.get.conf))
val setCuioDefaultResource = conf.pinnedPoolCuioDefault
val (pinnedSize, nonPinnedLimit) = if (conf.offHeapLimitEnabled) {
logWarning("OFF HEAP MEMORY LIMITS IS ENABLED. " +
"THIS IS EXPERIMENTAL FOR NOW USE WITH CAUTION")
Expand Down Expand Up @@ -448,7 +449,7 @@ object GpuDeviceManager extends Logging {
}
if (!PinnedMemoryPool.isInitialized && pinnedSize > 0) {
logInfo(s"Initializing pinned memory pool (${pinnedSize / 1024 / 1024.0} MiB)")
PinnedMemoryPool.initialize(pinnedSize, gpuId)
PinnedMemoryPool.initialize(pinnedSize, gpuId, setCuioDefaultResource)
}
// Host memory limits must be set after the pinned memory pool is initialized
HostAlloc.initialize(nonPinnedLimit)
Expand Down
10 changes: 10 additions & 0 deletions sql-plugin/src/main/scala/com/nvidia/spark/rapids/RapidsConf.scala
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,14 @@ object RapidsConf {
.bytesConf(ByteUnit.BYTE)
.createWithDefault(0)

val PINNED_POOL_SET_CUIO_DEFAULT = conf("spark.rapids.memory.pinnedPool.setCuioDefault")
.doc("If set to true, the pinned pool configured for the plugin will be shared with " +
"cuIO for small pinned allocations.")
.startupOnly()
.internal()
.booleanConf
.createWithDefault(true)

val OFF_HEAP_LIMIT_ENABLED = conf("spark.rapids.memory.host.offHeapLimit.enabled")
.doc("Should the off heap limit be enforced or not.")
.startupOnly()
Expand Down Expand Up @@ -2346,6 +2354,8 @@ class RapidsConf(conf: Map[String, String]) extends Logging {

lazy val pinnedPoolSize: Long = get(PINNED_POOL_SIZE)

lazy val pinnedPoolCuioDefault: Boolean = get(PINNED_POOL_SET_CUIO_DEFAULT)

lazy val offHeapLimitEnabled: Boolean = get(OFF_HEAP_LIMIT_ENABLED)

lazy val offHeapLimit: Option[Long] = get(OFF_HEAP_LIMIT_SIZE)
Expand Down
Loading