33import pytest
44import torch
55
6- from lightning .fabric .utilities .spike import _TORCHMETRICS_GREATER_EQUAL_1_0_0 , TrainingSpikeException
6+ from lightning .fabric .utilities .imports import _IS_WINDOWS , _TORCHMETRICS_GREATER_EQUAL_1_0_0
7+ from lightning .fabric .utilities .spike import TrainingSpikeException
78from lightning .pytorch import LightningModule , Trainer
89from lightning .pytorch .callbacks .spike import SpikeDetection
10+ from lightning .pytorch .utilities .imports import _TORCH_GREATER_EQUAL_2_8
911from tests_pytorch .helpers .runif import RunIf
1012
1113
@@ -47,6 +49,10 @@ def on_train_batch_end(self, trainer, pl_module, outputs, batch, batch_idx):
4749 super ().on_train_batch_end (trainer , pl_module , outputs , batch , batch_idx )
4850
4951
52+ # todo: RuntimeError: makeDeviceForHostname(): unsupported gloo device
53+ _XFAIL_GLOO_WINDOWS = pytest .mark .xfail (RuntimeError , strict = True , condition = (_IS_WINDOWS and _TORCH_GREATER_EQUAL_2_8 ))
54+
55+
5056@pytest .mark .flaky (max_runs = 3 )
5157@pytest .mark .parametrize (
5258 ("global_rank_spike" , "num_devices" , "spike_value" , "finite_only" ),
@@ -55,12 +61,12 @@ def on_train_batch_end(self, trainer, pl_module, outputs, batch, batch_idx):
5561 [
5662 pytest .param (0 , 1 , None , True ),
5763 pytest .param (0 , 1 , None , False ),
58- pytest .param (0 , 1 , float ("inf" ), True ),
59- pytest .param (0 , 1 , float ("inf" ), False ),
60- pytest .param (0 , 1 , float ("-inf" ), True ),
61- pytest .param (0 , 1 , float ("-inf" ), False ),
62- pytest .param (0 , 1 , float ("NaN" ), True ),
63- pytest .param (0 , 1 , float ("NaN" ), False ),
64+ pytest .param (0 , 1 , float ("inf" ), True , marks = _XFAIL_GLOO_WINDOWS ),
65+ pytest .param (0 , 1 , float ("inf" ), False , marks = _XFAIL_GLOO_WINDOWS ),
66+ pytest .param (0 , 1 , float ("-inf" ), True , marks = _XFAIL_GLOO_WINDOWS ),
67+ pytest .param (0 , 1 , float ("-inf" ), False , marks = _XFAIL_GLOO_WINDOWS ),
68+ pytest .param (0 , 1 , float ("NaN" ), True , marks = _XFAIL_GLOO_WINDOWS ),
69+ pytest .param (0 , 1 , float ("NaN" ), False , marks = _XFAIL_GLOO_WINDOWS ),
6470 pytest .param (0 , 2 , None , True , marks = RunIf (linux_only = True )),
6571 pytest .param (0 , 2 , None , False , marks = RunIf (linux_only = True )),
6672 pytest .param (1 , 2 , None , True , marks = RunIf (linux_only = True )),
0 commit comments