1 /* ========================================================================== */ 2 /* === Include/cholmod_gpu.h ================================================ */ 3 /* ========================================================================== */ 4 5 /* ----------------------------------------------------------------------------- 6 * CHOLMOD/Include/cholmod_gpu.h. 7 * Copyright (C) 2014, Timothy A. Davis 8 * http://www.suitesparse.com 9 * -------------------------------------------------------------------------- */ 10 11 /* CHOLMOD GPU module 12 */ 13 14 #ifndef CHOLMOD_GPU_H 15 #define CHOLMOD_GPU_H 16 17 #ifdef GPU_BLAS 18 #include "omp.h" 19 #include <fenv.h> 20 #ifndef SUITESPARSE_GPU_EXTERN_ON 21 #include <cuda.h> 22 #include <cuda_runtime.h> 23 #endif 24 #endif 25 26 /* CHOLMOD_GPU_PRINTF: for printing GPU debug error messages */ 27 /* 28 #define CHOLMOD_GPU_PRINTF(args) printf args 29 */ 30 #define CHOLMOD_GPU_PRINTF(args) 31 32 /* define supernode requirements for processing on GPU */ 33 #define CHOLMOD_ND_ROW_LIMIT 256 /* required descendant rows */ 34 #define CHOLMOD_ND_COL_LIMIT 32 /* required descendnat cols */ 35 #define CHOLMOD_POTRF_LIMIT 512 /* required cols for POTRF & TRSM on GPU */ 36 37 /* # of host supernodes to perform before checking for free pinned buffers */ 38 #define CHOLMOD_GPU_SKIP 3 39 40 #define CHOLMOD_HANDLE_CUDA_ERROR(e,s) {if (e) {ERROR(CHOLMOD_GPU_PROBLEM,s);}} 41 42 typedef struct cholmod_gpu_pointers 43 { 44 double *h_Lx [CHOLMOD_HOST_SUPERNODE_BUFFERS] ; 45 double *d_Lx [CHOLMOD_DEVICE_STREAMS] ; 46 double *d_C ; 47 double *d_A [CHOLMOD_DEVICE_STREAMS] ; 48 void *d_Ls ; 49 void *d_Map ; 50 void *d_RelativeMap ; 51 52 } cholmod_gpu_pointers ; 53 54 int cholmod_gpu_memorysize /* GPU memory size available, 1 if no GPU */ 55 ( 56 size_t *total_mem, 57 size_t *available_mem, 58 cholmod_common *Common 59 ) ; 60 61 int cholmod_l_gpu_memorysize /* GPU memory size available, 1 if no GPU */ 62 ( 63 size_t *total_mem, 64 size_t *available_mem, 65 cholmod_common *Common 66 ) ; 67 68 int cholmod_gpu_probe ( cholmod_common *Common ) ; 69 int cholmod_l_gpu_probe ( cholmod_common *Common ) ; 70 71 int cholmod_gpu_deallocate ( cholmod_common *Common ) ; 72 int cholmod_l_gpu_deallocate ( cholmod_common *Common ) ; 73 74 void cholmod_gpu_end ( cholmod_common *Common ) ; 75 void cholmod_l_gpu_end ( cholmod_common *Common ) ; 76 77 int cholmod_gpu_allocate ( cholmod_common *Common ) ; 78 int cholmod_l_gpu_allocate ( cholmod_common *Common ) ; 79 80 #endif 81