SWDEV-287830 - Remove hardcoding of /opt/rocm path from hip samples (#2391)
Change-Id: I4ffcb4d5afe329377aca63ae0a962c1dc567bfd8
Αυτή η υποβολή περιλαμβάνεται σε:
@@ -74,7 +74,8 @@ hipcc hipMain1.cpp -L. -lHipOptLibrary -o test_emit_static_hipcc_linker.out
|
||||
```
|
||||
Using g++:
|
||||
```
|
||||
g++ hipMain1.cpp -L. -lHipOptLibrary -L/opt/rocm/hip/lib -lamdhip64 -o test_emit_static_host_linker.out
|
||||
ROCM_PATH is the path where ROCM is installed. default path is /opt/rocm.
|
||||
g++ hipMain1.cpp -L. -lHipOptLibrary -L<ROCM_PATH>/hip/lib -lamdhip64 -o test_emit_static_host_linker.out
|
||||
```
|
||||
|
||||
## Static libraries with device functions
|
||||
|
||||
@@ -2,8 +2,12 @@ project(static_lib)
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
if (NOT DEFINED ROCM_PATH )
|
||||
set ( ROCM_PATH "/opt/rocm" CACHE STRING "Default ROCM installation directory." )
|
||||
endif ()
|
||||
|
||||
# Search for rocm in common locations
|
||||
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm)
|
||||
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/hip ${ROCM_PATH})
|
||||
|
||||
# Find hip
|
||||
find_package(hip REQUIRED)
|
||||
@@ -23,7 +27,7 @@ add_library(HipDevice STATIC ${CPP_SOURCES})
|
||||
|
||||
target_compile_options(HipDevice PRIVATE -fgpu-rdc)
|
||||
target_link_libraries(HipDevice PRIVATE -fgpu-rdc)
|
||||
target_include_directories(HipDevice PRIVATE /opt/rocm/hsa/include)
|
||||
target_include_directories(HipDevice PRIVATE ${ROCM_PATH}/hsa/include)
|
||||
|
||||
# Create test executable that uses libHipDevice.a
|
||||
set(TEST_SOURCES ${CMAKE_SOURCE_DIR}/hipMain2.cpp)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
HIP_PATH?= $(wildcard /opt/rocm/hip)
|
||||
ROCM_PATH?= $(wildcard /opt/rocm/)
|
||||
HIP_PATH?= $(wildcard $(ROCM_PATH)/hip)
|
||||
ifeq (,$(HIP_PATH))
|
||||
HIP_PATH=../../..
|
||||
endif
|
||||
|
||||
@@ -2,8 +2,12 @@ project(static_lib)
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
if (NOT DEFINED ROCM_PATH )
|
||||
set ( ROCM_PATH "/opt/rocm" CACHE STRING "Default ROCM installation directory." )
|
||||
endif ()
|
||||
|
||||
# Search for rocm in common locations
|
||||
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm)
|
||||
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/hip ${ROCM_PATH})
|
||||
|
||||
# Find hip
|
||||
find_package(hip REQUIRED)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
HIP_PATH?= $(wildcard /opt/rocm/hip)
|
||||
ROCM_PATH?= $(wildcard /opt/rocm/)
|
||||
HIP_PATH?= $(wildcard $(ROCM_PATH)/hip)
|
||||
ifeq (,$(HIP_PATH))
|
||||
HIP_PATH=../../..
|
||||
endif
|
||||
|
||||
Αναφορά σε νέο ζήτημα
Block a user