-
Notifications
You must be signed in to change notification settings - Fork 297
Fix OpenMP and link tools against hip::host #1352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,20 +25,22 @@ | |
| cmake_minimum_required(VERSION 3.5 FATAL_ERROR) | ||
|
|
||
| function( apply_omp_settings lib_target_ ) | ||
| if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND TARGET OpenMP::OpenMP_CXX) | ||
| set_target_properties( ${lib_target_} PROPERTIES | ||
| BUILD_RPATH "${HIP_CLANG_ROOT}/lib" | ||
| ) | ||
| set_target_properties( ${lib_target_} PROPERTIES | ||
| INSTALL_RPATH "$ORIGIN/../llvm/lib" | ||
| ) | ||
| elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND TARGET OpenMP::omp) | ||
| set_target_properties( ${lib_target_} PROPERTIES | ||
| BUILD_RPATH "${HIP_CLANG_ROOT}/${openmp_LIB_DIR}" | ||
| ) | ||
| set_target_properties( ${lib_target_} PROPERTIES | ||
| INSTALL_RPATH "$ORIGIN/../llvm/${openmp_LIB_DIR}" | ||
| ) | ||
| if(NOT WIN32) | ||
| if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND TARGET OpenMP::OpenMP_CXX) | ||
| set_target_properties( ${lib_target_} PROPERTIES | ||
| BUILD_RPATH "${HIP_CLANG_ROOT}/lib" | ||
| ) | ||
| set_target_properties( ${lib_target_} PROPERTIES | ||
| INSTALL_RPATH "$ORIGIN/../llvm/lib" | ||
| ) | ||
| elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND TARGET OpenMP::omp) | ||
| set_target_properties( ${lib_target_} PROPERTIES | ||
| BUILD_RPATH "${HIP_CLANG_ROOT}/${openmp_LIB_DIR}" | ||
| ) | ||
| set_target_properties( ${lib_target_} PROPERTIES | ||
| INSTALL_RPATH "$ORIGIN/../llvm/${openmp_LIB_DIR}" | ||
| ) | ||
| endif() | ||
| endif() | ||
| endfunction() | ||
|
|
||
|
|
@@ -87,21 +89,28 @@ if ( BUILD_FORTRAN_CLIENTS ) | |
|
|
||
| endif() | ||
|
|
||
| if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| # Look for openmp config in ROCm install to populate openmp_LIB_DIR and openmp_LIB_INSTALL_DIR | ||
| find_package(OpenMP CONFIG PATHS "${HIP_CLANG_ROOT}/lib/cmake") | ||
| endif() | ||
|
|
||
| # OpenMP | ||
| if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND TARGET OpenMP::omp) | ||
| set(ROCSPARSE_CLIENT_LIBS "OpenMP::omp") | ||
| message(STATUS "Found openmp-config.cmake at ${OpenMP_DIR}") | ||
| if(NOT WIN32) | ||
| if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| # Look for openmp config in ROCm install to populate openmp_LIB_DIR and openmp_LIB_INSTALL_DIR | ||
| find_package(OpenMP CONFIG PATHS "${HIP_CLANG_ROOT}/lib/cmake") | ||
| endif() | ||
|
|
||
| if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND TARGET OpenMP::omp) | ||
| set(ROCSPARSE_CLIENT_LIBS "OpenMP::omp") | ||
| message(STATUS "Found openmp-config.cmake at ${OpenMP_DIR}") | ||
| else() | ||
| # if it fails to find OpenMP compile and link flags in strange configurations it can just use non-parallel reference computation | ||
| # if there is no omp.h to find the client compilation will fail and this should be obvious, used to be REQUIRED | ||
| find_package(OpenMP) | ||
| if (TARGET OpenMP::OpenMP_CXX) | ||
| set(ROCSPARSE_CLIENT_LIBS "OpenMP::OpenMP_CXX") | ||
| endif() | ||
| endif() | ||
| else() | ||
| # if it fails to find OpenMP compile and link flags in strange configurations it can just use non-parallel reference computation | ||
| # if there is no omp.h to find the client compilation will fail and this should be obvious, used to be REQUIRED | ||
| find_package(OpenMP) | ||
| if (TARGET OpenMP::OpenMP_CXX) | ||
| set(ROCSPARSE_CLIENT_LIBS "OpenMP::OpenMP_CXX") | ||
| if(OPENMP_FOUND) | ||
| set(ROCSPARSE_CLIENT_LIBS "libomp") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we know why this doesn't seem to be required in rocblas?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't looked closely to the logic applied in rocBLAS and rather compared with the changes that broke the Windows build. Before that problematic patch, Windows was linking to |
||
| endif() | ||
| endif() | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
if(NOT WIN32)andif(WIN32)changes should probably be propagated to rocblas etc as they do the same thing I think. Doesn't have to be done here, just mentioning it so other reviewers might see.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rocBLAS will switch to next-cmake rather sooner than later which re-implements the current build logic. I am confident they have taken care and we didn't had similar build issues even with the old config so far.