1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-09 23:45:36 +00: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>
#define gpucub cub
#define gpuMalloc cudaMalloc
#define gpuFree cudaFree
#define gpuMemcpyAsync cudaMemcpyAsync
#define gpuMemcpyDeviceToHost cudaMemcpyDeviceToHost
#define gpuMemcpyHostToDevice cudaMemcpyHostToDevice
@ -16,6 +17,7 @@
#include <hipcub/hipcub.hpp>
#define gpucub hipcub
#define gpuMalloc hipMalloc
#define gpuFree hipFree
#define gpuMemcpyAsync hipMemcpyAsync
#define gpuMemcpyDeviceToHost hipMemcpyDeviceToHost
#define gpuMemcpyHostToDevice hipMemcpyHostToDevice
@ -112,6 +114,10 @@ template<class vobj> inline void sliceSumReduction_cub_small(const vobj *Data, V
//sync after copy
accelerator_barrier();
gpuFree(temp_storage_array);
gpuFree(d_out);
gpuFree(d_offsets);
}
@ -201,7 +207,8 @@ template<class vobj> inline void sliceSumReduction_sycl(const Lattice<vobj> &Dat
theGridAccelerator->wait();
lvSum[r] = mysum[0];
}
free(mysum,*theGridAccelerator);
}
#endif

View File

@ -105,6 +105,8 @@ int main (int argc, char ** argv) {
int trace_id = traceStart("sliceSum benchmark - ComplexD");
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++) {
RealD t=-usecond();