mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-27 07:29:52 +08:00
Fixed a few memory leaks in the cuda tests
This commit is contained in:
parent
bd21aba181
commit
483082ef6e
@ -56,6 +56,10 @@ void test_cuda_simple_argmax()
|
||||
|
||||
VERIFY_IS_EQUAL(out_max(Eigen::array<DenseIndex, 1>(0)), 72*53*97 - 1);
|
||||
VERIFY_IS_EQUAL(out_min(Eigen::array<DenseIndex, 1>(0)), 0);
|
||||
|
||||
cudaFree(d_in);
|
||||
cudaFree(d_out_max);
|
||||
cudaFree(d_out_min);
|
||||
}
|
||||
|
||||
template <int DataLayout>
|
||||
@ -141,6 +145,9 @@ void test_cuda_argmax_dim()
|
||||
// Expect max to be in the last index of the reduced dimension
|
||||
VERIFY_IS_EQUAL(tensor_arg.data()[n], tensor.dimension(dim) - 1);
|
||||
}
|
||||
|
||||
cudaFree(d_in);
|
||||
cudaFree(d_out);
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,6 +234,9 @@ void test_cuda_argmin_dim()
|
||||
// Expect max to be in the last index of the reduced dimension
|
||||
VERIFY_IS_EQUAL(tensor_arg.data()[n], tensor.dimension(dim) - 1);
|
||||
}
|
||||
|
||||
cudaFree(d_in);
|
||||
cudaFree(d_out);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,9 @@ static void test_full_reductions() {
|
||||
|
||||
// Check that the CPU and GPU reductions return the same result.
|
||||
VERIFY_IS_APPROX(full_redux(), full_redux_gpu());
|
||||
|
||||
gpu_device.deallocate(gpu_in_ptr);
|
||||
gpu_device.deallocate(gpu_out_ptr);
|
||||
}
|
||||
|
||||
void test_cxx11_tensor_reduction_cuda() {
|
||||
|
Loading…
Reference in New Issue
Block a user