From 87d72290a7f69ba25ff729276c4eca3c2c1346ea Mon Sep 17 00:00:00 2001 From: amdkila <47991923+amdkila@users.noreply.github.com> Date: Mon, 11 May 2020 10:05:25 -0600 Subject: [PATCH 1/3] Fix hip-clang cmake symbols (#212) --- CMakeLists.txt | 9 +-------- clients/gtest/CMakeLists.txt | 4 ++-- clients/samples/CMakeLists.txt | 4 ++-- library/src/CMakeLists.txt | 2 +- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f715792b..97128cf54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,7 @@ rocm_setup_version( VERSION ${VERSION_STRING} ) list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ) # NOTE: workaround until hcc & hip cmake modules fixes symlink logic in their config files; remove when fixed -list( APPEND CMAKE_PREFIX_PATH /opt/rocm/hcc /opt/rocm/hip ) +list( APPEND CMAKE_PREFIX_PATH /opt/rocm /opt/rocm/hcc /opt/rocm/hip ) option( BUILD_VERBOSE "Output additional build information" OFF ) @@ -82,13 +82,6 @@ find_library( HINTS "${CMAKE_PREFIX_PATH}/lib" ) message("amdhip64: ${LIBAMDHIP64_LIBRARY}") -# Look for libamdhip64 -find_library( - LIBAMDHIP64_LIBRARY - NAMES libamdhip64.so - HINTS "${CMAKE_PREFIX_PATH}/lib" ) -message("amdhip64: ${LIBAMDHIP64_LIBRARY}") - # Quietly look for CUDA, but if not found it's not an error # The presense of hip is not sufficient to determine if we want a rocm or cuda backend option(TRY_CUDA "Look for CUDA and use that as a backend if found" ON) diff --git a/clients/gtest/CMakeLists.txt b/clients/gtest/CMakeLists.txt index 5d009492d..e9ab195a9 100644 --- a/clients/gtest/CMakeLists.txt +++ b/clients/gtest/CMakeLists.txt @@ -142,10 +142,10 @@ if( NOT CUDA_FOUND ) target_compile_options( hipblas-test PRIVATE -mf16c) if( CUSTOM_TARGET ) - target_link_libraries( hipblas-test PRIVATE hip::${CUSTOM_TARGET} ) + target_link_libraries( hipblas-test PRIVATE hip::${CUSTOM_TARGET} hip::host ) else( ) if ( LIBAMDHIP64_LIBRARY ) - target_link_libraries( hipblas-test PRIVATE hip::amdhip64 ) + target_link_libraries( hipblas-test PRIVATE hip::amdhip64 hip::host ) else ( ) get_target_property( HIP_HCC_LOCATION hip::hip_hcc IMPORTED_LOCATION_RELEASE ) target_link_libraries( hipblas-test PRIVATE ${HIP_HCC_LOCATION} ) diff --git a/clients/samples/CMakeLists.txt b/clients/samples/CMakeLists.txt index 8b4d54c77..e0fdea714 100644 --- a/clients/samples/CMakeLists.txt +++ b/clients/samples/CMakeLists.txt @@ -46,10 +46,10 @@ foreach( exe example-sscal;example-sgemm;example-sgemm-strided-batched;example-c target_compile_options( ${exe} PRIVATE -mf16c) if( CUSTOM_TARGET ) - target_link_libraries( ${exe} PRIVATE hip::${CUSTOM_TARGET} ) + target_link_libraries( ${exe} PRIVATE hip::${CUSTOM_TARGET} hip::host ) else( ) if( LIBAMDHIP64_LIBRARY ) - target_link_libraries( ${exe} PRIVATE hip::amdhip64 ) + target_link_libraries( ${exe} PRIVATE hip::amdhip64 hip::host ) else( ) get_target_property( HIP_HCC_LOCATION hip::hip_hcc IMPORTED_LOCATION_RELEASE ) target_link_libraries( ${exe} PRIVATE ${HIP_HCC_LOCATION} ) diff --git a/library/src/CMakeLists.txt b/library/src/CMakeLists.txt index bc7c4b5a5..acc8c0a21 100755 --- a/library/src/CMakeLists.txt +++ b/library/src/CMakeLists.txt @@ -70,7 +70,7 @@ if( NOT CUDA_FOUND ) # Remove following when hcc is fixed; hcc emits following spurious warning ROCm v1.6.3 # "clang-5.0: warning: argument unused during compilation: '-isystem /opt/rocm/include'" - if( CMAKE_CXX_COMPILER MATCHES ".*/hcc$|.*/hipcc$" ) + if( CMAKE_CXX_COMPILER MATCHES ".*/hcc$" ) target_link_libraries( hipblas PRIVATE hip::hip_hcc ) endif( ) From faea3e6806b967fe028e6bc9a155ce621d57ceb4 Mon Sep 17 00:00:00 2001 From: Lee Killough Date: Mon, 11 May 2020 14:13:26 -0400 Subject: [PATCH 2/3] Workaround clang bug with static variable templates --- clients/include/utility.h | 4 ++-- library/include/hipblas.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/clients/include/utility.h b/clients/include/utility.h index 40259cebe..ed355c5ad 100644 --- a/clients/include/utility.h +++ b/clients/include/utility.h @@ -142,10 +142,10 @@ template static constexpr bool is_complex = false; template <> -constexpr bool is_complex = true; +HIPBLAS_CLANG_STATIC constexpr bool is_complex = true; template <> -constexpr bool is_complex = true; +HIPBLAS_CLANG_STATIC constexpr bool is_complex = true; // Get base types from complex types. template diff --git a/library/include/hipblas.h b/library/include/hipblas.h index 16e10452f..c83efaea6 100644 --- a/library/include/hipblas.h +++ b/library/include/hipblas.h @@ -18,6 +18,12 @@ #include #include +#if __clang__ +#define HIPBLAS_CLANG_STATIC static +#else +#define HIPBLAS_CLANG_STATIC +#endif + typedef void* hipblasHandle_t; typedef uint16_t hipblasHalf; From 1f57a2f62710d0cb060dedd74a4c77bf6c259fb9 Mon Sep 17 00:00:00 2001 From: amdkila <47991923+amdkila@users.noreply.github.com> Date: Wed, 20 May 2020 10:07:50 -0600 Subject: [PATCH 3/3] Add dependencies for centos 8 (#217) --- install.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index b3f0367cb..eeb6579b5 100755 --- a/install.sh +++ b/install.sh @@ -112,6 +112,7 @@ install_packages( ) # dependencies needed for library and clients to build local library_dependencies_ubuntu=( "make" "cmake-curses-gui" "pkg-config" ) local library_dependencies_centos=( "epel-release" "make" "cmake3" "gcc-c++" "rpm-build" ) + local library_dependencies_centos8=( "epel-release" "make" "cmake3" "gcc-c++" "rpm-build" ) local library_dependencies_fedora=( "make" "cmake" "gcc-c++" "libcxx-devel" "rpm-build" ) local library_dependencies_sles=( "make" "cmake" "gcc-c++" "libcxxtools9" "rpm-build" ) @@ -161,6 +162,7 @@ install_packages( ) local client_dependencies_ubuntu=( "gfortran" "libboost-program-options-dev" ) local client_dependencies_centos=( "devtoolset-7-gcc-gfortran" "boost-devel" ) + local client_dependencies_centos8=( "gcc-gfortran" "boost-devel" ) local client_dependencies_fedora=( "gcc-gfortran" "boost-devel" ) local client_dependencies_sles=( "libboost_program_options1_66_0-devel" "pkg-config" "dpkg" ) @@ -178,10 +180,16 @@ install_packages( ) # yum -y update brings *all* installed packages up to date # without seeking user approval # elevate_if_not_root yum -y update - install_yum_packages "${library_dependencies_centos[@]}" - - if [[ "${build_clients}" == true ]]; then - install_yum_packages "${client_dependencies_centos[@]}" + if [[ "${VERSION_ID}" == "8" ]]; then + install_yum_packages "${library_dependencies_centos8[@]}" + if [[ "${build_clients}" == true ]]; then + install_yum_packages "${client_dependencies_centos8[@]}" + fi + else + install_yum_packages "${library_dependencies_centos[@]}" + if [[ "${build_clients}" == true ]]; then + install_yum_packages "${client_dependencies_centos[@]}" + fi fi ;;