Skip to content

Commit

Permalink
Merge pull request #124 from ROCm-Developer-Tools/prerelease
Browse files Browse the repository at this point in the history
Prerelease
  • Loading branch information
mlucinhdl authored Aug 13, 2018
2 parents af6d620 + 6b98b74 commit e5a8405
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 10 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ Compile rocm_smi_lib (this needs to be done only once after cloning):
cd ../build/rocm_smi_lib
make

Compile rocBLAS (this needs to be done only once after cloning):

cd $RVS
cd ../build
git clone https://github.com/ROCmSoftwarePlatform/rocBLAS.git
cd rocBLAS
./install.sh -d

Note:
- in case you want to install rocBLAS after compiling then you can use the _-i_ option (e.g.: _./install.sh -i_). In this case, _ROCBLAS_INC_DIR_ and _ROCBLAS_LIB_DIR_ have to be updated based on your rocBLAS installation location (e.g.: _/opt/rocm/rocblas/.._)
- if the latest version of rocBLAS is already installed on your system you may skip this step but you need to update the _ROCBLAS_INC_DIR_ and _ROCBLAS_LIB_DIR_ based on your rocBLAS installation location
- if rocBLAS dependencies are already satisfied then you can skip the _-d_ option
- in case _./install.sh -d_ fails please try without _-d_

Compile RVS:

cd $RVS
Expand All @@ -49,9 +63,17 @@ Compile RVS:

# Contains library files exported by ROC Thunk
export ROCT_LIB_DIR=/opt/rocm/lib/

# Contains header files exported by ROC Runtime
export HIP_INC_DIR=/opt/rocm/hip/include/hip/

# Contains header files exported by rocBLAS
export ROCBLAS_INC_DIR=$RVS/../build/rocBLAS/build/release/rocblas-install/include/

# Contains library files exported by rocBLAS
export ROCBLAS_LIB_DIR=$RVS/../build/rocBLAS/build/release/rocblas-install/lib/


cmake -DROCR_INC_DIR=$ROCR_INC_DIR -DROCR_LIB_DIR=$ROCR_LIB_DIR ./ -B../build
cmake -DROCR_INC_DIR=$ROCR_INC_DIR -DROCR_LIB_DIR=$ROCR_LIB_DIR -DROCBLAS_INC_DIR=$ROCBLAS_INC_DIR -DROCBLAS_LIB_DIR=$ROCBLAS_LIB_DIR -DHIP_INC_DIR=$HIP_INC_DIR ./ -B../build
cd ../build
make

Expand Down
47 changes: 41 additions & 6 deletions gst.so/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,48 @@ add_compile_options(-DBUILD_VERSION_PATCH=${VERSION_PATCH})
add_compile_options(-DLIB_VERSION_STRING="${LIB_VERSION_STRING}")
add_compile_options(-DBUILD_VERSION_STRING="${BUILD_VERSION_STRING}")

set(ROCBLAS_LIB "rocblas")
set(HIP_HCC_LIB "hip_hcc")

# Determine Roc Runtime header files are accessible
if(NOT EXISTS ${HIP_INC_DIR}/hip_runtime.h)
message("ERROR: ROC Runtime headers can't be found under specified path. Please set HIP_INC_DIR path. Current value is : " ${HIP_INC_DIR})
RETURN()
endif()

if(NOT EXISTS ${HIP_INC_DIR}/hip_runtime_api.h)
message("ERROR: ROC Runtime headers can't be found under specified path. Please set HIP_INC_DIR path. Current value is : " ${HIP_INC_DIR})
RETURN()
endif()

# Determine Roc Runtime header files are accessible
if(NOT EXISTS ${ROCBLAS_INC_DIR}/rocblas.h)
message("ERROR: rocBLAS headers can't be found under specified path. Please set ROCBLAS_INC_DIR path. Current value is : " ${ROCBLAS_INC_DIR})
RETURN()
endif()

if(NOT EXISTS "${ROCBLAS_LIB_DIR}/lib${ROCBLAS_LIB}.so")
message("ERROR: rocBLAS library can't be found under specified path. Please set ROCBLAS_LIB_DIR path. Current value is : " ${ROCBLAS_LIB_DIR})
RETURN()
endif()

if(NOT EXISTS "${ROCR_LIB_DIR}/lib${HIP_HCC_LIB}.so")
message("ERROR: ROC Runtime libraries can't be found under specified path. Please set ROCR_LIB_DIR path. Current value is : " ${ROCR_LIB_DIR})
RETURN()
endif()

# Add directories to look for header files to compile
INCLUDE_DIRECTORIES(${ROCR_INC_DIR} ${ROCBLAS_INC_DIR} ${HIP_INC_DIR})

# Add directories to look for library files to link
LINK_DIRECTORIES(${ROCR_LIB_DIR} ${ROCBLAS_LIB_DIR})


## additional libraries
set ( PROJECT_LINK_LIBS libpthread.so libpci.so libm.so libhip_hcc.so librocblas.so)
set ( PROJECT_LINK_LIBS libpthread.so libpci.so libm.so)

## define include directories
include_directories(include ../include /opt/rocm/include /opt/rocm/hip/include/hip /opt/rocm/rocblas/include)

## define libraries directories
link_directories(/opt/rocm/lib)
include_directories(include ../include)

## define source files
set(SOURCES ../src/gpu_util.cpp ../src/rvs_util.cpp ../src/pci_caps.cpp ../src/rvsthreadbase.cpp ../src/rvsactionbase.cpp ../src/rvsloglp.cpp
Expand All @@ -90,7 +124,7 @@ set_target_properties(${RVS_TARGET} PROPERTIES
SUFFIX .so.${LIB_VERSION_STRING}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})

target_link_libraries(${RVS_TARGET} ${PROJECT_LINK_LIBS} )
target_link_libraries(${RVS_TARGET} ${PROJECT_LINK_LIBS} ${HIP_HCC_LIB} ${ROCBLAS_LIB})

add_custom_command(TARGET ${RVS_TARGET} POST_BUILD
COMMAND rm -f ./lib${RVS}.so.${VERSION_MAJOR} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
Expand All @@ -99,3 +133,4 @@ COMMAND ln -s ./lib${RVS}.so.${LIB_VERSION_STRING} lib${RVS}.so.${VERSION_MAJOR}

install(TARGETS ${RVS_TARGET} LIBRARY DESTINATION ${CMAKE_PACKAGING_INSTALL_PREFIX}/rvs COMPONENT rvsmodule)
install(FILES "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/lib${RVS}.so.${VERSION_MAJOR}" DESTINATION ${CMAKE_PACKAGING_INSTALL_PREFIX}/rvs COMPONENT rvsmodule)

2 changes: 1 addition & 1 deletion rvs/conf/gst.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ actions:
device: all
module: gst
parallel: false
count: 12
count: 5
wait: 100
duration: 18000
ramp_interval: 7000
Expand Down
1 change: 0 additions & 1 deletion src/rvsactionbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ void rvs::actionbase::property_get_run_duration(int *error) {
if (it != property.end()) {
if (is_positive_integer(it->second)) {
gst_run_duration_ms = std::stoul(it->second);
gst_run_count = 1;
*error = 0;
} else {
*error = 1;
Expand Down

0 comments on commit e5a8405

Please sign in to comment.