mirror of
https://github.com/augustin64/projet-tipe
synced 2025-02-02 19:39:39 +01:00
Fix memory_management not used in CUDA
This commit is contained in:
parent
63ef37dc56
commit
2d46136609
@ -100,7 +100,7 @@ Memory* free_memory(void* ptr, Memory* mem) {
|
|||||||
extern "C"
|
extern "C"
|
||||||
#endif
|
#endif
|
||||||
void* nalloc(size_t sz) {
|
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);
|
pthread_mutex_lock(&memory_lock);
|
||||||
if (!memory) {
|
if (!memory) {
|
||||||
// We allocate a new memory block
|
// We allocate a new memory block
|
||||||
@ -122,7 +122,7 @@ void* nalloc(size_t sz) {
|
|||||||
extern "C"
|
extern "C"
|
||||||
#endif
|
#endif
|
||||||
void gree(void* ptr) {
|
void gree(void* ptr) {
|
||||||
#if defined(USE_CUDA) || defined(TEST_MEMORY_MANAGEMENT)
|
#if defined(__CUDACC__) || defined(TEST_MEMORY_MANAGEMENT)
|
||||||
pthread_mutex_lock(&memory_lock);
|
pthread_mutex_lock(&memory_lock);
|
||||||
memory = free_memory(ptr, memory);
|
memory = free_memory(ptr, memory);
|
||||||
pthread_mutex_unlock(&memory_lock);
|
pthread_mutex_unlock(&memory_lock);
|
||||||
|
@ -100,7 +100,7 @@ Memory* free_memory(void* ptr, Memory* mem) {
|
|||||||
extern "C"
|
extern "C"
|
||||||
#endif
|
#endif
|
||||||
void* nalloc(size_t sz) {
|
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);
|
pthread_mutex_lock(&memory_lock);
|
||||||
if (!memory) {
|
if (!memory) {
|
||||||
// We allocate a new memory block
|
// We allocate a new memory block
|
||||||
@ -122,7 +122,7 @@ void* nalloc(size_t sz) {
|
|||||||
extern "C"
|
extern "C"
|
||||||
#endif
|
#endif
|
||||||
void gree(void* ptr) {
|
void gree(void* ptr) {
|
||||||
#if defined(USE_CUDA) || defined(TEST_MEMORY_MANAGEMENT)
|
#if defined(__CUDACC__) || defined(TEST_MEMORY_MANAGEMENT)
|
||||||
pthread_mutex_lock(&memory_lock);
|
pthread_mutex_lock(&memory_lock);
|
||||||
memory = free_memory(ptr, memory);
|
memory = free_memory(ptr, memory);
|
||||||
pthread_mutex_unlock(&memory_lock);
|
pthread_mutex_unlock(&memory_lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user