1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-10 06:00:45 +01:00

free malloc'd memory

This commit is contained in:
dbollweg 2024-02-22 21:42:44 -05:00
parent 6f3455900e
commit 1c8b807c2e
2 changed files with 10 additions and 1 deletions

View File

@ -5,6 +5,7 @@
#include <cub/cub.cuh> #include <cub/cub.cuh>
#define gpucub cub #define gpucub cub
#define gpuMalloc cudaMalloc #define gpuMalloc cudaMalloc
#define gpuFree cudaFree
#define gpuMemcpyAsync cudaMemcpyAsync #define gpuMemcpyAsync cudaMemcpyAsync
#define gpuMemcpyDeviceToHost cudaMemcpyDeviceToHost #define gpuMemcpyDeviceToHost cudaMemcpyDeviceToHost
#define gpuMemcpyHostToDevice cudaMemcpyHostToDevice #define gpuMemcpyHostToDevice cudaMemcpyHostToDevice
@ -16,6 +17,7 @@
#include <hipcub/hipcub.hpp> #include <hipcub/hipcub.hpp>
#define gpucub hipcub #define gpucub hipcub
#define gpuMalloc hipMalloc #define gpuMalloc hipMalloc
#define gpuFree hipFree
#define gpuMemcpyAsync hipMemcpyAsync #define gpuMemcpyAsync hipMemcpyAsync
#define gpuMemcpyDeviceToHost hipMemcpyDeviceToHost #define gpuMemcpyDeviceToHost hipMemcpyDeviceToHost
#define gpuMemcpyHostToDevice hipMemcpyHostToDevice #define gpuMemcpyHostToDevice hipMemcpyHostToDevice
@ -112,6 +114,10 @@ template<class vobj> inline void sliceSumReduction_cub_small(const vobj *Data, V
//sync after copy //sync after copy
accelerator_barrier(); accelerator_barrier();
gpuFree(temp_storage_array);
gpuFree(d_out);
gpuFree(d_offsets);
} }
@ -202,6 +208,7 @@ template<class vobj> inline void sliceSumReduction_sycl(const Lattice<vobj> &Dat
lvSum[r] = mysum[0]; lvSum[r] = mysum[0];
} }
free(mysum,*theGridAccelerator);
} }
#endif #endif

View File

@ -105,6 +105,8 @@ int main (int argc, char ** argv) {
int trace_id = traceStart("sliceSum benchmark - ComplexD"); int trace_id = traceStart("sliceSum benchmark - ComplexD");
std::cout << GridLogMessage << "Testing ComplexD" << std::endl; std::cout << GridLogMessage << "Testing ComplexD" << std::endl;
std::cout << GridLogMessage << "sizeof(ComplexD) = " << sizeof(ComplexD) << std::endl;
std::cout << GridLogMessage << "sizeof(vComplexD) = " << sizeof(vComplexD) << std::endl;
for (int i = 0; i < Nd; i++) { for (int i = 0; i < Nd; i++) {
RealD t=-usecond(); RealD t=-usecond();