aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-01-30 11:59:22 -0800
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-01-30 11:59:22 -0800
commit483082ef6e4ff25d43cba03e1b1f2ed15000ac3b (patch)
tree1ae761ebb96414f68e019c90144c8b9afe93cf54 /unsupported
parentbd21aba1817f76f4e72ddf3c55ef23d4a62ed6f7 (diff)
Fixed a few memory leaks in the cuda tests
Diffstat (limited to 'unsupported')
-rw-r--r--unsupported/test/cxx11_tensor_argmax_cuda.cu10
-rw-r--r--unsupported/test/cxx11_tensor_reduction_cuda.cu3
2 files changed, 13 insertions, 0 deletions
diff --git a/unsupported/test/cxx11_tensor_argmax_cuda.cu b/unsupported/test/cxx11_tensor_argmax_cuda.cu
index d37490d15..48cec510d 100644
--- a/unsupported/test/cxx11_tensor_argmax_cuda.cu
+++ b/unsupported/test/cxx11_tensor_argmax_cuda.cu
@@ -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);
}
}
diff --git a/unsupported/test/cxx11_tensor_reduction_cuda.cu b/unsupported/test/cxx11_tensor_reduction_cuda.cu
index 9e06eb126..417242586 100644
--- a/unsupported/test/cxx11_tensor_reduction_cuda.cu
+++ b/unsupported/test/cxx11_tensor_reduction_cuda.cu
@@ -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() {