summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/rocm-tensile/0002-require-openmp-when-tensile-use-openmp-is-on.patch
blob: 4c616d47f2a8d5ce237846d7d75fcca48628c29f (plain) (blame)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
diff --git a/HostLibraryTests/CMakeLists.txt b/HostLibraryTests/CMakeLists.txt
index 79e1529..034f8bb 100644
--- a/HostLibraryTests/CMakeLists.txt
+++ b/HostLibraryTests/CMakeLists.txt
@@ -19,7 +19,7 @@
 # CTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 ################################################################################
 
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.9)
 
 project(TensileHostLibraryTest)
 
@@ -78,21 +78,7 @@ if(TENSILE_USE_HIP)
 endif()
 
 if(TENSILE_USE_OPENMP)
-    #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_OPENMP")
-    find_package(OpenMP QUIET)
-    if (OPENMP_FOUND)
-        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
-        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
-        set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
-    else()
-        if(EXISTS /etc/redhat-release)
-            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp=libgomp")
-        else()
-	    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
-            set(OPENMP_LIBRARY /usr/lib/x86_64-linux-gnu/libomp.so)
-            set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OPENMP_LIBRARY}")
-        endif()
-    endif()
+    find_package(OpenMP REQUIRED)
 endif()
 
 add_subdirectory(configs)
@@ -187,6 +173,6 @@ if(TENSILE_USE_HIP)
 endif()
 
 if(TENSILE_USE_OPENMP)
-    target_link_libraries(TensileTests PRIVATE "${OpenMP_EXE_LINKER_FLAGS}")
+    target_link_libraries(TensileTests PRIVATE OpenMP::OpenMP_CXX)
 endif()
 
diff --git a/Tensile/Source/CMakeLists.txt b/Tensile/Source/CMakeLists.txt
index 821fd53..fe65c9e 100644
--- a/Tensile/Source/CMakeLists.txt
+++ b/Tensile/Source/CMakeLists.txt
@@ -61,21 +61,7 @@ if(TENSILE_NEW_CLIENT)
     endif()
 
     if(TENSILE_USE_OPENMP)
-        #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_OPENMP")
-        find_package(OpenMP QUIET)
-        if (OPENMP_FOUND)
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
-            set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
-        else ()
-            if(EXISTS /etc/redhat-release)
-                set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp=libgomp")
-            else()
-                set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
-                set(OPENMP_LIBRARY /usr/lib/x86_64-linux-gnu/libomp.so)
-                set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OPENMP_LIBRARY}")
-            endif()
-        endif()
+        find_package(OpenMP REQUIRED)
     endif()
 
     #set(TENSILE_CXX_COMPILER "${CMAKE_CXX_COMPILER}")
diff --git a/Tensile/Source/client/CMakeLists.txt b/Tensile/Source/client/CMakeLists.txt
index 9ccba86..081280b 100644
--- a/Tensile/Source/client/CMakeLists.txt
+++ b/Tensile/Source/client/CMakeLists.txt
@@ -52,12 +52,8 @@ target_link_libraries(TensileClient TensileHost ${Boost_LIBRARIES} rocm_smi)
 add_executable(tensile_client main.cpp)
 
 target_link_libraries(tensile_client PRIVATE TensileHost TensileClient ${Boost_LIBRARIES})
-if(OpenMP_FOUND)
-    target_link_libraries(tensile_client PRIVATE "${OpenMP_EXE_LINKER_FLAGS}")
-else()
-    set(OPENMP_LIBRARY /usr/lib/x86_64-linux-gnu/libomp.so)
-    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OPENMP_LIBRARY}")
-    target_link_libraries(tensile_client PRIVATE "${OpenMP_EXE_LINKER_FLAGS}")
+if(TENSILE_USE_OPENMP)
+    target_link_libraries(tensile_client PRIVATE OpenMP::OpenMP_CXX)
 endif()
 
 foreach(arch IN LISTS TENSILE_GPU_ARCHS)