WeichenXu123 commented on code in PR #40695:
URL: https://github.com/apache/spark/pull/40695#discussion_r1162182017


##########
python/pyspark/ml/torch/distributor.py:
##########
@@ -548,12 +560,23 @@ def set_torch_config(context: "BarrierTaskContext") -> 
None:
                 os.environ["NODE_RANK"] = str(context.partitionId())
                 os.environ["RANK"] = str(context.partitionId())
 
-            def set_gpus(context: "BarrierTaskContext") -> None:
-                if CUDA_VISIBLE_DEVICES in os.environ:
-                    return
+            if local_master:
+                # distributed training on a local mode spark cluster
+                def set_gpus(context: "BarrierTaskContext") -> None:
+                    if CUDA_VISIBLE_DEVICES in os.environ:
+                        return

Review Comment:
   Shall we add this checking ?



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to