1 /* 2 * Copyright (C) by Argonne National Laboratory 3 * See COPYRIGHT in top-level directory 4 */ 5 6 #ifndef YAKSURI_CUDAI_BASE_H_INCLUDED 7 #define YAKSURI_CUDAI_BASE_H_INCLUDED 8 9 #include <stdio.h> 10 #include <stdbool.h> 11 #include <stdint.h> 12 #include <cuda_runtime_api.h> 13 14 #define YAKSURI_CUDAI_CUDA_ERR_CHECK(cerr) \ 15 do { \ 16 if (cerr != cudaSuccess) { \ 17 fprintf(stderr, "CUDA Error (%s:%s,%d): %s\n", __func__, __FILE__, __LINE__, cudaGetErrorString(cerr)); \ 18 } \ 19 } while (0) 20 21 typedef struct { 22 int ndevices; 23 cudaStream_t *stream; 24 bool **p2p; 25 } yaksuri_cudai_global_s; 26 extern yaksuri_cudai_global_s yaksuri_cudai_global; 27 28 typedef struct yaksuri_cudai_md_s { 29 union { 30 struct { 31 int count; 32 intptr_t stride; 33 struct yaksuri_cudai_md_s *child; 34 } contig; 35 struct { 36 struct yaksuri_cudai_md_s *child; 37 } resized; 38 struct { 39 int count; 40 int blocklength; 41 intptr_t stride; 42 struct yaksuri_cudai_md_s *child; 43 } hvector; 44 struct { 45 int count; 46 int blocklength; 47 intptr_t *array_of_displs; 48 struct yaksuri_cudai_md_s *child; 49 } blkhindx; 50 struct { 51 int count; 52 int *array_of_blocklengths; 53 intptr_t *array_of_displs; 54 struct yaksuri_cudai_md_s *child; 55 } hindexed; 56 } u; 57 58 uintptr_t extent; 59 uintptr_t num_elements; 60 } yaksuri_cudai_md_s; 61 62 #endif /* YAKSURI_CUDAI_BASE_H_INCLUDED */ 63