mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 03:39:01 +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_max(Eigen::array<DenseIndex, 1>(0)), 72*53*97 - 1);
|
||||||
VERIFY_IS_EQUAL(out_min(Eigen::array<DenseIndex, 1>(0)), 0);
|
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>
|
template <int DataLayout>
|
||||||
@ -141,6 +145,9 @@ void test_cuda_argmax_dim()
|
|||||||
// Expect max to be in the last index of the reduced dimension
|
// Expect max to be in the last index of the reduced dimension
|
||||||
VERIFY_IS_EQUAL(tensor_arg.data()[n], tensor.dimension(dim) - 1);
|
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
|
// Expect max to be in the last index of the reduced dimension
|
||||||
VERIFY_IS_EQUAL(tensor_arg.data()[n], tensor.dimension(dim) - 1);
|
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.
|
// Check that the CPU and GPU reductions return the same result.
|
||||||
VERIFY_IS_APPROX(full_redux(), full_redux_gpu());
|
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() {
|
void test_cxx11_tensor_reduction_cuda() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user