2023-01-28 22:04:38 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#ifdef USE_CUDA
|
|
|
|
#include "cuda_runtime.h"
|
|
|
|
#endif
|
|
|
|
|
2022-11-11 11:20:30 +01:00
|
|
|
#ifndef DEF_UTILS_CU_H
|
|
|
|
#define DEF_UTILS_CU_H
|
|
|
|
|
|
|
|
#ifdef __CUDACC__
|
|
|
|
/* CUDA memcheck */
|
|
|
|
#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }
|
|
|
|
inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true) {
|
|
|
|
if (code != cudaSuccess) {
|
|
|
|
fprintf(stderr,"GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line);
|
|
|
|
if (abort) exit(code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Partie entière supérieure de a/b
|
|
|
|
*/
|
|
|
|
int i_div_up(int a, int b);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Vérification de la compatibilité CUDA
|
|
|
|
*/
|
|
|
|
bool check_cuda_compatibility();
|
|
|
|
|
2023-01-28 22:04:38 +01:00
|
|
|
|
|
|
|
void* nalloc(size_t sz);
|
|
|
|
|
|
|
|
void gree(void* ptr);
|
2022-11-11 11:20:30 +01:00
|
|
|
#endif
|