From 3f6ebb1238e5f2161e392e3825a8bd3a64a290d9 Mon Sep 17 00:00:00 2001 From: Moritz Blumenthal Date: Sun, 18 Sep 2022 20:30:42 +0200 Subject: [PATCH] let utestgpu init gpu --- utests/test_cuda_convcorr.c | 13 +++++++++++++ utests/test_cuda_flpmath.c | 4 ++++ utests/test_cuda_gpukrnls.c | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/utests/test_cuda_convcorr.c b/utests/test_cuda_convcorr.c index 32af96ec2..37ecccd42 100644 --- a/utests/test_cuda_convcorr.c +++ b/utests/test_cuda_convcorr.c @@ -2,6 +2,7 @@ #include "num/flpmath.h" #include "num/multind.h" #include "num/convcorr.h" +#include "num/init.h" #include "utest.h" @@ -13,6 +14,8 @@ int cudnn = 0; static bool test_convcorr_cf_1D(void) { + num_init_gpu(); + enum {N = 6}; long odims[N] = {2, 1, 3, 1, 1, 4}; long idims[N] = {1, 5, 5, 1, 1, 4}; @@ -48,6 +51,8 @@ UT_GPU_REGISTER_TEST(test_convcorr_cf_1D); static bool test_convcorr_cf_2D(void) { + num_init_gpu(); + enum {N = 6}; long odims[N] = {2, 1, 3, 2, 1, 4}; long idims[N] = {1, 5, 5, 5, 1, 4}; @@ -83,6 +88,8 @@ UT_GPU_REGISTER_TEST(test_convcorr_cf_2D); static bool test_convcorr_cf_3D(void) { + num_init_gpu(); + enum {N = 6}; long odims[N] = {2, 1, 3, 2, 1, 4}; long idims[N] = {1, 5, 5, 5, 4, 4}; @@ -118,6 +125,8 @@ UT_GPU_REGISTER_TEST(test_convcorr_cf_3D); static bool test_convcorr_rand_ord(void) { + num_init_gpu(); + enum {N = 6}; long odims[N] = {2, 4, 3, 1, 2, 1}; long idims[N] = {1, 4, 5, 5, 5, 4}; @@ -154,6 +163,8 @@ UT_GPU_REGISTER_TEST(test_convcorr_rand_ord); static bool test_convcorr_cf_one_channel(void) { + num_init_gpu(); + enum {N = 6}; long odims[N] = {2, 1, 3, 2, 1, 4}; long idims[N] = {1, 1, 5, 5, 4, 4}; @@ -191,6 +202,8 @@ UT_GPU_REGISTER_TEST(test_convcorr_cf_one_channel); static bool test_convcorr_cf_dil_strs(void) { + num_init_gpu(); + enum {N = 6}; long odims[N] = {2, 1, 3, 3, 1, 4}; long idims[N] = {1, 5, 5, 7, 4, 4}; diff --git a/utests/test_cuda_flpmath.c b/utests/test_cuda_flpmath.c index 199efa458..13aa9ae8e 100644 --- a/utests/test_cuda_flpmath.c +++ b/utests/test_cuda_flpmath.c @@ -28,6 +28,8 @@ typedef void (*md_z3opd_t)(unsigned int D, const long dims[D], const long ostrs[ static bool test_md_z3op(md_z3op_t function) { + num_init_gpu(); + enum { N = 3 }; const long dims[N] = { 2, 5, 3 }; long strs[N]; @@ -122,6 +124,8 @@ UT_GPU_REGISTER_TEST(test_md_zgreatequal2); static bool test_md_z2op(md_z2op_t function) { + num_init_gpu(); + enum { N = 3 }; const long dims[N] = { 2, 5, 3 }; long strs[N]; diff --git a/utests/test_cuda_gpukrnls.c b/utests/test_cuda_gpukrnls.c index 05a814085..f16f95ee5 100644 --- a/utests/test_cuda_gpukrnls.c +++ b/utests/test_cuda_gpukrnls.c @@ -24,6 +24,8 @@ static bool test_im2col_loop_in(void) { + num_init_gpu(); + unsigned long size = CFL_SIZE; unsigned int N = 5; @@ -89,6 +91,8 @@ UT_GPU_REGISTER_TEST(test_im2col_loop_in); static bool test_im2col_loop_out(void) { + num_init_gpu(); + unsigned long size = CFL_SIZE; unsigned int N = 5; @@ -154,6 +158,8 @@ UT_GPU_REGISTER_TEST(test_im2col_loop_out); static bool test_im2col_adj(void) { + num_init_gpu(); + unsigned long size = CFL_SIZE; unsigned int N = 5;