You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2023/01/19 19:51:20 UTC

[GitHub] [spark] rithwik-db commented on a diff in pull request #39637: [WIP][SPARK-41777][PYSPARK][ML] Integration testing for TorchDistributor

rithwik-db commented on code in PR #39637:
URL: https://github.com/apache/spark/pull/39637#discussion_r1081766800


##########
python/pyspark/ml/torch/tests/test_distributor.py:
##########
@@ -286,6 +326,23 @@ def tearDown(self) -> None:
         os.unlink(self.tempFile.name)
         self.spark.stop()
 
+    def test_dist_training_succeeds(self) -> None:
+        CUDA_VISIBLE_DEVICES = "CUDA_VISIBLE_DEVICES"
+        inputs = [
+            ("0,1,2", 2, True, "0"),
+        ]
+
+        for i, (_, num_processes, use_gpu, expected) in enumerate(inputs):
+            with self.subTest(f"subtest: {i + 1}"):
+                dist = TorchDistributor(num_processes, False, use_gpu)
+                dist._run_training_on_pytorch_file = lambda *args: os.environ.get(  # type: ignore
+                    CUDA_VISIBLE_DEVICES, "NONE"
+                )
+                self.assertEqual(
+                    expected,
+                    dist._run_distributed_training(dist._run_training_on_pytorch_file, "..."),
+                )
+

Review Comment:
   Added both in https://github.com/apache/spark/pull/39369



-- 
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-unsubscribe@spark.apache.org

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


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