1 // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2 // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3 // 4 // SPDX-License-Identifier: BSD-2-Clause 5 // 6 // This file is part of CEED: http://github.com/ceed 7 8 /// @file 9 /// Internal header for MAGMA backend common definitions 10 #ifndef CEED_MAGMA_COMMON_DEFS_H 11 #define CEED_MAGMA_COMMON_DEFS_H 12 13 #ifdef CEED_MAGMA_USE_HIP 14 #define MAGMA_DEVICE_SHARED(type, name) HIP_DYNAMIC_SHARED(type, name) 15 #else 16 #define MAGMA_DEVICE_SHARED(type, name) extern __shared__ type name[]; 17 #endif 18 19 typedef enum { MagmaNoTrans = 111, MagmaTrans = 112, MagmaConjTrans = 113, Magma_ConjTrans = MagmaConjTrans } magma_trans_t; 20 21 #define MAGMA_D_ZERO 0.0 22 #define MAGMA_D_ONE 1.0 23 24 #define MAGMA_CEILDIV(A, B) (((A) + (B)-1) / (B)) 25 #define MAGMA_ROUNDUP(A, B) MAGMA_CEILDIV((A), (B)) * (B) 26 #define MAGMA_MAX(A, B) ((A) > (B) ? (A) : (B)) 27 28 #define MAGMA_MAXTHREADS_1D 128 29 #define MAGMA_MAXTHREADS_2D 128 30 #define MAGMA_MAXTHREADS_3D 64 31 32 // Define macro for determining number of threads in y-direction for basis kernels 33 #define MAGMA_BASIS_NTCOL(x, maxt) (((maxt) < (x)) ? 1 : ((maxt) / (x))) 34 35 // Define macro for computing the total threads in a block for use with __launch_bounds__() 36 #define MAGMA_BASIS_BOUNDS(x, maxt) (x * MAGMA_BASIS_NTCOL(x, maxt)) 37 38 #endif // CEED_MAGMA_COMMON_DEFS_H 39