Unverified Commit 8527c587 authored by Min Xu's avatar Min Xu Committed by GitHub
Browse files

[minor] skipping one more flaky test (#932)



* skipping one more test

* formatting

* minor fix and copyright header

* comment
Co-authored-by: default avatarMin Xu <min.xu.public@gmail.com>
parent 67bf5bf8
......@@ -745,3 +745,9 @@ def get_smi_memory() -> float:
return float(toks[3])
# If the process is not in the list, we are not using the GPU.
return 0.0
def skip_a_test_if_in_CI() -> None:
"""Skip a test in circle CI"""
if os.path.exists("/home/circleci"):
pytest.skip("Sometimes a CI test failure is not reproducible locally, we skip them")
......@@ -27,6 +27,7 @@ from fairscale.utils.testing import (
dist_init,
get_cycles_per_ms,
objects_are_equal,
skip_a_test_if_in_CI,
spawn_for_all_world_sizes,
)
......@@ -480,11 +481,11 @@ class TestReduceScatterProcessGroup(DistributedTest):
return FullyShardedDataParallel(model, group, **config)
@pytest.mark.skip(reason="Disable flaky test that is not reproducible locally.")
class TestSerialization(DistributedTest):
@parameterized.expand([[False, False], [True, False], [True, True], [False, True]], name_func=rename_test)
def test_pickle(self, mixed_precision, cpu_offload):
"""Ensure that wrapped modules can be pickled/unpickled."""
skip_a_test_if_in_CI()
config = {"mixed_precision": mixed_precision, "cpu_offload": cpu_offload}
test_fn = functools.partial(self._test_pickle, config=config)
spawn_and_init(test_fn, world_sizes=[2])
......@@ -492,6 +493,7 @@ class TestSerialization(DistributedTest):
@parameterized.expand([[False, False], [True, False], [True, True], [False, True]], name_func=rename_test)
def test_multiprocessing(self, mixed_precision, cpu_offload):
"""Ensure that wrapped modules can be sent via multiprocessing."""
skip_a_test_if_in_CI()
config = {"mixed_precision": mixed_precision, "cpu_offload": cpu_offload}
test_fn = functools.partial(self._test_multiprocessing, config=config)
spawn_and_init(test_fn, world_sizes=[2])
......
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
from typing import Any, List, Tuple, Union
......@@ -13,6 +18,7 @@ import torchvision
import torchvision.transforms as transforms
from fairscale.optim.layerwise_gradient_scaler import LayerwiseGradientScaler
from fairscale.utils.testing import skip_a_test_if_in_CI
# Test: feed forward network
......@@ -198,6 +204,10 @@ def train_vision_model(model: SimpleConvNet, per_layer_scaling=False):
@pytest.mark.skipif(not torch.cuda.is_available(), reason="cuda required")
def test_vision_model() -> None:
# The os.environ below doesn't seem to be enough if the test is run on CI with many other tests together.
# see: https://app.circleci.com/pipelines/github/facebookresearch/fairscale/4086/workflows/72b1470a-55f8-4a45-afe5-04641b093bef/jobs/45179/tests#failed-test-0
# Skipping for now.
skip_a_test_if_in_CI()
# Remove randomness from various sources while testing.
torch.use_deterministic_algorithms(True) # type: ignore
# set environment variable in CircleCI for test to pass: CUBLAS_WORKSPACE_CONFIG = :4096:8
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment