WeichenXu123 commented on code in PR #53501:
URL: https://github.com/apache/spark/pull/53501#discussion_r2626213888
##########
python/pyspark/ml/torch/distributor.py:
##########
@@ -212,8 +212,14 @@ def _get_num_tasks(self) -> int:
task_gpu_amount = int(_get_conf(self.spark, key, "0"))
if task_gpu_amount < 1:
raise RuntimeError(f"'{key}' was unset, so gpu usage is
unavailable.")
- # TODO(SPARK-41916): Address situation when
spark.task.resource.gpu.amount > 1
- return math.ceil(self.num_processes / task_gpu_amount)
+
+ if task_gpu_amount > 1:
+ if not (self.num_processes % task_gpu_amount == 0):
+ raise RuntimeError(
+ f"TorchDistributor 'num_processes' value must be a
multiple of "
+ "'spark.task.resource.gpu.amount' value"
+ )
Review Comment:
no. previous logic also can't work with the case that `task_gpu_amount > 1`
. we don't support it before.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]