diff --git a/AUTOTEST/machine-lassen-cuda.sh b/AUTOTEST/machine-lassen-cuda.sh new file mode 100755 index 000000000..fc9e462e1 --- /dev/null +++ b/AUTOTEST/machine-lassen-cuda.sh @@ -0,0 +1,148 @@ +#!/bin/sh +# Copyright (c) 1998 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +testname=`basename $0 .sh` + +# Echo usage information +case $1 in + -h|-help) + cat <= CUSPARSE_NEWAPI_VERSION cusparseSpMatDescr_t hypre_CSRMatrixToCusparseSpMat(const hypre_CSRMatrix *A, HYPRE_Int offset); cusparseSpMatDescr_t hypre_CSRMatrixToCusparseSpMat_core( HYPRE_Int n, HYPRE_Int m, @@ -26,6 +27,7 @@ cusparseDnMatDescr_t hypre_VectorToCusparseDnMat_core(HYPRE_Complex *x_data, HYP HYPRE_Int ncol, HYPRE_Int order); cusparseDnMatDescr_t hypre_VectorToCusparseDnMat(const hypre_Vector *x); +#endif HYPRE_Int hypreDevice_CSRSpGemmCusparseOldAPI(HYPRE_Int m, HYPRE_Int k, HYPRE_Int n, cusparseMatDescr_t descr_A, HYPRE_Int nnzA, HYPRE_Int *d_ia, HYPRE_Int *d_ja, HYPRE_Complex *d_a, diff --git a/src/sstruct_mv/sstruct_matrix.c b/src/sstruct_mv/sstruct_matrix.c index 4a52aab04..36bfe4f5c 100644 --- a/src/sstruct_mv/sstruct_matrix.c +++ b/src/sstruct_mv/sstruct_matrix.c @@ -1132,7 +1132,6 @@ hypre_SStructUMatrixSetBoxValues( hypre_SStructMatrix *matrix, hypre_BoxGetSize(int_box, loop_size); #if defined(HYPRE_USING_GPU) - if ( hypre_GetExecPolicy1(memory_location) == HYPRE_EXEC_DEVICE ) { hypre_assert(ndim <= 3); @@ -1197,8 +1196,7 @@ hypre_SStructUMatrixSetBoxValues( hypre_SStructMatrix *matrix, #undef DEVICE_VAR #define DEVICE_VAR } - else -#endif +#else { hypre_BoxLoop2Begin(ndim, loop_size, box, start, stride, mi, @@ -1225,6 +1223,7 @@ hypre_SStructUMatrixSetBoxValues( hypre_SStructMatrix *matrix, } hypre_BoxLoop2End(mi, vi); } +#endif } /* end loop through boxman to entries */ hypre_TFree(boxman_to_entries, HYPRE_MEMORY_HOST); diff --git a/src/test/TEST_error/error.saved b/src/test/TEST_error/error.saved index 7496f6e52..f52c23609 100644 --- a/src/test/TEST_error/error.saved +++ b/src/test/TEST_error/error.saved @@ -44,15 +44,15 @@ Iters ||r||_2 conv.rate ||r||_2/||b||_2 0: hypre error in file "pcg.c", line 709, error code = 256 - Subnormal gamma value in PCG 0: hypre error in file "pcg.c", line 709, error code = 256 - Subnormal gamma value in PCG 0: hypre error in file "pcg.c", line 709, error code = 256 - Subnormal gamma value in PCG -0: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence -0: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence -0: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence -0: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence +0: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence +0: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence +0: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence +0: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence 1: hypre error in file "par_amg_solve.c", line 339, error code = 256 1: hypre error in file "pcg.c", line 709, error code = 256 - Subnormal gamma value in PCG 1: hypre error in file "pcg.c", line 709, error code = 256 - Subnormal gamma value in PCG 1: hypre error in file "pcg.c", line 709, error code = 256 - Subnormal gamma value in PCG -1: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence -1: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence -1: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence -1: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence +1: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence +1: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence +1: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence +1: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence diff --git a/src/test/TEST_error/error.saved.lassen b/src/test/TEST_error/error.saved.lassen index cf0cea1d2..31ab8bd65 100644 --- a/src/test/TEST_error/error.saved.lassen +++ b/src/test/TEST_error/error.saved.lassen @@ -42,13 +42,13 @@ Iters ||r||_2 conv.rate ||r||_2/||b||_2 2 5.536410e+01 1.000000 1.750767e+00 0: hypre error in file "par_amg_solve.c", line 339, error code = 256 0: hypre error in file "pcg.c", line 709, error code = 256 - Subnormal gamma value in PCG -0: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence -0: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence -0: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence -0: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence +0: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence +0: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence +0: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence +0: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence 1: hypre error in file "par_amg_solve.c", line 339, error code = 256 1: hypre error in file "pcg.c", line 709, error code = 256 - Subnormal gamma value in PCG -1: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence -1: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence -1: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence -1: hypre error in file "pcg.c", line 782, error code = 256 - Reached max iterations in PCG before convergence +1: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence +1: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence +1: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence +1: hypre error in file "pcg.c", line 784, error code = 256 - Reached max iterations 2 in PCG before convergence diff --git a/src/utilities/_hypre_utilities.hpp b/src/utilities/_hypre_utilities.hpp index c40db276e..7b4166ee3 100644 --- a/src/utilities/_hypre_utilities.hpp +++ b/src/utilities/_hypre_utilities.hpp @@ -112,6 +112,14 @@ using hypre_DeviceItem = void*; #define CUB_IGNORE_DEPRECATED_CPP_DIALECT #endif +#ifndef CUSPARSE_VERSION +#if defined(CUSPARSE_VER_MAJOR) && defined(CUSPARSE_VER_MINOR) && defined(CUSPARSE_VER_PATCH) +#define CUSPARSE_VERSION (CUSPARSE_VER_MAJOR * 1000 + CUSPARSE_VER_MINOR * 100 + CUSPARSE_VER_PATCH) +#else +#define CUSPARSE_VERSION CUDA_VERSION +#endif +#endif + #define CUSPARSE_NEWAPI_VERSION 11000 #define CUSPARSE_NEWSPMM_VERSION 11401 #define CUDA_MALLOCASYNC_VERSION 11020 @@ -531,6 +539,7 @@ using hypre_DeviceItem = sycl::nd_item<3>; hypre_assert(0); exit(1); \ } } while(0) +#if CUSPARSE_VERSION >= 10300 #define HYPRE_CUSPARSE_CALL(call) do { \ cusparseStatus_t err = call; \ if (CUSPARSE_STATUS_SUCCESS != err) { \ @@ -538,6 +547,15 @@ using hypre_DeviceItem = sycl::nd_item<3>; err, cusparseGetErrorString(err), __FILE__, __LINE__); \ hypre_assert(0); exit(1); \ } } while(0) +#else +#define HYPRE_CUSPARSE_CALL(call) do { \ + cusparseStatus_t err = call; \ + if (CUSPARSE_STATUS_SUCCESS != err) { \ + printf("CUSPARSE ERROR (code = %d) at %s:%d\n", \ + err, __FILE__, __LINE__); \ + hypre_assert(0); exit(1); \ + } } while(0) +#endif #define HYPRE_ROCSPARSE_CALL(call) do { \ rocsparse_status err = call; \ @@ -1901,7 +1919,9 @@ void hypre_DeviceDataCubCachingAllocatorDestroy(hypre_DeviceData *data); cudaDataType hypre_HYPREComplexToCudaDataType(); +#if CUSPARSE_VERSION >= CUSPARSE_NEWAPI_VERSION cusparseIndexType_t hypre_HYPREIntToCusparseIndexType(); +#endif #endif // #if defined(HYPRE_USING_CUSPARSE) diff --git a/src/utilities/device_utils.c b/src/utilities/device_utils.c index 4ab0ecd47..abdd94b9b 100644 --- a/src/utilities/device_utils.c +++ b/src/utilities/device_utils.c @@ -2719,6 +2719,7 @@ hypre_HYPREComplexToCudaDataType() #endif // #if defined(HYPRE_COMPLEX) } +#if CUSPARSE_VERSION >= 10300 /*-------------------------------------------------------------------- * hypre_HYPREIntToCusparseIndexType * @@ -2744,6 +2745,8 @@ hypre_HYPREIntToCusparseIndexType() return CUSPARSE_INDEX_32I; #endif } +#endif + #endif // #if defined(HYPRE_USING_CUSPARSE) #if defined(HYPRE_USING_CUBLAS) diff --git a/src/utilities/device_utils.h b/src/utilities/device_utils.h index 05a07eb1c..0e5cb7b40 100644 --- a/src/utilities/device_utils.h +++ b/src/utilities/device_utils.h @@ -60,6 +60,14 @@ using hypre_DeviceItem = void*; #define CUB_IGNORE_DEPRECATED_CPP_DIALECT #endif +#ifndef CUSPARSE_VERSION +#if defined(CUSPARSE_VER_MAJOR) && defined(CUSPARSE_VER_MINOR) && defined(CUSPARSE_VER_PATCH) +#define CUSPARSE_VERSION (CUSPARSE_VER_MAJOR * 1000 + CUSPARSE_VER_MINOR * 100 + CUSPARSE_VER_PATCH) +#else +#define CUSPARSE_VERSION CUDA_VERSION +#endif +#endif + #define CUSPARSE_NEWAPI_VERSION 11000 #define CUSPARSE_NEWSPMM_VERSION 11401 #define CUDA_MALLOCASYNC_VERSION 11020 @@ -479,6 +487,7 @@ using hypre_DeviceItem = sycl::nd_item<3>; hypre_assert(0); exit(1); \ } } while(0) +#if CUSPARSE_VERSION >= 10300 #define HYPRE_CUSPARSE_CALL(call) do { \ cusparseStatus_t err = call; \ if (CUSPARSE_STATUS_SUCCESS != err) { \ @@ -486,6 +495,15 @@ using hypre_DeviceItem = sycl::nd_item<3>; err, cusparseGetErrorString(err), __FILE__, __LINE__); \ hypre_assert(0); exit(1); \ } } while(0) +#else +#define HYPRE_CUSPARSE_CALL(call) do { \ + cusparseStatus_t err = call; \ + if (CUSPARSE_STATUS_SUCCESS != err) { \ + printf("CUSPARSE ERROR (code = %d) at %s:%d\n", \ + err, __FILE__, __LINE__); \ + hypre_assert(0); exit(1); \ + } } while(0) +#endif #define HYPRE_ROCSPARSE_CALL(call) do { \ rocsparse_status err = call; \ @@ -1849,7 +1867,9 @@ void hypre_DeviceDataCubCachingAllocatorDestroy(hypre_DeviceData *data); cudaDataType hypre_HYPREComplexToCudaDataType(); +#if CUSPARSE_VERSION >= CUSPARSE_NEWAPI_VERSION cusparseIndexType_t hypre_HYPREIntToCusparseIndexType(); +#endif #endif // #if defined(HYPRE_USING_CUSPARSE)