Skip to content

Commit

Permalink
Fix stream in KernelContext in warp, convolution and laplacian tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Zientkiewicz <[email protected]>
  • Loading branch information
mzient committed Feb 14, 2022
1 parent dfde565 commit 1ef772c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions dali/kernels/imgproc/convolution/convolution_gpu_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ struct ConvolutionGpuKernelTest : public ::testing::Test {

void RunTest() {
KernelContext ctx_cpu, ctx_gpu;
ctx_gpu.gpu.stream = 0;
KernelCpu kernel_cpu;
KernelGpu kernel_gpu;

Expand Down
1 change: 1 addition & 0 deletions dali/kernels/imgproc/convolution/laplacian_gpu_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ struct LaplacianGpuTest : public ::testing::Test {

void RunTest() {
KernelContext ctx_cpu = {}, ctx_gpu = {};
ctx_gpu.gpu.stream = 0;
KernelCpu kernel_cpu;
KernelGpu kernel_gpu;
int nsamples = in_.shape.size();
Expand Down
5 changes: 4 additions & 1 deletion dali/kernels/test/warp_test/warp_gpu_test.cu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -69,6 +69,7 @@ void WarpGPU_Affine_Transpose(bool force_variable) {
auto mapping_gpu = mm::alloc_raw_unique<AffineMapping2D, mm::memory_kind::device>(1);
TensorShape<2> out_shape = { img_tensor.shape[1], img_tensor.shape[0] };
KernelContext ctx = {};
ctx.gpu.stream = 0;
auto out_shapes_hw = make_span<1>(&out_shape);
auto mappings = make_tensor_gpu<1>(mapping_gpu.get(), { 1 });
copy(mappings, make_tensor_cpu<1>(&mapping_cpu, { 1 }));
Expand Down Expand Up @@ -169,6 +170,7 @@ TEST(WarpGPU, Affine_RotateScale_Single) {
auto mapping_gpu = mm::alloc_raw_unique<AffineMapping2D, mm::memory_kind::device>(1);
TensorShape<2> out_shape = { img_tensor.shape[0] * scale, img_tensor.shape[1] * scale };
KernelContext ctx = {};
ctx.gpu.stream = 0;
auto out_shapes_hw = make_span<1>(&out_shape);
auto mappings = make_tensor_gpu<1>(mapping_gpu.get(), { 1 });
copy(mappings, make_tensor_cpu<1>(&mapping_cpu, { 1 }));
Expand Down Expand Up @@ -237,6 +239,7 @@ TEST(WarpGPU, Affine_RotateScale_Uniform) {
auto mapping_gpu = mm::alloc_raw_unique<AffineMapping2D, mm::memory_kind::device>(samples);
TensorShape<2> out_shape = { img_tensor.shape[0] * scale, img_tensor.shape[1] * scale };
KernelContext ctx = {};
ctx.gpu.stream = 0;
std::vector<TensorShape<2>> out_shapes_hw(samples);
for (int i = 0; i < samples; i++)
out_shapes_hw[i] = out_shape;
Expand Down

0 comments on commit 1ef772c

Please sign in to comment.