From 0c52e8a8d62f670f0c30365d76300937da83b35c Mon Sep 17 00:00:00 2001 From: RichardWooSJTU <37864677+RichardWooSJTU@users.noreply.github.com> Date: Wed, 28 Dec 2022 19:34:28 +0800 Subject: [PATCH] skip this ut when cuda < 11.2 && cuda_arch < 8 (#49313) --- .../test_fused_multi_transformer_int8_op.py | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/python/paddle/fluid/tests/unittests/test_fused_multi_transformer_int8_op.py b/python/paddle/fluid/tests/unittests/test_fused_multi_transformer_int8_op.py index d0057ac1b7..ab32d84515 100644 --- a/python/paddle/fluid/tests/unittests/test_fused_multi_transformer_int8_op.py +++ b/python/paddle/fluid/tests/unittests/test_fused_multi_transformer_int8_op.py @@ -15,8 +15,10 @@ import unittest import numpy as np +from test_sparse_attention_op import get_cuda_version import paddle +import paddle.fluid.core as core import paddle.nn.functional as F from paddle import _legacy_C_ops, tensor from paddle.fluid.framework import default_main_program @@ -128,6 +130,12 @@ def fused_multi_transformer_int8( return final_out +@unittest.skipIf( + not core.is_compiled_with_cuda() + or get_cuda_version() < 11020 + or paddle.device.cuda.get_device_capability()[0] < 8, + "FusedMultiTransformerInt8 requires CUDA >= 11.2 and CUDA_ARCH >= 8", +) class TestFusedMultiTransformerInt8Op(unittest.TestCase): def setUp(self): self.config() @@ -781,6 +789,12 @@ class TestFusedMultiTransformerInt8Op(unittest.TestCase): ) +@unittest.skipIf( + not core.is_compiled_with_cuda() + or get_cuda_version() < 11020 + or paddle.device.cuda.get_device_capability()[0] < 8, + "FusedMultiTransformerInt8 requires CUDA >= 11.2 and CUDA_ARCH >= 8", +) class TestFusedMultiTransformerInt8OpFp16(TestFusedMultiTransformerInt8Op): def config(self): super().config() @@ -788,6 +802,12 @@ class TestFusedMultiTransformerInt8OpFp16(TestFusedMultiTransformerInt8Op): self.layers = 3 # odd layers +@unittest.skipIf( + not core.is_compiled_with_cuda() + or get_cuda_version() < 11020 + or paddle.device.cuda.get_device_capability()[0] < 8, + "FusedMultiTransformerInt8 requires CUDA >= 11.2 and CUDA_ARCH >= 8", +) class TestFusedMultiTransformerInt8OpCacheKV(TestFusedMultiTransformerInt8Op): def config(self): super().config() @@ -798,6 +818,12 @@ class TestFusedMultiTransformerInt8OpCacheKV(TestFusedMultiTransformerInt8Op): self.layers = 3 # odd layers +@unittest.skipIf( + not core.is_compiled_with_cuda() + or get_cuda_version() < 11020 + or paddle.device.cuda.get_device_capability()[0] < 8, + "FusedMultiTransformerInt8 requires CUDA >= 11.2 and CUDA_ARCH >= 8", +) class TestFusedMultiTransformerInt8OpCacheKVFp16( TestFusedMultiTransformerInt8Op ): @@ -809,6 +835,12 @@ class TestFusedMultiTransformerInt8OpCacheKVFp16( self.x_type = np.float16 +@unittest.skipIf( + not core.is_compiled_with_cuda() + or get_cuda_version() < 11020 + or paddle.device.cuda.get_device_capability()[0] < 8, + "FusedMultiTransformerInt8 requires CUDA >= 11.2 and CUDA_ARCH >= 8", +) class TestFusedMultiTransformerInt8OpGenCacheKV( TestFusedMultiTransformerInt8Op ): @@ -818,6 +850,12 @@ class TestFusedMultiTransformerInt8OpGenCacheKV( self.gen_cache_kv = True +@unittest.skipIf( + not core.is_compiled_with_cuda() + or get_cuda_version() < 11020 + or paddle.device.cuda.get_device_capability()[0] < 8, + "FusedMultiTransformerInt8 requires CUDA >= 11.2 and CUDA_ARCH >= 8", +) class TestFusedMultiTransformerInt8OpGenCacheKVFp16( TestFusedMultiTransformerInt8Op ): @@ -829,6 +867,12 @@ class TestFusedMultiTransformerInt8OpGenCacheKVFp16( self.layers = 3 # odd layers +@unittest.skipIf( + not core.is_compiled_with_cuda() + or get_cuda_version() < 11020 + or paddle.device.cuda.get_device_capability()[0] < 8, + "FusedMultiTransformerInt8 requires CUDA >= 11.2 and CUDA_ARCH >= 8", +) class TestFusedMultiTransformerInt8OpPostLayerNormFp16( TestFusedMultiTransformerInt8Op ): @@ -839,6 +883,12 @@ class TestFusedMultiTransformerInt8OpPostLayerNormFp16( self.pre_layer_norm = False +@unittest.skipIf( + not core.is_compiled_with_cuda() + or get_cuda_version() < 11020 + or paddle.device.cuda.get_device_capability()[0] < 8, + "FusedMultiTransformerInt8 requires CUDA >= 11.2 and CUDA_ARCH >= 8", +) class TestFusedMultiTransformerInt8OpCacheKVPostLayerNorm( TestFusedMultiTransformerInt8Op ): @@ -851,6 +901,12 @@ class TestFusedMultiTransformerInt8OpCacheKVPostLayerNorm( self.pre_layer_norm = False +@unittest.skipIf( + not core.is_compiled_with_cuda() + or get_cuda_version() < 11020 + or paddle.device.cuda.get_device_capability()[0] < 8, + "FusedMultiTransformerInt8 requires CUDA >= 11.2 and CUDA_ARCH >= 8", +) class TestFusedMultiTransformerInt8OpCacheKVPostLayerNormFp16( TestFusedMultiTransformerInt8Op ): @@ -863,6 +919,12 @@ class TestFusedMultiTransformerInt8OpCacheKVPostLayerNormFp16( self.pre_layer_norm = False +@unittest.skipIf( + not core.is_compiled_with_cuda() + or get_cuda_version() < 11020 + or paddle.device.cuda.get_device_capability()[0] < 8, + "FusedMultiTransformerInt8 requires CUDA >= 11.2 and CUDA_ARCH >= 8", +) class TestFusedMultiTransformerInt8OpGenCacheKVPostLayerNorm( TestFusedMultiTransformerInt8Op ): @@ -873,6 +935,12 @@ class TestFusedMultiTransformerInt8OpGenCacheKVPostLayerNorm( self.pre_layer_norm = False +@unittest.skipIf( + not core.is_compiled_with_cuda() + or get_cuda_version() < 11020 + or paddle.device.cuda.get_device_capability()[0] < 8, + "FusedMultiTransformerInt8 requires CUDA >= 11.2 and CUDA_ARCH >= 8", +) class TestFusedMultiTransformerInt8OpGenCacheKVPostLayerNormFp16( TestFusedMultiTransformerInt8Op ): -- GitLab