From dc08c18757620c5cd1c1edb849a6c99df0881ba9 Mon Sep 17 00:00:00 2001 From: Liu-xiandong <85323580+Liu-xiandong@users.noreply.github.com> Date: Tue, 2 Nov 2021 12:59:08 +0800 Subject: [PATCH] fix cusparse compile bug in CUDA11.2, test=develop (#36911) --- paddle/fluid/operators/CMakeLists.txt | 2 +- paddle/fluid/platform/dynload/cusparse.h | 4 ++-- .../fluid/tests/unittests/test_sparse_attention_op.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/paddle/fluid/operators/CMakeLists.txt b/paddle/fluid/operators/CMakeLists.txt index a9e15b5d405..958a3e9fdde 100644 --- a/paddle/fluid/operators/CMakeLists.txt +++ b/paddle/fluid/operators/CMakeLists.txt @@ -99,7 +99,7 @@ if (WITH_GPU OR WITH_ROCM) endif() op_library(sync_batch_norm_op) file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(sync_batch_norm);\n") - if ((NOT WIN32) AND (NOT WITH_ROCM) AND (NOT PADDLE_WITH_ARM) AND (NOT ${CMAKE_CUDA_COMPILER_VERSION} VERSION_LESS 11.2) ) + if ((NOT WIN32) AND (NOT WITH_ROCM) AND (NOT PADDLE_WITH_ARM) AND (NOT ${CMAKE_CUDA_COMPILER_VERSION} VERSION_LESS 11.3) ) op_library(sparse_attention_op) file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(sparse_attention);\n") endif() diff --git a/paddle/fluid/platform/dynload/cusparse.h b/paddle/fluid/platform/dynload/cusparse.h index e5be003fadf..e44e8ed0856 100644 --- a/paddle/fluid/platform/dynload/cusparse.h +++ b/paddle/fluid/platform/dynload/cusparse.h @@ -56,8 +56,8 @@ extern void *cusparse_dso_handle; CUSPARSE_ROUTINE_EACH(DECLARE_DYNAMIC_LOAD_CUSPARSE_WRAP); -// APIs available after CUDA 11.2 -#if CUDA_VERSION >= 11020 +// APIs available after CUDA 11.3 +#if CUDA_VERSION >= 11030 #define CUSPARSE_ROUTINE_EACH_R2(__macro) \ __macro(cusparseSDDMM_bufferSize); \ __macro(cusparseSDDMM_preprocess); \ diff --git a/python/paddle/fluid/tests/unittests/test_sparse_attention_op.py b/python/paddle/fluid/tests/unittests/test_sparse_attention_op.py index 5134b885f33..cce4742f164 100644 --- a/python/paddle/fluid/tests/unittests/test_sparse_attention_op.py +++ b/python/paddle/fluid/tests/unittests/test_sparse_attention_op.py @@ -128,8 +128,8 @@ def init_csr_format(batch_size, num_heads, rows, blocksize): @unittest.skipIf( - not core.is_compiled_with_cuda() or get_cuda_version() < 11020, - "core is not compiled with CUDA and cuda version need larger than or equal to 11.2" + not core.is_compiled_with_cuda() or get_cuda_version() < 11030, + "core is not compiled with CUDA and cuda version need larger than or equal to 11.3" ) class TestSparseAttentionOp(OpTest): def config(self): @@ -190,8 +190,8 @@ class TestSparseAttentionOpShapeTest(TestSparseAttentionOp): @unittest.skipIf( - not core.is_compiled_with_cuda() or get_cuda_version() < 11020, - "core is not compiled with CUDA and cuda version need larger than or equal to 11.2" + not core.is_compiled_with_cuda() or get_cuda_version() < 11030, + "core is not compiled with CUDA and cuda version need larger than or equal to 11.3" ) class TestSparseAttentionAPI(unittest.TestCase): def setUp(self): -- GitLab