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 3 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
35 changes: 31 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,33 @@ object RapidsPluginUtils extends Logging {
loadExtensions(classOf[SparkPlugin], pluginClasses)
}
}

/**
* Internal implementation to extract supported GPU architectures from properties file
* and check if current GPU architecture is supported.
*/
private def checkGpuArchitectureInternal(propName: String): Unit = {
val props = RapidsPluginUtils.loadProps(propName)
gerashegalov marked this conversation as resolved.
Show resolved Hide resolved
// supportedGpuArchsList is in the format ["70", "80", "86", ...]
val supportedGpuArchsList = Option(props.getProperty("gpu_architectures"))
.getOrElse(throw new RuntimeException(s"GPU architectures not found in $propName"))
.split("\\s+")
gerashegalov marked this conversation as resolved.
Show resolved Hide resolved
val actualGpuArch = s"${Cuda.getComputeCapabilityMajor}${Cuda.getComputeCapabilityMinor}"

if (!supportedGpuArchsList.contains(actualGpuArch)) {
throw new RuntimeException(s"GPU architecture $actualGpuArch is unsupported, " +
s"supported architectures: ${supportedGpuArchsList.mkString(", ")}")
}
}

/**
* Checks if the current GPU architecture is supported by the spark-rapids-jni
* and cuDF libraries.
*/
def checkGpuArchitecture(): Unit = {
checkGpuArchitectureInternal(JNI_PROPS_FILENAME)
checkGpuArchitectureInternal(CUDF_PROPS_FILENAME)
gerashegalov marked this conversation as resolved.
Show resolved Hide resolved
}
}

/**
Expand Down Expand Up @@ -427,10 +454,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