From fe20bb1d20861e715465d9b3c25e8766d15f545d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Tue, 11 May 2021 12:01:37 +0200 Subject: [PATCH 01/20] x --- pl_examples/bug_report_model.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pl_examples/bug_report_model.py b/pl_examples/bug_report_model.py index abb65ba86fd93..ca1ce0f3285b9 100644 --- a/pl_examples/bug_report_model.py +++ b/pl_examples/bug_report_model.py @@ -53,11 +53,9 @@ def run(): model = BoringModel() trainer = Trainer( default_root_dir=os.getcwd(), - limit_train_batches=1, - limit_val_batches=1, - num_sanity_val_steps=0, - max_epochs=1, weights_summary=None, + accelerator="ddp", + gpus=2, ) trainer.fit(model, train_dataloader=train_data, val_dataloaders=val_data) trainer.test(model, test_dataloaders=test_data) From 3af300e33e13b53f3360ceaf61264bf169f1ec42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Tue, 11 May 2021 12:07:30 +0200 Subject: [PATCH 02/20] env --- pytorch_lightning/plugins/environments/lightning_environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_lightning/plugins/environments/lightning_environment.py b/pytorch_lightning/plugins/environments/lightning_environment.py index 25da0cfb691e8..f34ce2f8314de 100644 --- a/pytorch_lightning/plugins/environments/lightning_environment.py +++ b/pytorch_lightning/plugins/environments/lightning_environment.py @@ -38,7 +38,7 @@ def __init__(self): self._world_size: int = 1 def creates_children(self) -> bool: - return False + return "LOCAL_RANK" in os.environ def master_address(self) -> str: return os.environ.get("MASTER_ADDR", "127.0.0.1") From f274da8e83c0eaea6c7b68b8e5683f7fc3828710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Tue, 11 May 2021 12:25:46 +0200 Subject: [PATCH 03/20] without subprocess --- pytorch_lightning/plugins/training_type/ddp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_lightning/plugins/training_type/ddp.py b/pytorch_lightning/plugins/training_type/ddp.py index 89e714d57f870..7380c26d5de3a 100644 --- a/pytorch_lightning/plugins/training_type/ddp.py +++ b/pytorch_lightning/plugins/training_type/ddp.py @@ -128,7 +128,7 @@ def _is_single_process_single_device(self) -> bool: def setup_environment(self): # start the other scripts - if not self.cluster_environment.creates_children() and os.environ.get("PL_IN_DDP_SUBPROCESS", "0") != "1": + if not self.cluster_environment.creates_children(): self._call_children_scripts() # set the task idx From 5ae089c55de7ee2d15f5f73547c99f79a17f6bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Tue, 11 May 2021 12:49:53 +0200 Subject: [PATCH 04/20] remove unused env settings --- pytorch_lightning/plugins/training_type/ddp.py | 1 - .../trainer/connectors/accelerator_connector.py | 5 ----- 2 files changed, 6 deletions(-) diff --git a/pytorch_lightning/plugins/training_type/ddp.py b/pytorch_lightning/plugins/training_type/ddp.py index 7380c26d5de3a..bf0a1eaa79ab0 100644 --- a/pytorch_lightning/plugins/training_type/ddp.py +++ b/pytorch_lightning/plugins/training_type/ddp.py @@ -173,7 +173,6 @@ def _call_children_scripts(self): raise MisconfigurationException("you selected (distribute_backend = ddp) but did not set Trainer(gpus=?)") os.environ["PL_TRAINER_GPUS"] = ",".join([str(device.index) for device in self.parallel_devices]) - os.environ["PL_IN_DDP_SUBPROCESS"] = "1" num_gpus = len(self.parallel_devices) os.environ["WORLD_SIZE"] = f"{num_gpus * self.num_nodes}" diff --git a/pytorch_lightning/trainer/connectors/accelerator_connector.py b/pytorch_lightning/trainer/connectors/accelerator_connector.py index 8f25458922ffe..408a83d4868cf 100644 --- a/pytorch_lightning/trainer/connectors/accelerator_connector.py +++ b/pytorch_lightning/trainer/connectors/accelerator_connector.py @@ -405,11 +405,6 @@ def select_training_type_plugin(self) -> TrainingTypePlugin: use_ddp_sharded = self._distrib_type == DistributedType.DDP_SHARDED use_ddp_sharded_spawn = self._distrib_type == DistributedType.DDP_SHARDED_SPAWN - # TODO: decouple from TE - # ddp script mode uses the same flags as TE - if os.environ.get("PL_IN_DDP_SUBPROCESS", False): - use_torchelastic_ddp = False - if use_tpu_spawn: ddp_plugin_cls = TPUSpawnPlugin elif use_ddp_sharded: From da2c8a401699a623d62856c61d37827e87835279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Tue, 11 May 2021 13:00:41 +0200 Subject: [PATCH 05/20] update docs --- .../plugins/environments/lightning_environment.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pytorch_lightning/plugins/environments/lightning_environment.py b/pytorch_lightning/plugins/environments/lightning_environment.py index f34ce2f8314de..f02a2b421ce78 100644 --- a/pytorch_lightning/plugins/environments/lightning_environment.py +++ b/pytorch_lightning/plugins/environments/lightning_environment.py @@ -23,12 +23,16 @@ class LightningEnvironment(ClusterEnvironment): """ The default environment used by Lightning for a single node or free cluster (not managed). - The master process must be launched by the user and Lightning will spawn new - worker processes for distributed training, either in a single node or across multiple nodes. + There are two modes the Lightning environment can operate with: + + 1. The user only launches the main process by :code:`python train.py ...` with no additional environment variables + set. Lightning will spawn new worker processes for distributed training in the current node. + 2. The user launches all processes manually or with utilities like :code:`torch.distributed.launch`. + The appropriate environment variables need to be set, and at minimum :code:`LOCAL_RANK`. If the master address and port are not provided, the default environment will choose them automatically. It is recommended to use this default environment for single-node distributed - training as it provides the most convenient way to launch the training script. + training as it provides a convenient way to launch the training script. """ def __init__(self): From 749d759943f47aa0c2ff677837cf18a69ab61a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Tue, 11 May 2021 13:18:43 +0200 Subject: [PATCH 06/20] update docs --- .../plugins/environments/lightning_environment.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pytorch_lightning/plugins/environments/lightning_environment.py b/pytorch_lightning/plugins/environments/lightning_environment.py index f02a2b421ce78..077ebf995eebf 100644 --- a/pytorch_lightning/plugins/environments/lightning_environment.py +++ b/pytorch_lightning/plugins/environments/lightning_environment.py @@ -42,6 +42,11 @@ def __init__(self): self._world_size: int = 1 def creates_children(self) -> bool: + """ + Returns whether the cluster creates the processes or not. + If at least :code:`LOCAL_RANK` is available as environment variable, Lightning assumes the user acts as the + process launcher/job scheduler and Lightning will not launch new processes. + """ return "LOCAL_RANK" in os.environ def master_address(self) -> str: From f112c6e167437de41e211958f700ed80694a7218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Tue, 11 May 2021 13:34:41 +0200 Subject: [PATCH 07/20] set random port --- tests/plugins/test_sharded_plugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/plugins/test_sharded_plugin.py b/tests/plugins/test_sharded_plugin.py index 7ab49e6826d58..27daaa6b4c1e5 100644 --- a/tests/plugins/test_sharded_plugin.py +++ b/tests/plugins/test_sharded_plugin.py @@ -10,6 +10,7 @@ from pytorch_lightning.utilities.exceptions import MisconfigurationException from tests.helpers.boring_model import BoringModel from tests.helpers.runif import RunIf +from tests.helpers.utils import set_random_master_port @pytest.mark.parametrize("clip_val", [0, 10]) @@ -299,6 +300,7 @@ def training_step(self, batch, batch_idx): @RunIf(skip_windows=True, special=True, fairscale=True, min_gpus=2) @pytest.mark.parametrize("accelerator", ["ddp_sharded", "ddp_sharded_spawn"]) def test_ddp_sharded_plugin_manual_optimization(tmpdir, accelerator): + set_random_master_port() model = ManualBoringModel() trainer = Trainer( default_root_dir=tmpdir, From a11c1d9da1130b2025a2064c144a405e8651993e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Wed, 7 Jul 2021 01:28:11 +0200 Subject: [PATCH 08/20] reset debug script --- pl_examples/bug_report_model.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pl_examples/bug_report_model.py b/pl_examples/bug_report_model.py index ae149510f3e44..f906ab9bde77c 100644 --- a/pl_examples/bug_report_model.py +++ b/pl_examples/bug_report_model.py @@ -53,9 +53,11 @@ def run(): model = BoringModel() trainer = Trainer( default_root_dir=os.getcwd(), + limit_train_batches=1, + limit_val_batches=1, + num_sanity_val_steps=0, + max_epochs=1, weights_summary=None, - accelerator="ddp", - gpus=2, ) trainer.fit(model, train_dataloaders=train_data, val_dataloaders=val_data) trainer.test(model, dataloaders=test_data) From cddbeb3329a293980a1168c1f612be6d344432f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Wed, 7 Jul 2021 01:28:52 +0200 Subject: [PATCH 09/20] reset test file --- tests/plugins/test_sharded_plugin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/plugins/test_sharded_plugin.py b/tests/plugins/test_sharded_plugin.py index 7daf34b8310df..543c3c8ae3382 100644 --- a/tests/plugins/test_sharded_plugin.py +++ b/tests/plugins/test_sharded_plugin.py @@ -10,7 +10,6 @@ from pytorch_lightning.utilities.exceptions import MisconfigurationException from tests.helpers.boring_model import BoringModel from tests.helpers.runif import RunIf -from tests.helpers.utils import set_random_master_port @pytest.mark.parametrize("clip_val", [0, 10]) From bdebd73520159cdb23c22cc24e21d6d2bf3dde58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Wed, 7 Jul 2021 02:12:23 +0200 Subject: [PATCH 10/20] changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a32265dbe55f3..fe129eaf36190 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -134,6 +134,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Added `restore` function and `restarting` attribute to base `Loop` ([#8247](https://github.com/PyTorchLightning/pytorch-lightning/pull/8247)) +- Enabled traditional/manual launching of DDP processes through `LOCAL_RANK` and `NODE_RANK` environment variable assignments ([#7480](https://github.com/PyTorchLightning/pytorch-lightning/pull/7480)) + + ### Changed From be16c43cbd2a1b3adb52d48ae374a13d0685f357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Wed, 7 Jul 2021 02:13:22 +0200 Subject: [PATCH 11/20] remove unused env variable --- pytorch_lightning/plugins/training_type/ddp.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pytorch_lightning/plugins/training_type/ddp.py b/pytorch_lightning/plugins/training_type/ddp.py index 9314ec65edb3a..fd30e2329669a 100644 --- a/pytorch_lightning/plugins/training_type/ddp.py +++ b/pytorch_lightning/plugins/training_type/ddp.py @@ -209,7 +209,6 @@ def _call_children_scripts(self): if self.parallel_devices is None: raise MisconfigurationException("you selected (distribute_backend = ddp) but did not set Trainer(gpus=?)") - os.environ["PL_IN_DDP_SUBPROCESS"] = "1" os.environ["WORLD_SIZE"] = f"{self.num_processes * self.num_nodes}" self.interactive_ddp_procs = [] From 773ab84768bbfd721cabd6bd696ada3f137ad942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Wed, 7 Jul 2021 10:52:17 +0200 Subject: [PATCH 12/20] add test --- .../environments/test_lightning_environment.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/plugins/environments/test_lightning_environment.py b/tests/plugins/environments/test_lightning_environment.py index 8ebcec953fcc8..091cd9a43e6e3 100644 --- a/tests/plugins/environments/test_lightning_environment.py +++ b/tests/plugins/environments/test_lightning_environment.py @@ -1,6 +1,8 @@ import os from unittest import mock +import pytest + from pytorch_lightning.plugins.environments import LightningEnvironment @@ -37,6 +39,18 @@ def test_attributes_from_environment_variables(): assert env.world_size() == 100 +@pytest.mark.parametrize("environ, creates_children", [ + ({}, False), + ({"LOCAL_RANK": "2"}, True), + ({"NODE_RANK": "1"}, False), +]) +def test_manual_user_launch(environ, creates_children): + """ Test that the environment switches to manual user mode when LOCAL_RANK env variable detected. """ + with mock.patch.dict(os.environ, environ): + env = LightningEnvironment() + assert env.creates_children() == creates_children + + @mock.patch.dict(os.environ, { "GROUP_RANK": "1", }) From 1b62fb3e9cb83fb64b73a5dd8f15a6e44cd2d75a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 7 Jul 2021 08:53:33 +0000 Subject: [PATCH 13/20] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../environments/test_lightning_environment.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/plugins/environments/test_lightning_environment.py b/tests/plugins/environments/test_lightning_environment.py index 091cd9a43e6e3..90c7403f1fe60 100644 --- a/tests/plugins/environments/test_lightning_environment.py +++ b/tests/plugins/environments/test_lightning_environment.py @@ -39,11 +39,17 @@ def test_attributes_from_environment_variables(): assert env.world_size() == 100 -@pytest.mark.parametrize("environ, creates_children", [ - ({}, False), - ({"LOCAL_RANK": "2"}, True), - ({"NODE_RANK": "1"}, False), -]) +@pytest.mark.parametrize( + "environ, creates_children", [ + ({}, False), + ({ + "LOCAL_RANK": "2" + }, True), + ({ + "NODE_RANK": "1" + }, False), + ] +) def test_manual_user_launch(environ, creates_children): """ Test that the environment switches to manual user mode when LOCAL_RANK env variable detected. """ with mock.patch.dict(os.environ, environ): From bda64f6d496bb07a85eaf4ddb0264796199ef2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Wed, 7 Jul 2021 23:18:44 +0200 Subject: [PATCH 14/20] add special test --- tests/special_tests.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/special_tests.sh b/tests/special_tests.sh index 95311fb2df515..87363c0a13f34 100755 --- a/tests/special_tests.sh +++ b/tests/special_tests.sh @@ -32,6 +32,13 @@ linenos_arr=($linenos) blocklist='test_pytorch_profiler_nested_emit_nvtx' report='' + +# test that a user can manually launch individual processes +args="--trainer.gpus 2 --trainer.accelerator ddp --trainer.max_epochs=1 --data.batch_size=32 --trainer.limit_train_batches=2 --trainer.limit_val_batches=2" +MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=1 python pl_examples/basic_examples/simple_image_classifier.py ${args} & +MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=0 python pl_examples/basic_examples/simple_image_classifier.py ${args} + + for i in "${!files_arr[@]}"; do file=${files_arr[$i]} lineno=${linenos_arr[$i]} @@ -78,6 +85,8 @@ if [ $? -eq 0 ]; then report+="Ran\ttests/utilities/test_warnings.py\n" fi + + # echo test report printf '=%.s' {1..80} printf "\n$report" From 481d6da1dd007eeffad4f4e74004f9c064040214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Wed, 7 Jul 2021 23:20:04 +0200 Subject: [PATCH 15/20] move special test --- tests/special_tests.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/special_tests.sh b/tests/special_tests.sh index 87363c0a13f34..202f81353bf8b 100755 --- a/tests/special_tests.sh +++ b/tests/special_tests.sh @@ -33,12 +33,6 @@ blocklist='test_pytorch_profiler_nested_emit_nvtx' report='' -# test that a user can manually launch individual processes -args="--trainer.gpus 2 --trainer.accelerator ddp --trainer.max_epochs=1 --data.batch_size=32 --trainer.limit_train_batches=2 --trainer.limit_val_batches=2" -MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=1 python pl_examples/basic_examples/simple_image_classifier.py ${args} & -MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=0 python pl_examples/basic_examples/simple_image_classifier.py ${args} - - for i in "${!files_arr[@]}"; do file=${files_arr[$i]} lineno=${linenos_arr[$i]} @@ -85,7 +79,10 @@ if [ $? -eq 0 ]; then report+="Ran\ttests/utilities/test_warnings.py\n" fi - +# test that a user can manually launch individual processes +args="--trainer.gpus 2 --trainer.accelerator ddp --trainer.max_epochs=1 --data.batch_size=32 --trainer.limit_train_batches=2 --trainer.limit_val_batches=2" +MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=1 python pl_examples/basic_examples/simple_image_classifier.py ${args} & +MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=0 python pl_examples/basic_examples/simple_image_classifier.py ${args} # echo test report printf '=%.s' {1..80} From c8cc75848b20974c94aba235a493b06c64d62646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Wed, 7 Jul 2021 23:22:37 +0200 Subject: [PATCH 16/20] update special test --- tests/special_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/special_tests.sh b/tests/special_tests.sh index 202f81353bf8b..a9564f510b72b 100755 --- a/tests/special_tests.sh +++ b/tests/special_tests.sh @@ -32,7 +32,6 @@ linenos_arr=($linenos) blocklist='test_pytorch_profiler_nested_emit_nvtx' report='' - for i in "${!files_arr[@]}"; do file=${files_arr[$i]} lineno=${linenos_arr[$i]} @@ -83,6 +82,7 @@ fi args="--trainer.gpus 2 --trainer.accelerator ddp --trainer.max_epochs=1 --data.batch_size=32 --trainer.limit_train_batches=2 --trainer.limit_val_batches=2" MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=1 python pl_examples/basic_examples/simple_image_classifier.py ${args} & MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=0 python pl_examples/basic_examples/simple_image_classifier.py ${args} +report+="Ran manual ddp launch test\n" # echo test report printf '=%.s' {1..80} From 49493b9e05d118d4e69ce69448746376c310a4b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Thu, 8 Jul 2021 00:30:15 +0200 Subject: [PATCH 17/20] add tab to report print --- tests/special_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/special_tests.sh b/tests/special_tests.sh index a9564f510b72b..2786f30bf4ab9 100755 --- a/tests/special_tests.sh +++ b/tests/special_tests.sh @@ -82,7 +82,7 @@ fi args="--trainer.gpus 2 --trainer.accelerator ddp --trainer.max_epochs=1 --data.batch_size=32 --trainer.limit_train_batches=2 --trainer.limit_val_batches=2" MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=1 python pl_examples/basic_examples/simple_image_classifier.py ${args} & MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=0 python pl_examples/basic_examples/simple_image_classifier.py ${args} -report+="Ran manual ddp launch test\n" +report+="Ran\tmanual ddp launch test\n" # echo test report printf '=%.s' {1..80} From 90efdb5bb0f52f10e6124a97324430028e2963b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Thu, 8 Jul 2021 01:28:40 +0200 Subject: [PATCH 18/20] choose fast_dev_run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Carlos MocholĂ­ --- tests/special_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/special_tests.sh b/tests/special_tests.sh index 2786f30bf4ab9..7baef7ee5ffa6 100755 --- a/tests/special_tests.sh +++ b/tests/special_tests.sh @@ -79,7 +79,7 @@ if [ $? -eq 0 ]; then fi # test that a user can manually launch individual processes -args="--trainer.gpus 2 --trainer.accelerator ddp --trainer.max_epochs=1 --data.batch_size=32 --trainer.limit_train_batches=2 --trainer.limit_val_batches=2" +args="--trainer.gpus 2 --trainer.accelerator ddp --trainer.fast_dev_run=True MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=1 python pl_examples/basic_examples/simple_image_classifier.py ${args} & MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=0 python pl_examples/basic_examples/simple_image_classifier.py ${args} report+="Ran\tmanual ddp launch test\n" From 565296a98b7e1f776334390c04302b8ecf2b7203 Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Fri, 9 Jul 2021 13:40:12 +0200 Subject: [PATCH 19/20] fmt --- tests/plugins/environments/test_lightning_environment.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/plugins/environments/test_lightning_environment.py b/tests/plugins/environments/test_lightning_environment.py index 90c7403f1fe60..3d672ba3dd73b 100644 --- a/tests/plugins/environments/test_lightning_environment.py +++ b/tests/plugins/environments/test_lightning_environment.py @@ -42,12 +42,8 @@ def test_attributes_from_environment_variables(): @pytest.mark.parametrize( "environ, creates_children", [ ({}, False), - ({ - "LOCAL_RANK": "2" - }, True), - ({ - "NODE_RANK": "1" - }, False), + (dict(LOCAL_RANK="2"), True), + (dict(NODE_RANK="1"), False), ] ) def test_manual_user_launch(environ, creates_children): From bb5964f263448cd00c9eac8967815bb61d147f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Wed, 14 Jul 2021 12:33:32 +0200 Subject: [PATCH 20/20] fix typo --- tests/special_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/special_tests.sh b/tests/special_tests.sh index 7baef7ee5ffa6..96d1e3ba4affb 100755 --- a/tests/special_tests.sh +++ b/tests/special_tests.sh @@ -79,7 +79,7 @@ if [ $? -eq 0 ]; then fi # test that a user can manually launch individual processes -args="--trainer.gpus 2 --trainer.accelerator ddp --trainer.fast_dev_run=True +args="--trainer.gpus 2 --trainer.accelerator ddp --trainer.fast_dev_run 1" MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=1 python pl_examples/basic_examples/simple_image_classifier.py ${args} & MASTER_ADDR="localhost" MASTER_PORT=1234 LOCAL_RANK=0 python pl_examples/basic_examples/simple_image_classifier.py ${args} report+="Ran\tmanual ddp launch test\n"