tgravescs commented on a change in pull request #24615: [SPARK-27488][CORE]
Driver interface to support GPU resources
URL: https://github.com/apache/spark/pull/24615#discussion_r284740626
##########
File path: core/src/main/scala/org/apache/spark/SparkContext.scala
##########
@@ -360,6 +363,47 @@ class SparkContext(config: SparkConf) extends Logging {
Utils.setLogLevel(org.apache.log4j.Level.toLevel(upperCased))
}
+ /**
+ * Checks to see if any resources (GPU/FPGA/etc) are available to the driver
by looking
+ * at and processing the spark.driver.resource.resourceName.addresses and
+ * spark.driver.resource.resourceName.discoveryScript configs. The configs
have to be
+ * present when the driver starts, setting them after startup does not work.
+ *
+ * If any resource addresses configs were specified then assume all
resources will be specified
+ * in that way. Otherwise use the discovery scripts to find the resources.
Users should
+ * not really be setting the addresses config directly and should not be
mixing methods
+ * for different types of resources since the addresses config is meant for
Standalone mode
+ * and other cluster managers should use the discovery scripts.
+ */
+ private def setupDriverResources(): Unit = {
+ // Only call getAllWithPrefix once and filter on those since there could
be a lot of spark
+ // configs.
+ val allDriverResourceConfs =
_conf.getAllWithPrefix(SPARK_DRIVER_RESOURCE_PREFIX)
+ // allDriverResourceConfs is in the format Map("gpu.addresses" -> "1,2,3"),
+ // get just the resource name "gpu" and the addresses "1,2,3"
+ val resourcesWithAddrsInConfs = allDriverResourceConfs.filter {
+ case (rConf, _) => rConf.contains(SPARK_RESOURCE_ADDRESSES_POSTFIX)
Review comment:
just realized this was inconsistent with belo, one is contains, one with
endsWith, I'll make that consistent
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]