Fix memory_management not used in CUDA

This commit is contained in:
augustin64 2023-02-19 10:28:18 +01:00
parent 63ef37dc56
commit 2d46136609
2 changed files with 4 additions and 4 deletions

View File

@ -100,7 +100,7 @@ Memory* free_memory(void* ptr, Memory* mem) {
extern "C"
#endif
void* nalloc(size_t sz) {
#if defined(USE_CUDA) || defined(TEST_MEMORY_MANAGEMENT)
#if defined(__CUDACC__) || defined(TEST_MEMORY_MANAGEMENT)
pthread_mutex_lock(&memory_lock);
if (!memory) {
// We allocate a new memory block
@ -122,7 +122,7 @@ void* nalloc(size_t sz) {
extern "C"
#endif
void gree(void* ptr) {
#if defined(USE_CUDA) || defined(TEST_MEMORY_MANAGEMENT)
#if defined(__CUDACC__) || defined(TEST_MEMORY_MANAGEMENT)
pthread_mutex_lock(&memory_lock);
memory = free_memory(ptr, memory);
pthread_mutex_unlock(&memory_lock);

View File

@ -100,7 +100,7 @@ Memory* free_memory(void* ptr, Memory* mem) {
extern "C"
#endif
void* nalloc(size_t sz) {
#if defined(USE_CUDA) || defined(TEST_MEMORY_MANAGEMENT)
#if defined(__CUDACC__) || defined(TEST_MEMORY_MANAGEMENT)
pthread_mutex_lock(&memory_lock);
if (!memory) {
// We allocate a new memory block
@ -122,7 +122,7 @@ void* nalloc(size_t sz) {
extern "C"
#endif
void gree(void* ptr) {
#if defined(USE_CUDA) || defined(TEST_MEMORY_MANAGEMENT)
#if defined(__CUDACC__) || defined(TEST_MEMORY_MANAGEMENT)
pthread_mutex_lock(&memory_lock);
memory = free_memory(ptr, memory);
pthread_mutex_unlock(&memory_lock);