From d1d7722cfc5ee130115d8d195068a98b16102a21 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Wed, 8 Apr 2020 14:10:15 +0100 Subject: COMPMID-3314: Enable OpenMP in the reference tests Change-Id: I05b5fedb998317144e0dd13a6377a97207b27f46 Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3024 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- tests/validation/reference/Col2Im.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'tests/validation/reference/Col2Im.cpp') diff --git a/tests/validation/reference/Col2Im.cpp b/tests/validation/reference/Col2Im.cpp index 53969d4725..f42582bbe8 100644 --- a/tests/validation/reference/Col2Im.cpp +++ b/tests/validation/reference/Col2Im.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -47,21 +47,26 @@ SimpleTensor col2im(const SimpleTensor &src, const TensorShape &dst_shape, if(num_groups == 1) { // Batches are on the 3rd dimension of the input tensor - int dst_idx = 0; +#if defined(_OPENMP) + #pragma omp parallel for collapse(3) +#endif /* _OPENMP */ for(size_t b = 0; b < batches; ++b) { for(size_t x = 0; x < src_width; ++x) { for(size_t y = 0; y < src_height; ++y) { - dst[dst_idx++] = src[coord2index(src.shape(), Coordinates(x, y, b))]; + const int dst_idx = y + x * src_height + b * src_height * src_width; + dst[dst_idx] = src[coord2index(src.shape(), Coordinates(x, y, b))]; } } } } else { - int dst_idx = 0; +#if defined(_OPENMP) + #pragma omp parallel for collapse(4) +#endif /* _OPENMP */ for(size_t b = 0; b < batches; ++b) { for(size_t g = 0; g < num_groups; ++g) @@ -70,7 +75,8 @@ SimpleTensor col2im(const SimpleTensor &src, const TensorShape &dst_shape, { for(size_t y = 0; y < src_height; ++y) { - dst[dst_idx++] = src[coord2index(src.shape(), Coordinates(x, y, g, b))]; + const int dst_idx = y + x * src_height + g * src_height * src_width + b * src_height * src_width * num_groups; + dst[dst_idx] = src[coord2index(src.shape(), Coordinates(x, y, g, b))]; } } } -- cgit v1.2.1