Fix fftshift and ifftshift memory bug.

This commit is contained in:
kradchen
2023-12-08 17:32:00 +08:00
parent 0229a132b2
commit 4eeb6c4988
2 changed files with 25 additions and 3 deletions

View File

@@ -1194,7 +1194,7 @@ void Aurora::fftshift(CudaMatrix &aMatrix){
} else {
int copySize = aMatrix.getDimSize(0) / 2 + 1;
float *data = nullptr;
cudaMalloc((void **)&data, copySize * aMatrix.getValueType());
cudaMalloc((void **)&data,copySize*sizeof(float)*aMatrix.getValueType());
memcpyColKernel<<<aMatrix.getDimSize(1), 256>>>(
aMatrix.getData(), data, copySize * aMatrix.getValueType(),
aMatrix.getDimSize(0) * aMatrix.getValueType(),
@@ -1220,7 +1220,7 @@ void Aurora::ifftshift(CudaMatrix &aMatrix){
} else {
int copySize = aMatrix.getDimSize(0) / 2 + 1;
float *data = nullptr;
cudaMalloc((void **)&data, copySize * aMatrix.getValueType());
cudaMalloc((void **)&data,copySize*sizeof(float)*aMatrix.getValueType());
memcpyColKernel<<<aMatrix.getDimSize(1), 256>>>(
aMatrix.getData()+(copySize-1)* aMatrix.getValueType(),
data, copySize * aMatrix.getValueType(),