Enable CircleCI for Linux jobs (#12389)

Summary:
Changes in this PR:
1. Intermediate Docker image is shared from build stage to test stage through ECR, in order to fix the Caffe2 flaky CUDA tests.
2. There are ~7 Caffe2 operator tests that are only flaky in `caffe2_py2_gcc4_8_ubuntu14_04_test` on CPU. Disabling those tests on that config only, which is okay to do because we are still running those tests in other test jobs.

After this PR is merged, CircleCI will be running on master automatically, and will be running on PRs if the author rebased their PR onto the newest master (which we will ask all the authors to do when we switch off Jenkins for Linux).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12389

Differential Revision: D10224267

Pulled By: yf225

fbshipit-source-id: dd1a90a425c3d13b870d3d328cb301eee2e6e2cd
This commit is contained in:
Will Feng 2018-10-08 17:07:57 -07:00 committed by Facebook Github Bot
parent 5a0d2c7138
commit cdead5ace1
24 changed files with 403 additions and 345 deletions

File diff suppressed because it is too large Load Diff

View File

@ -831,7 +831,6 @@ class RecurrentNetworkParallelTest(TestCase):
return workspace.FetchBlob("{}_0/partest/i2h_w".format(model._device_prefix))
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
def test_equiv_recurrent(self):
'''
Test that the model produces exactly same results given

View File

@ -194,7 +194,6 @@ class TestOperators(hu.HypothesisTestCase):
_test_binary("Mul", ref, filter_=not_overflow, test_gradient=True)(self)
_test_binary_broadcast("Mul", ref, filter_=not_overflow)(self)
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
def test_div(self):
def ref(x, y):
return (x / y, )
@ -1825,7 +1824,6 @@ class TestOperators(hu.HypothesisTestCase):
out, = self.assertReferenceChecks(gc, op, [a], ref)
self.assertEqual(dst, out.dtype)
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@given(a=hu.tensor(),
eps=st.floats(min_value=1e-4, max_value=1e-2),
a_grad=hu.tensor(elements=st.floats(min_value=0.01, max_value=0.99)),

View File

@ -648,7 +648,6 @@ class TestCaffe2End2End(TestCase):
def test_bvlc_reference_caffenet(self):
self._test_net('bvlc_reference_caffenet')
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
def test_bvlc_reference_rcnn_ilsvrc13(self):
self._test_net('bvlc_reference_rcnn_ilsvrc13')

View File

@ -60,10 +60,6 @@ backend_test.exclude('(test_pow_bcast'
if 'JENKINS_URL' in os.environ:
backend_test.exclude(r'(test_vgg19|test_vgg)')
# FIXME: flaky test in CircleCI
if "IN_CIRCLECI" in os.environ:
backend_test.exclude(r'(test_dynamic_slice_cpu)')
# import all test cases at global scope to make them visible to python.unittest
globals().update(backend_test
.enable_report()

View File

@ -12,6 +12,7 @@ import numpy as np
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
from caffe2.python.test_util import IN_CIRCLECI_FLAKY_ENV
from caffe2.python.operator_test.adagrad_test_helper import (
ref_adagrad, adagrad_sparse_test_helper
)
@ -162,9 +163,9 @@ class TestAdagrad(serial.SerializedTestCase):
gc, op, [param_i, momentum_i, indices, grad, lr], ref_sparse
)
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
# Suppress filter_too_much health check.
# Likely caused by `assume` call falling through too often.
@unittest.skipIf(IN_CIRCLECI_FLAKY_ENV, "FIXME: flaky test in CircleCI")
@settings(suppress_health_check=[HealthCheck.filter_too_much])
@given(inputs=hu.tensors(n=2),
lr=st.floats(min_value=0.01, max_value=0.99,

View File

@ -131,7 +131,6 @@ def collect_and_distribute_fpn_rpn_ref(*inputs):
class TestCollectAndDistributeFpnRpnProposals(serial.SerializedTestCase):
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@serial.given(proposal_count=st.integers(min_value=1000, max_value=8000),
rpn_min_level=st.integers(min_value=1, max_value=4),
rpn_num_levels=st.integers(min_value=1, max_value=6),

View File

@ -434,7 +434,6 @@ class TestConvolution(serial.SerializedTestCase):
or "CUDNN_STATUS_NOT_SUPPORTED" not in es:
raise e
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@given(op_type=st.sampled_from(["Conv", "Conv2D"]),
stride=st.integers(1, 3),
pad=st.integers(0, 3),

View File

@ -7,8 +7,10 @@ from caffe2.python.model_helper import ModelHelper
import numpy as np
from scipy.misc import logsumexp
import caffe2.python.hypothesis_test_util as hu
from caffe2.python.test_util import IN_CIRCLECI_FLAKY_ENV
import hypothesis.strategies as st
from hypothesis import given
import unittest
class TestCRFOp(hu.HypothesisTestCase):
@ -56,6 +58,7 @@ class TestCRFOp(hu.HypothesisTestCase):
err_msg='CRF LOSS is not matching the reference'
)
@unittest.skipIf(IN_CIRCLECI_FLAKY_ENV, "FIXME: flaky test in CircleCI")
@given(num_tags=st.integers(1, 4),
num_words=st.integers(2, 4))
def test_crf_gradient(self, num_tags, num_words):

View File

@ -250,7 +250,6 @@ class TestCrossEntropyOps(hu.HypothesisTestCase):
output_to_grad='xentropy',
grad_reference=weighted_sigmoid_xentr_logit_grad_ref)
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@given(n=st.integers(2, 10),
b=st.integers(1, 5),
**hu.gcs_cpu_only)

View File

@ -377,7 +377,6 @@ class TestConvolution(hu.HypothesisTestCase):
# CUDNN does NOT support different padding values and we skip it
@unittest.skipIf(not workspace.has_gpu_support, "No gpu support")
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@given(stride_h=st.integers(1, 3),
stride_w=st.integers(1, 3),
pad_h=st.integers(0, 3),

View File

@ -133,7 +133,6 @@ class TestElementwiseOps(hu.HypothesisTestCase):
self.assertGradientChecks(
gc, op, [X], 0, [0], stepsize=1e-4, threshold=1e-2)
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@given(
X=hu.tensor(
elements=st.floats(0.1, 10),
@ -336,7 +335,6 @@ class TestElementwiseOps(hu.HypothesisTestCase):
self.assertDeviceChecks(dc, op, [X], [0])
self.assertGradientChecks(gc, op, [X], 0, [0])
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@given(X=hu.tensor(dtype=np.float32),
inplace=st.booleans(),
alpha=st.floats(min_value=-100.0, max_value=100.0),

View File

@ -7,9 +7,11 @@ from caffe2.proto import caffe2_pb2
from caffe2.python import core
from hypothesis import assume, given, settings, HealthCheck
import caffe2.python.hypothesis_test_util as hu
from caffe2.python.test_util import IN_CIRCLECI_FLAKY_ENV
import caffe2.python.serialized_test.serialized_test_util as serial
import hypothesis.strategies as st
import numpy as np
import unittest
class TestFcOperator(serial.SerializedTestCase):
@ -76,6 +78,7 @@ class TestFcOperator(serial.SerializedTestCase):
self.assertGradientChecks(gc, op, [X, W, b], i, [0],
threshold=threshold, stepsize=stepsize)
@unittest.skipIf(IN_CIRCLECI_FLAKY_ENV, "FIXME: flaky test in CircleCI")
@settings(max_examples=50, suppress_health_check=[HealthCheck.filter_too_much])
@serial.given(n=st.integers(1, 5),
m=st.integers(0, 5),

View File

@ -16,7 +16,6 @@ import os
class TestGroupConvolution(hu.HypothesisTestCase):
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@given(stride=st.integers(1, 3),
pad=st.integers(0, 3),
kernel=st.integers(1, 5),

View File

@ -250,7 +250,6 @@ def _prepare_gru_unit_op(gc, n, d, outputs_with_grads,
class GRUCellTest(serial.SerializedTestCase):
# Test just for GRUUnitOp
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@serial.given(
seed=st.integers(0, 2**32 - 1),
input_tensor=gru_unit_op_input(),

View File

@ -7,6 +7,7 @@ from caffe2.python import core
from hypothesis import assume, given
import caffe2.python.hypothesis_test_util as hu
from caffe2.python.test_util import IN_CIRCLECI_FLAKY_ENV
import hypothesis.strategies as st
import numpy as np
@ -114,7 +115,7 @@ class TestReduceFrontSum(hu.HypothesisTestCase):
atol=1e-4,
rtol=1e-4)
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@unittest.skipIf(IN_CIRCLECI_FLAKY_ENV, "FIXME: flaky test in CircleCI")
@given(batch_size=st.integers(1, 3),
stride=st.integers(1, 3),
pad=st.integers(0, 3),

View File

@ -52,7 +52,6 @@ class TestInstanceNorm(serial.SerializedTestCase):
for name, blob in zip(names, input_blobs):
self.ws.create_blob(name).feed(blob, device_option=device_option)
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@given(gc=hu.gcs['gc'],
dc=hu.gcs['dc'],
N=st.integers(2, 3),

View File

@ -7,6 +7,7 @@ from caffe2.python import brew, core
from caffe2.python.model_helper import ModelHelper
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
from caffe2.python.test_util import IN_CIRCLECI_FLAKY_ENV
import caffe2.python.serialized_test.serialized_test_util as serial
import numpy as np
import os
@ -14,7 +15,7 @@ import unittest
class TestLayerNormOp(serial.SerializedTestCase):
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@unittest.skipIf(IN_CIRCLECI_FLAKY_ENV, "FIXME: flaky test in CircleCI")
@serial.given(X=hu.tensors(n=1), **hu.gcs)
def test_layer_norm_grad_op(self, X, gc, dc):
X = X[0]
@ -86,7 +87,7 @@ class TestLayerNormOp(serial.SerializedTestCase):
outputs_to_check=[0],
)
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@unittest.skipIf(IN_CIRCLECI_FLAKY_ENV, "FIXME: flaky test in CircleCI")
@given(X=hu.tensors(n=1), **hu.gcs)
def test_layer_norm_op(self, X, gc, dc):
X = X[0]

View File

@ -17,7 +17,6 @@ import caffe2.python.hypothesis_test_util as hu
np.set_printoptions(precision=6)
class TestFloatToFusedRandRowwiseQuantized(hu.HypothesisTestCase):
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@given(X=hu.tensor(min_dim=2, max_dim=2,
min_value=1, max_value=17), # only matrix is supported
bitwidth_=st.sampled_from([1, 2, 4, 8]),

View File

@ -7,6 +7,7 @@ from caffe2.python import recurrent, workspace
from caffe2.python.model_helper import ModelHelper
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
from caffe2.python.test_util import IN_CIRCLECI_FLAKY_ENV
import caffe2.python.serialized_test.serialized_test_util as serial
import hypothesis.strategies as st
import numpy as np
@ -15,7 +16,7 @@ import os
import unittest
class RecurrentNetworkTest(serial.SerializedTestCase):
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@unittest.skipIf(IN_CIRCLECI_FLAKY_ENV, "FIXME: flaky test in CircleCI")
@given(T=st.integers(1, 4),
n=st.integers(1, 5),
d=st.integers(1, 5))

View File

@ -7,10 +7,12 @@ from caffe2.python import core, workspace
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
from caffe2.python.test_util import IN_CIRCLECI_FLAKY_ENV
import caffe2.python.serialized_test.serialized_test_util as serial
import hypothesis.strategies as st
import numpy as np
import itertools as it
import unittest
class TestReduceOps(serial.SerializedTestCase):
@ -55,6 +57,7 @@ class TestReduceOps(serial.SerializedTestCase):
self.run_reduce_op_test_impl(
op_name, X, axes, keepdims, ref_func, gc, dc)
@unittest.skipIf(IN_CIRCLECI_FLAKY_ENV, "FIXME: flaky test in CircleCI")
@serial.given(
X=hu.tensor(max_dim=3, dtype=np.float32), keepdims=st.booleans(),
num_axes=st.integers(1, 3), **hu.gcs)

View File

@ -188,7 +188,6 @@ class TestSequenceOps(serial.SerializedTestCase):
inputs=[data, lengths],
reference=partial(_remove_padding_ref, start_pad_width, end_pad_width))
@unittest.skipIf("IN_CIRCLECI" in os.environ, "FIXME: flaky test in CircleCI")
@serial.given(start_pad_width=st.integers(min_value=0, max_value=2),
end_pad_width=st.integers(min_value=0, max_value=2),
args=_gen_test_add_padding(with_pad_data=True),

View File

@ -8,7 +8,9 @@ import numpy as np
from caffe2.python import core, workspace
import unittest
import os
IN_CIRCLECI_FLAKY_ENV = "IN_CIRCLECI" in os.environ and "py2-gcc4.8-ubuntu14.04" in os.environ.get("BUILD_ENVIRONMENT", "")
def rand_array(*dims):
# np.random.rand() returns float instead of 0-dim array, that's why need to

View File

@ -4,6 +4,7 @@ import tempfile
import unittest
import torch
from torch import ops
from model import Model, get_custom_op_library_path
@ -11,19 +12,19 @@ from model import Model, get_custom_op_library_path
class TestCustomOperators(unittest.TestCase):
def setUp(self):
self.library_path = get_custom_op_library_path()
torch.ops.load_library(self.library_path)
ops.load_library(self.library_path)
def test_custom_library_is_loaded(self):
self.assertIn(self.library_path, torch.ops.loaded_libraries)
self.assertIn(self.library_path, ops.loaded_libraries)
def test_calling_custom_op(self):
output = torch.ops.custom.op(torch.ones(5), 2.0, 3)
output = ops.custom.op(torch.ones(5), 2.0, 3)
self.assertEqual(type(output), list)
self.assertEqual(len(output), 3)
for tensor in output:
self.assertTrue(tensor.allclose(torch.ones(5) * 2))
output = torch.ops.custom.op_with_defaults(torch.ones(5))
output = ops.custom.op_with_defaults(torch.ones(5))
self.assertEqual(type(output), list)
self.assertEqual(len(output), 1)
self.assertTrue(output[0].allclose(torch.ones(5)))