Skip to content

Commit

Permalink
Merge pull request #67 from ntrost57/develop
Browse files Browse the repository at this point in the history
documentation update
  • Loading branch information
ntrost57 authored Oct 19, 2018
2 parents c352469 + 6047598 commit 965f660
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 88 deletions.
16 changes: 7 additions & 9 deletions clients/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ target_include_directories(rocsparse-bench
$<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
)

if(HIP_PLATFORM STREQUAL "hcc")
if(HIP_PLATFORM STREQUAL "nvcc")
target_link_libraries(rocsparse-bench
PRIVATE
${Boost_LIBRARIES}
roc::rocsparse
)
else()
target_link_libraries(rocsparse-bench
PRIVATE
${Boost_LIBRARIES}
Expand All @@ -75,11 +81,3 @@ if(HIP_PLATFORM STREQUAL "hcc")
)
endforeach()
endif()

if(HIP_PLATFORM STREQUAL "nvcc")
target_link_libraries(rocsparse-bench
PRIVATE
${Boost_LIBRARIES}
roc::rocsparse
)
endif()
13 changes: 6 additions & 7 deletions clients/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ function(add_rocsparse_example EXAMPLE_SOURCE)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
)

if(HIP_PLATFORM STREQUAL "hcc")
if(HIP_PLATFORM STREQUAL "nvcc")
target_link_libraries(${EXAMPLE_TARGET}
PRIVATE
rocsparse
)
else()
target_link_libraries(${EXAMPLE_TARGET}
PRIVATE
rocsparse
Expand All @@ -49,12 +54,6 @@ function(add_rocsparse_example EXAMPLE_SOURCE)
endforeach()
endif()

if(HIP_PLATFORM STREQUAL "nvcc")
target_link_libraries(${EXAMPLE_TARGET}
PRIVATE
rocsparse
)
endif()
set_target_properties(${EXAMPLE_TARGET}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/example"
Expand Down
16 changes: 7 additions & 9 deletions clients/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ target_include_directories(rocsparse-test
$<BUILD_INTERFACE:${HIP_INCLUDE_DIRS}>
)

if(HIP_PLATFORM STREQUAL "hcc")
if(HIP_PLATFORM STREQUAL "nvcc")
target_link_libraries(rocsparse-test
PRIVATE
roc::rocsparse
${GTEST_BOTH_LIBRARIES}
)
else()
target_link_libraries(rocsparse-test
PRIVATE
roc::rocsparse
Expand All @@ -130,12 +136,4 @@ if(HIP_PLATFORM STREQUAL "hcc")
endforeach()
endif()

if(HIP_PLATFORM STREQUAL "nvcc")
target_link_libraries(rocsparse-test
PRIVATE
roc::rocsparse
${GTEST_BOTH_LIBRARIES}
)
endif()

add_test(rocsparse-test rocsparse-test)
34 changes: 17 additions & 17 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,7 @@ find_package(Git REQUIRED)
include(cmake/DownloadProject/DownloadProject.cmake)

# HIP configuration
if(HIP_PLATFORM STREQUAL "hcc")
# Workaround until hcc & hip cmake modules fixes symlink logic in their config files.
# (Thanks to rocBLAS devs for finding workaround for this problem!)
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hcc /opt/rocm/hip)
# Ignore hcc warning: argument unused during compilation: '-isystem /opt/rocm/hip/include'
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-command-line-argument")
find_package(hcc REQUIRED CONFIG PATHS /opt/rocm)
find_package(HIP REQUIRED CONFIG PATHS /opt/rocm)
elseif(HIP_PLATFORM STREQUAL "nvcc")
if(HIP_PLATFORM STREQUAL "nvcc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xcompiler -Wall")
set(CMAKE_C_COMPILE_OPTIONS_PIC "-Xcompiler ${CMAKE_C_COMPILE_OPTIONS_PIC}" )
set(CMAKE_CXX_COMPILE_OPTIONS_PIC "-Xcompiler ${CMAKE_CXX_COMPILE_OPTIONS_PIC}" )
Expand All @@ -55,45 +47,53 @@ elseif(HIP_PLATFORM STREQUAL "nvcc")
set(CMAKE_C_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-Xcompiler ${CMAKE_C_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN}" )
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-Xcompiler ${CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN}" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch sm_35")
else()
# Workaround until hcc & hip cmake modules fixes symlink logic in their config files.
# (Thanks to rocBLAS devs for finding workaround for this problem!)
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hcc /opt/rocm/hip)
# Ignore hcc warning: argument unused during compilation: '-isystem /opt/rocm/hip/include'
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-command-line-argument")
find_package(hcc REQUIRED CONFIG PATHS /opt/rocm)
find_package(HIP REQUIRED CONFIG PATHS /opt/rocm)
endif()

# rocPRIM package
if(HIP_PLATFORM STREQUAL "hcc")
find_package(ROCPRIM QUIET CONFIG PATHS /opt/rocm)
if(HIP_PLATFORM STREQUAL "nvcc")
find_package(HIPCUB QUIET CONFIG PATHS /opt/rocm)
if(NOT ROCPRIM_FOUND)
if(NOT HIPCUB_FOUND)
set(ROCPRIM_ROOT ${CMAKE_CURRENT_BINARY_DIR}/rocPRIM CACHE PATH "")
message(STATUS "Downloading rocPRIM.")
download_project(PROJ rocPRIM
GIT_REPOSITORY https://github.com/ROCmSoftwarePlatform/rocPRIM.git
GIT_TAG master
INSTALL_DIR ${ROCPRIM_ROOT}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_TEST=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_CXX_COMPILER=/opt/rocm/bin/hcc
CMAKE_ARGS -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_TEST=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_CXX_COMPILER=${HIP_HIPCC_EXECUTABLE}
LOG_DOWNLOAD TRUE
LOG_CONFIGURE TRUE
LOG_INSTALL TRUE
BUILD_PROJECT TRUE
UPDATE_DISCONNECT TRUE
)
find_package(ROCPRIM REQUIRED CONFIG PATHS ${ROCPRIM_ROOT})
find_package(HIPCUB REQUIRED CONFIG PATHS ${ROCPRIM_ROOT})
endif()
elseif(HIP_PLATFORM STREQUAL "nvcc")
else()
find_package(ROCPRIM QUIET CONFIG PATHS /opt/rocm)
find_package(HIPCUB QUIET CONFIG PATHS /opt/rocm)
if(NOT HIPCUB_FOUND)
if(NOT ROCPRIM_FOUND)
set(ROCPRIM_ROOT ${CMAKE_CURRENT_BINARY_DIR}/rocPRIM CACHE PATH "")
message(STATUS "Downloading rocPRIM.")
download_project(PROJ rocPRIM
GIT_REPOSITORY https://github.com/ROCmSoftwarePlatform/rocPRIM.git
GIT_TAG master
INSTALL_DIR ${ROCPRIM_ROOT}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_TEST=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_CXX_COMPILER=${HIP_HIPCC_EXECUTABLE}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_TEST=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_CXX_COMPILER=/opt/rocm/bin/hcc
LOG_DOWNLOAD TRUE
LOG_CONFIGURE TRUE
LOG_INSTALL TRUE
BUILD_PROJECT TRUE
UPDATE_DISCONNECT TRUE
)
find_package(ROCPRIM REQUIRED CONFIG PATHS ${ROCPRIM_ROOT})
find_package(HIPCUB REQUIRED CONFIG PATHS ${ROCPRIM_ROOT})
endif()
endif()
Expand Down
4 changes: 1 addition & 3 deletions cmake/SetToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if(HIP_PLATFORM STREQUAL "nvcc" OR HIP_COMPILER STREQUAL "clang")
endif()
mark_as_advanced(HIP_HIPCC_EXECUTABLE)
set(CMAKE_CXX_COMPILER ${HIP_HIPCC_EXECUTABLE})
elseif(HIP_PLATFORM STREQUAL "hcc")
else()
# Find HCC executable
find_program(
HIP_HCC_EXECUTABLE
Expand All @@ -65,6 +65,4 @@ elseif(HIP_PLATFORM STREQUAL "hcc")
endif()
mark_as_advanced(HIP_HCC_EXECUTABLE)
set(CMAKE_CXX_COMPILER ${HIP_HCC_EXECUTABLE})
else()
message(FATAL_ERROR "HIP_PLATFORM must be 'hcc/nvcc' (AMD ROCm platform).")
endif()
4 changes: 2 additions & 2 deletions docs/source/library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ rocsparse_csrsv_solve()
:outline:
.. doxygenfunction:: rocsparse_dcsrsv_solve

rocsparse_csrsv_analysis_clear()
rocsparse_csrsv_clear()
********************************

.. doxygenfunction:: rocsparse_csrsv_clear
Expand Down Expand Up @@ -822,7 +822,7 @@ rocsparse_csrilu0()
:outline:
.. doxygenfunction:: rocsparse_dcsrilu0

rocsparse_csrilu0_analysis_clear()
rocsparse_csrilu0_clear()
**********************************

.. doxygenfunction:: rocsparse_csrilu0_clear
Expand Down
14 changes: 6 additions & 8 deletions library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ add_library(rocsparse ${rocsparse_source} ${rocsparse_headers_public})
add_library(roc::rocsparse ALIAS rocsparse)

# Target link libraries
if(HIP_PLATFORM STREQUAL "hcc")
if(NOT HIP_PLATFORM STREQUAL "nvcc")
target_link_libraries(rocsparse PRIVATE hip::hip_hcc hip::hip_device hcc::hccshared)
foreach(target ${AMDGPU_TARGETS})
target_link_libraries(rocsparse PRIVATE --amdgpu-target=${target})
Expand All @@ -68,15 +68,15 @@ target_include_directories(rocsparse
)

# Target properties
if(HIP_PLATFORM STREQUAL "hcc")
if(NOT HIP_PLATFORM STREQUAL "nvcc")
set_target_properties(rocsparse PROPERTIES VERSION ${rocsparse_VERSION} SOVERSION ${rocsparse_SOVERSION})
set_target_properties(rocsparse PROPERTIES CXX_VISIBILITY_PRESET "hidden" VISIBILITY_INLINES_HIDDEN ON)
endif()
set_target_properties(rocsparse PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging")
set_target_properties(rocsparse PROPERTIES DEBUG_POSTFIX "-d")

# Target definitions
if(HIP_PLATFORM STREQUAL "hcc")
if(NOT HIP_PLATFORM STREQUAL "nvcc")
target_compile_definitions(rocsparse PRIVATE ROCPRIM_HIP_API=1)
endif()

Expand All @@ -95,7 +95,7 @@ rocm_install_targets(TARGETS rocsparse
# Export targets
rocm_export_targets(TARGETS roc::rocsparse
PREFIX rocsparse
DEPENDS PACKAGE HIP
DEPENDS PACKAGE hip
NAMESPACE roc::
)

Expand All @@ -114,12 +114,10 @@ endif()
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "\${CPACK_PACKAGING_INSTALL_PREFIX}" "\${CPACK_PACKAGING_INSTALL_PREFIX}/include")

# Package name differs for CUDA backend
if(HIP_PLATFORM STREQUAL "hcc")
set(package_name rocsparse)
endif()

if(HIP_PLATFORM STREQUAL "nvcc")
set(package_name rocsparse-alt)
else()
set(package_name rocsparse)
endif()

set(ROCSPARSE_CONFIG_DIR "\${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Path placed into ldconfig file")
Expand Down
6 changes: 6 additions & 0 deletions library/include/rocsparse-functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,9 @@ rocsparse_status rocsparse_zcsrmv(rocsparse_handle handle,
* \p position can be in host or device memory. If no zero pivot has been found,
* \p position is set to -1 and \ref rocsparse_status_success is returned instead.
*
* \note \p rocsparse_csrsv_zero_pivot is a blocking function. It might influence
* performance negatively.
*
* @param[in]
* handle handle to the rocsparse library context queue.
* @param[in]
Expand Down Expand Up @@ -1918,6 +1921,9 @@ rocsparse_status rocsparse_zcsrmm(rocsparse_handle handle,
* \p position can be in host or device memory. If no zero pivot has been found,
* \p position is set to -1 and \ref rocsparse_status_success is returned instead.
*
* \note \p rocsparse_csrilu0_zero_pivot is a blocking function. It might influence
* performance negatively.
*
* @param[in]
* handle handle to the rocsparse library context queue.
* @param[in]
Expand Down
12 changes: 9 additions & 3 deletions library/src/handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,16 @@ rocsparse_status rocsparse_destroy_csrtr_info(rocsparse_csrtr_info info)
}

// Clean up
if(info->row_map != nullptr)
if(info->d_row_map != nullptr)
{
RETURN_IF_HIP_ERROR(hipFree(info->row_map));
info->row_map = nullptr;
RETURN_IF_HIP_ERROR(hipFree(info->d_row_map));
info->d_row_map = nullptr;
}

if(info->h_row_map != nullptr)
{
RETURN_IF_HIP_ERROR(hipHostFree(info->h_row_map));
info->h_row_map = nullptr;
}

if(info->csr_diag_ind != nullptr)
Expand Down
4 changes: 3 additions & 1 deletion library/src/include/handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ struct _rocsparse_csrtr_info
// host array to hold number of rows per level
std::vector<rocsparse_int> rows_per_level;
// device array to hold row permutation
rocsparse_int* row_map = nullptr;
rocsparse_int* d_row_map = nullptr;
// host array to hold row permutation
rocsparse_int* h_row_map = nullptr;
// device array to hold pointer to diagonal entry
rocsparse_int* csr_diag_ind = nullptr;
// device pointer to hold zero pivot
Expand Down
Loading

0 comments on commit 965f660

Please sign in to comment.