Skip to content

Commit

Permalink
Fix allowMultipleJars recommend setting message (#9922)
Browse files Browse the repository at this point in the history
* Fix multiple jar recommend setting message

Signed-off-by: Haoyang Li <haoyangl@nvidia.com>

* verify

Signed-off-by: Haoyang Li <haoyangl@nvidia.com>

* Explain why multiple jars is bad

Signed-off-by: Haoyang Li <haoyangl@nvidia.com>

* Always is bad, and also warning it in require

Signed-off-by: Haoyang Li <haoyangl@nvidia.com>

---------

Signed-off-by: Haoyang Li <haoyangl@nvidia.com>
  • Loading branch information
thirtiseven authored Dec 5, 2023
1 parent 8fb80ff commit e83bbe3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions docs/additional-functionality/advanced_configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Name | Description | Default Value | Applicable at
<a name="shuffle.ucx.activeMessages.forceRndv"></a>spark.rapids.shuffle.ucx.activeMessages.forceRndv|Set to true to force 'rndv' mode for all UCX Active Messages. This should only be required with UCX 1.10.x. UCX 1.11.x deployments should set to false.|false|Startup
<a name="shuffle.ucx.managementServerHost"></a>spark.rapids.shuffle.ucx.managementServerHost|The host to be used to start the management server|null|Startup
<a name="shuffle.ucx.useWakeup"></a>spark.rapids.shuffle.ucx.useWakeup|When set to true, use UCX's event-based progress (epoll) in order to wake up the progress thread when needed, instead of a hot loop.|true|Startup
<a name="sql.allowMultipleJars"></a>spark.rapids.sql.allowMultipleJars|Allow multiple rapids-4-spark, spark-rapids-jni, and cudf jars on the classpath. Spark will take the first one it finds, so the version may not be expected. Possisble values are ALWAYS: allow all jars, SAME_REVISION: only allow jars with the same revision, NEVER: do not allow multiple jars at all.|SAME_REVISION|Startup
<a name="sql.castDecimalToFloat.enabled"></a>spark.rapids.sql.castDecimalToFloat.enabled|Casting from decimal to floating point types on the GPU returns results that have tiny difference compared to results returned from CPU.|true|Runtime
<a name="sql.castFloatToDecimal.enabled"></a>spark.rapids.sql.castFloatToDecimal.enabled|Casting from floating point types to decimal on the GPU returns results that have tiny difference compared to results returned from CPU.|true|Runtime
<a name="sql.castFloatToIntegralTypes.enabled"></a>spark.rapids.sql.castFloatToIntegralTypes.enabled|Casting from floating point types to integral types on the GPU supports a slightly different range of values when using Spark 3.1.0 or later. Refer to the CAST documentation for more details.|true|Runtime
Expand Down
24 changes: 14 additions & 10 deletions sql-plugin/src/main/scala/com/nvidia/spark/rapids/Plugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -147,26 +147,30 @@ object RapidsPluginUtils extends Logging {
}.mkString + "\n"
}
}.mkString
// scalastyle:off line.size.limit
lazy val msg = s"""Multiple $jarName jars found in the classpath:
|$rapidsJarsVersMsg
|Please make sure there is only one $jarName jar in the classpath.
|If it is impossible to fix the classpath you can suppress the error by setting ${RapidsConf.ALLOW_MULTIPLE_JARS.key} to SAME_REVISION or ALWAYS.
""".stripMargin
// scalastyle:on line.size.limit
lazy val msg = s"Multiple $jarName jars found in the classpath:\n$rapidsJarsVersMsg" +
s"Please make sure there is only one $jarName jar in the classpath. "

require(revisionMap.size > 0, s"Could not find any $jarName jars in the classpath")

conf.allowMultipleJars match {
case AllowMultipleJars.ALWAYS =>
if (revisionMap.size != 1 || revisionMap.values.exists(_.size != 1)) {
logWarning(msg)
}
case AllowMultipleJars.SAME_REVISION =>
require(revisionMap.size == 1, msg)
val recommended = "If it is impossible to fix the classpath you can suppress the " +
s"error by setting ${RapidsConf.ALLOW_MULTIPLE_JARS.key} to ALWAYS, but this " +
s"can cause unpredictable behavior as the plugin may pick up the wrong jar."
require(revisionMap.size == 1, msg + recommended)
if (revisionMap.values.exists(_.size != 1)) {
logWarning(msg)
logWarning(msg + recommended)
}
case AllowMultipleJars.NEVER =>
require(revisionMap.size == 1 && revisionMap.values.forall(_.size == 1), msg)
val recommended = "If it is impossible to fix the classpath you can suppress the " +
s"error by setting ${RapidsConf.ALLOW_MULTIPLE_JARS.key} to SAME_REVISION or ALWAYS." +
" But setting it to ALWAYS can cause unpredictable behavior as the plugin may pick " +
"up the wrong jar."
require(revisionMap.size == 1 && revisionMap.values.forall(_.size == 1), msg + recommended)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,6 @@ object RapidsConf {
}

val ALLOW_MULTIPLE_JARS = conf("spark.rapids.sql.allowMultipleJars")
.internal()
.startupOnly()
.doc("Allow multiple rapids-4-spark, spark-rapids-jni, and cudf jars on the classpath. " +
"Spark will take the first one it finds, so the version may not be expected. Possisble " +
Expand Down

0 comments on commit e83bbe3

Please sign in to comment.