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

Handle minimum GPU architecture supported [databricks] #10540

Merged
merged 14 commits into from
Mar 15, 2024
Merged
Changes from 4 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
33 changes: 29 additions & 4 deletions sql-plugin/src/main/scala/com/nvidia/spark/rapids/Plugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,31 @@ object RapidsPluginUtils extends Logging {
loadExtensions(classOf[SparkPlugin], pluginClasses)
}
}

/**
* Extracts supported GPU architectures from the given properties file
*/
private def getSupportedGpuArchitectures(propFileName: String): Set[String] = {
val props = RapidsPluginUtils.loadProps(propFileName)
Option(props.getProperty("gpu_architectures"))
.getOrElse(throw new RuntimeException(s"GPU architectures not found in $propFileName"))
.split(";")
.toSet
}

/**
* Checks if the current GPU architecture is supported by the spark-rapids-jni
* and cuDF libraries.
*/
def checkGpuArchitecture(): Unit = {
val supportedGpuArchsSet = getSupportedGpuArchitectures(JNI_PROPS_FILENAME)
.intersect(getSupportedGpuArchitectures(CUDF_PROPS_FILENAME))
val actualGpuArch = s"${Cuda.getComputeCapabilityMajor}${Cuda.getComputeCapabilityMinor}"
if (!supportedGpuArchsSet.contains(actualGpuArch)) {
throw new RuntimeException(s"GPU architecture $actualGpuArch is unsupported, " +
s"supported architectures: ${supportedGpuArchsSet.toSeq.sorted.mkString(", ")}")
}
}
}

/**
Expand Down Expand Up @@ -427,10 +452,10 @@ class RapidsExecutorPlugin extends ExecutorPlugin with Logging {
pluginContext: PluginContext,
extraConf: java.util.Map[String, String]): Unit = {
try {
if (Cuda.getComputeCapabilityMajor < 6) {
throw new RuntimeException(s"GPU compute capability ${Cuda.getComputeCapabilityMajor}" +
" is unsupported, requires 6.0+")
}
// Checks if the current GPU architecture is supported by the
// spark-rapids-jni and cuDF libraries.
RapidsPluginUtils.checkGpuArchitecture()
parthosa marked this conversation as resolved.
Show resolved Hide resolved

// if configured, re-register checking leaks hook.
reRegisterCheckLeakHook()

Expand Down
Loading