-
Notifications
You must be signed in to change notification settings - Fork 37
Add rpath for hipfft-test to help find libomp. #173
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
f41cd65
6df6ab6
2fdaaba
d1c8157
0dac5f5
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 |
|---|---|---|
|
|
@@ -32,6 +32,13 @@ else( ) | |
| "Install path prefix, prepended onto install directories" ) | ||
| endif( ) | ||
|
|
||
| # Dependencies | ||
|
|
||
| find_package( ROCmCMakeBuildTools REQUIRED CONFIG PATHS /opt/rocm ) | ||
| include(ROCMInstallTargets) | ||
| list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake ) | ||
|
|
||
|
|
||
| # This has to be initialized before the project() command appears | ||
| # Set the default of CMAKE_BUILD_TYPE to be release, unless user | ||
| # specifies with -D. MSVC_IDE does not use CMAKE_BUILD_TYPE | ||
|
|
@@ -42,13 +49,19 @@ endif() | |
|
|
||
| project( hipfft-clients-tests LANGUAGES CXX ) | ||
|
|
||
| if( NOT HIPFFT_BUILD_SCOPE ) | ||
| find_package( hipfft REQUIRED CONFIG PATHS ) | ||
| endif() | ||
|
|
||
| find_package( Boost REQUIRED) | ||
|
|
||
| set( Boost_USE_STATIC_LIBS OFF ) | ||
|
|
||
|
|
||
| find_package( FFTW 3.0 REQUIRED MODULE COMPONENTS FLOAT DOUBLE ) | ||
|
|
||
| set( BUILD_WITH_LIB "ROCM" CACHE STRING "Build ${PROJECT_NAME} with ROCM or CUDA libraries" ) | ||
|
|
||
| set( THREADS_PREFER_PTHREAD_FLAG ON ) | ||
| find_package( Threads REQUIRED ) | ||
|
|
||
|
|
@@ -84,7 +97,7 @@ if( NOT BUILD_WITH_LIB STREQUAL "CUDA" ) | |
| if( WIN32 ) | ||
| find_package( HIP CONFIG REQUIRED ) | ||
| else() | ||
| find_package( HIP MODULE REQUIRED ) | ||
| find_package( hip REQUIRED CONFIG PATHS /opt/rocm/lib/cmake/hip/ ) | ||
| endif() | ||
| endif() | ||
|
|
||
|
|
@@ -98,6 +111,14 @@ endif() | |
| string( CONCAT TESTS_OUT_DIR "${PROJECT_BINARY_DIR}" ${TESTS_OUT_DIR} ) | ||
|
|
||
| option( BUILD_CLIENTS_TESTS_OPENMP "Build tests with OpenMP" ON ) | ||
| if( BUILD_CLIENTS_TESTS_OPENMP ) | ||
| # Attempt to find a config version, which provides openmp_LIB_DIR. | ||
| #find_package( OpenMP CONFIG PATHS "${HIP_CLANG_ROOT}/lib/cmake" ) | ||
| if( NOT OPENMP_FOUND OR NOT DEFINED ${openmp_LIB_DIR} ) | ||
| # Fall-back to module mode. | ||
| find_package( OpenMP REQUIRED ) | ||
|
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. Would this ever define |
||
| endif() | ||
| endif() | ||
|
|
||
| foreach( target ${TEST_TARGETS} ) | ||
| set_target_properties( ${target} PROPERTIES | ||
|
|
@@ -140,20 +161,6 @@ foreach( target ${TEST_TARGETS} ) | |
| target_compile_definitions( ${target} PUBLIC _CUFFT_BACKEND ) | ||
| endif() | ||
|
|
||
| if( BUILD_CLIENTS_TESTS_OPENMP ) | ||
| find_package(OpenMP REQUIRED) | ||
| if( BUILD_WITH_LIB STREQUAL "CUDA" ) | ||
| message( STATUS "OpenMP is not supported on CUDA, building tests without it" ) | ||
| else() | ||
| target_compile_options( ${target} PRIVATE -DBUILD_CLIENTS_TESTS_OPENMP ) | ||
| if(NOT (CMAKE_CXX_COMPILER MATCHES ".*hipcc$" OR CMAKE_CXX_COMPILER MATCHES ".*clang\\+\\+")) | ||
| target_link_libraries( ${target} PRIVATE OpenMP::OpenMP_CXX ) | ||
| target_include_directories( ${target} PRIVATE ${HIP_CLANG_ROOT}/include ) | ||
| else() | ||
| target_link_libraries( ${target} PRIVATE OpenMP::OpenMP_CXX ) | ||
| endif() | ||
| endif() | ||
| endif() | ||
|
|
||
| target_include_directories( ${target} | ||
| PRIVATE | ||
|
|
@@ -168,6 +175,18 @@ foreach( target ${TEST_TARGETS} ) | |
| hip::hipfft | ||
| ${FFTW_LIBRARIES} | ||
| ) | ||
|
|
||
| if( BUILD_CLIENTS_TESTS_OPENMP ) | ||
| if( BUILD_WITH_LIB STREQUAL "CUDA" ) | ||
| message( STATUS "OpenMP is not supported on CUDA, building tests without it" ) | ||
| else() | ||
| if( DEFINED ${openmp_LIB_DIR} ) | ||
| set_target_properties( ${target} PROPERTIES BUILD_RPATH "${HIP_CLANG_ROOT}/${openmp_LIB_DIR}" ) | ||
| set_target_properties( ${target} PROPERTIES INSTALL_RPATH "${HIP_CLANG_ROOT}/${openmp_LIB_DIR}" ) | ||
|
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. Would this ever set the binary's install rpath as a relative path, i.e., would |
||
| endif() | ||
| target_link_libraries( ${target} PRIVATE OpenMP::OpenMP_CXX ) | ||
| endif() | ||
| endif() | ||
|
|
||
| if( HIPFFT_MPI_ENABLE ) | ||
| target_link_libraries( ${target} | ||
|
|
@@ -184,6 +203,8 @@ foreach( target ${TEST_TARGETS} ) | |
| rocm_install(TARGETS ${target} COMPONENT tests) | ||
| endforeach() | ||
|
|
||
| find_package( GTest 1.11.0 ) | ||
|
|
||
| if( GTEST_FOUND ) | ||
| target_include_directories( hipfft-test PRIVATE $<BUILD_INTERFACE:${GTEST_INCLUDE_DIRS}> ) | ||
| target_link_libraries( hipfft-test PRIVATE ${GTEST_LIBRARIES} ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,9 @@ | |
| #include "../../shared/mpi_worker.h" | ||
| #include "../hipfft_params.h" | ||
|
|
||
| // initialize static class member of hipfft_params | ||
| std::vector<gpubuf> hipfft_params::externally_managed_workareas = std::vector<gpubuf>(); | ||
|
|
||
|
Comment on lines
+26
to
+28
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. FYI: this may be removed as that was resolved in #174 |
||
| int main(int argc, char* argv[]) | ||
| { | ||
| return mpi_worker_main<std::array<hipfft_params, 1>, false>( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,8 +45,8 @@ | |
| #define DISABLE_WARNING_RETURN_TYPE | ||
| #endif | ||
|
|
||
| #include "hipfft-export.h" | ||
| #include "hipfft-version.h" | ||
| #include "hipfft/hipfft-export.h" | ||
| #include "hipfft/hipfft-version.h" | ||
|
Comment on lines
-48
to
+49
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. I am wary of this change. In my understanding, once installed, I'm actually suspecting that the test-only build failed because it was not including an installed library's Could we try reverting this file's changes and removing |
||
| #include <hip/hip_complex.h> | ||
| #include <hip/library_types.h> | ||
|
|
||
|
|
||
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.
Suggestion: maybe we could add
AND BUILD_WITH_LIB NOT STREQUAL "CUDA"above, to avoid a fatal build error if building with cuda (openMP is ignored thereafter in that case, anyways)?