1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
From: Cordell Bloor <cgmb@slerp.xyz>
Date: Sun, 9 Apr 2023 02:33:46 -0600
Subject: make openmp optional
Applied-Upstream: https://github.com/ROCmSoftwarePlatform/rocBLAS/commit/45bef63fc4988d11f25c9cc84b12513c7b8abc81
---
tensile/HostLibraryTests/CachingLibrary_test.cpp | 2 ++
tensile/HostLibraryTests/testlib/include/TestUtils.hpp | 7 ++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/tensile/HostLibraryTests/CachingLibrary_test.cpp b/tensile/HostLibraryTests/CachingLibrary_test.cpp
index 0d31271..ea44a06 100644
--- a/tensile/HostLibraryTests/CachingLibrary_test.cpp
+++ b/tensile/HostLibraryTests/CachingLibrary_test.cpp
@@ -66,7 +66,9 @@ TEST(Cache, Threaded)
using namespace Tensile;
CacheMap<int, int> cache(-1);
+#ifdef _OPENMP
#pragma omp parallel num_threads(32)
+#endif
{
int seed = 0;
#ifdef _OPENMP
diff --git a/tensile/HostLibraryTests/testlib/include/TestUtils.hpp b/tensile/HostLibraryTests/testlib/include/TestUtils.hpp
index f146c58..10475ed 100644
--- a/tensile/HostLibraryTests/testlib/include/TestUtils.hpp
+++ b/tensile/HostLibraryTests/testlib/include/TestUtils.hpp
@@ -27,7 +27,9 @@
#pragma once
#include <cstddef>
+#ifdef _OPENMP
#include <omp.h>
+#endif
#include <random>
#include <Tensile/ContractionProblem.hpp>
@@ -99,8 +101,9 @@ namespace Tensile
throw std::runtime_error("Fix this function to work with dimensions != 3");
auto seed_base = rng();
-
+#ifdef _OPENMP
#pragma omp parallel num_threads(32)
+#endif
{
RNG myrng = rng;
auto seed = seed_base;
@@ -111,7 +114,9 @@ namespace Tensile
std::vector<size_t> index3{0, 0, 0};
+#ifdef _OPENMP
#pragma omp for schedule(static) collapse(2)
+#endif
for(size_t i = 0; i < desc.sizes()[2]; i++)
{
for(size_t j = 0; j < desc.sizes()[1]; j++)
|