BLIS GTestSuite: Link OpenMP if we test serial BLIS, but MKL is used as a reference.

Change-Id: Iacafa5ecf74622fa5e1180a81305cf7a23d79055
This commit is contained in:
Eleni Vlachopoulou
2023-03-28 00:26:22 +05:30
committed by Eleni Vlachopoulou
parent f5dc3db648
commit 04e091fdca
2 changed files with 7 additions and 1 deletions

View File

@@ -1,4 +1,7 @@
#include <iostream>
#ifdef REF_IS_MKL
#include <omp.h>
#endif
#include "common/refCBLAS.h"
namespace testinghelpers {
@@ -7,6 +10,8 @@ refCBLAS::refCBLAS() {
if (!refCBLASModule)
{
#ifdef REF_IS_MKL
// Dummy call to force linker, link OpenMP library if MKL is used.
omp_get_num_threads();
MKLCoreModule = dlopen(MKL_CORE, RTLD_GLOBAL | RTLD_LAZY);
MKLGNUThreadModule = dlopen(MKL_GNU_THREAD, RTLD_GLOBAL | RTLD_LAZY);
#endif

View File

@@ -37,7 +37,8 @@ foreach(dir ${DIRS})
set_target_properties(${target_name}.${dir}.${subdir} PROPERTIES OUTPUT_NAME ${target_name}.${dir}.${subdir})
target_include_directories(${target_name}.${dir}.${subdir} PUBLIC ${BLIS_INCLUDE} ${CMAKE_SOURCE_DIR}/testinghelpers/inc ${CMAKE_SOURCE_DIR}/testsuite/)
target_link_libraries(${target_name}.${dir}.${subdir} gtest gtest_main testinghelpers ${Blis_LIBRARY} ${COMMON_LIBS})
if(ENABLE_THREADING STREQUAL "openmp")
# if we test serial BLIS, but MKL is used as a reference we still need to set up OpenMP.
if( (ENABLE_THREADING STREQUAL "openmp") OR (REF_CBLAS STREQUAL "MKL"))
if(LINUX)
if(OpenMP_LIBRARY STREQUAL "GNU")
target_link_libraries(${target_name}.${dir}.${subdir} -fopenmp)