Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/build-rocm-examples-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:

- name: CMake configure
run: |
cmake -S . -B build -DCMAKE_HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" -DROCM_ROOT="${ROCM_PATH}" -DCMAKE_BUILD_RPATH="${ROCM_PATH}/lib" -DROCM_EXAMPLES_ENABLE_OPENMP="${ENABLE_OPENMP}" 2> >(tee cmake_error.log >&2)
cmake -S . -B build -DCMAKE_HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" -DCMAKE_BUILD_RPATH="${ROCM_PATH}/lib" -DROCM_EXAMPLES_ENABLE_OPENMP="${ENABLE_OPENMP}" 2> >(tee cmake_error.log >&2)

- name: CMake configure error summary
if: ${{ !cancelled() }}
Expand Down
1 change: 1 addition & 0 deletions Applications/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${folder_bin})

include("${CMAKE_CURRENT_LIST_DIR}/../Common/FindFilesystem.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/../Common/HipPlatform.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/../Common/ROCmPath.cmake")
select_gpu_language()
# select_hip_platform requires the language to be enabled
enable_language(${ROCM_EXAMPLES_GPU_LANGUAGE})
Expand Down
18 changes: 2 additions & 16 deletions Applications/bitonic_sort/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,7 @@ set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_EXTENSIONS OFF)
set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_STANDARD_REQUIRED ON)
select_hip_platform()

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(ROCM_ROOT
"$ENV{HIP_PATH}"
CACHE PATH
"Root directory of the ROCm installation"
)
else()
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()

list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
include("${CMAKE_CURRENT_LIST_DIR}/../../Common/ROCmPath.cmake")

add_executable(${example_name} main.hip)
# Make example runnable using ctest
Expand All @@ -57,7 +43,7 @@ add_test(NAME ${example_name} COMMAND ${example_name})
set(include_dirs "../../Common" "../../External")
# For examples targeting NVIDIA, include the HIP header directory.
if(ROCM_EXAMPLES_HIP_PLATFORM STREQUAL "nvidia")
list(APPEND include_dirs "${ROCM_ROOT}/include")
list(APPEND include_dirs "${ROCM_PATH}/include")
endif()

target_include_directories(${example_name} PRIVATE ${include_dirs})
Expand Down
6 changes: 3 additions & 3 deletions Applications/bitonic_sort/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ EXTERNAL_DIR := ../../External
GPU_RUNTIME ?= HIP

# HIP variables
ROCM_INSTALL_DIR ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_INSTALL_DIR)/include
ROCM_PATH ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_PATH)/include

HIPCXX ?= $(ROCM_INSTALL_DIR)/bin/hipcc
HIPCXX ?= $(ROCM_PATH)/bin/hipcc

# Common variables and flags
CXX_STD := c++17
Expand Down
18 changes: 2 additions & 16 deletions Applications/convolution/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,7 @@ set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_EXTENSIONS OFF)
set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_STANDARD_REQUIRED ON)
select_hip_platform()

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(ROCM_ROOT
"$ENV{HIP_PATH}"
CACHE PATH
"Root directory of the ROCm installation"
)
else()
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()

list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
include("${CMAKE_CURRENT_LIST_DIR}/../../Common/ROCmPath.cmake")

add_executable(${example_name} main.hip)
# Make example runnable using ctest
Expand All @@ -57,7 +43,7 @@ add_test(NAME ${example_name} COMMAND ${example_name})
set(include_dirs "../../Common" "../../External")
# For examples targeting NVIDIA, include the HIP header directory.
if(ROCM_EXAMPLES_HIP_PLATFORM STREQUAL "nvidia")
list(APPEND include_dirs "${ROCM_ROOT}/include")
list(APPEND include_dirs "${ROCM_PATH}/include")
endif()

target_include_directories(${example_name} PRIVATE ${include_dirs})
Expand Down
6 changes: 3 additions & 3 deletions Applications/convolution/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ EXTERNAL_DIR := ../../External
GPU_RUNTIME ?= HIP

# HIP variables
ROCM_INSTALL_DIR ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_INSTALL_DIR)/include
ROCM_PATH ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_PATH)/include

HIPCXX ?= $(ROCM_INSTALL_DIR)/bin/hipcc
HIPCXX ?= $(ROCM_PATH)/bin/hipcc

# Common variables and flags
CXX_STD := c++17
Expand Down
18 changes: 2 additions & 16 deletions Applications/fdtd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,7 @@ set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_EXTENSIONS OFF)
set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_STANDARD_REQUIRED ON)
select_hip_platform()

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(ROCM_ROOT
"$ENV{HIP_PATH}"
CACHE PATH
"Root directory of the ROCm installation"
)
else()
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()

list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
include("${CMAKE_CURRENT_LIST_DIR}/../../Common/ROCmPath.cmake")

add_executable(${example_name} main.hip)

Expand All @@ -58,7 +44,7 @@ add_test(NAME ${example_name} COMMAND ${example_name})
set(include_dirs "../../Common" "../../External")

if(ROCM_EXAMPLES_HIP_PLATFORM STREQUAL "nvidia")
list(APPEND include_dirs "${ROCM_ROOT}/include")
list(APPEND include_dirs "${ROCM_PATH}/include")
endif()

target_include_directories(${example_name} PRIVATE ${include_dirs})
Expand Down
6 changes: 3 additions & 3 deletions Applications/fdtd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ EXTERNAL_DIR := ../../External
GPU_RUNTIME ?= HIP

# HIP variables
ROCM_INSTALL_DIR ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_INSTALL_DIR)/include
ROCM_PATH ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_PATH)/include

HIPCXX ?= $(ROCM_INSTALL_DIR)/bin/hipcc
HIPCXX ?= $(ROCM_PATH)/bin/hipcc

# Common variables and flags
CXX_STD := c++17
Expand Down
18 changes: 2 additions & 16 deletions Applications/floyd_warshall/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,7 @@ set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_EXTENSIONS OFF)
set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_STANDARD_REQUIRED ON)
select_hip_platform()

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(ROCM_ROOT
"$ENV{HIP_PATH}"
CACHE PATH
"Root directory of the ROCm installation"
)
else()
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()

list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
include("${CMAKE_CURRENT_LIST_DIR}/../../Common/ROCmPath.cmake")

add_executable(${example_name} main.hip)
# Make example runnable using ctest
Expand All @@ -57,7 +43,7 @@ add_test(NAME ${example_name} COMMAND ${example_name})
set(include_dirs "../../Common" "../../External")
# For examples targeting NVIDIA, include the HIP header directory.
if(ROCM_EXAMPLES_HIP_PLATFORM STREQUAL "nvidia")
list(APPEND include_dirs "${ROCM_ROOT}/include")
list(APPEND include_dirs "${ROCM_PATH}/include")
endif()

target_include_directories(${example_name} PRIVATE ${include_dirs})
Expand Down
6 changes: 3 additions & 3 deletions Applications/floyd_warshall/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ EXTERNAL_DIR := ../../External
GPU_RUNTIME ?= HIP

# HIP variables
ROCM_INSTALL_DIR ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_INSTALL_DIR)/include
ROCM_PATH ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_PATH)/include

HIPCXX ?= $(ROCM_INSTALL_DIR)/bin/hipcc
HIPCXX ?= $(ROCM_PATH)/bin/hipcc

# Common variables and flags
CXX_STD := c++17
Expand Down
18 changes: 2 additions & 16 deletions Applications/histogram/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,7 @@ set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_EXTENSIONS OFF)
set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_STANDARD_REQUIRED ON)
select_hip_platform()

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(ROCM_ROOT
"$ENV{HIP_PATH}"
CACHE PATH
"Root directory of the ROCm installation"
)
else()
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()

list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
include("${CMAKE_CURRENT_LIST_DIR}/../../Common/ROCmPath.cmake")

add_executable(${example_name} main.hip)
# Make example runnable using ctest
Expand All @@ -57,7 +43,7 @@ add_test(NAME ${example_name} COMMAND ${example_name})
set(include_dirs "../../Common" "../../External")
# For examples targeting NVIDIA, include the HIP header directory.
if(ROCM_EXAMPLES_HIP_PLATFORM STREQUAL "nvidia")
list(APPEND include_dirs "${ROCM_ROOT}/include")
list(APPEND include_dirs "${ROCM_PATH}/include")
endif()

target_include_directories(${example_name} PRIVATE ${include_dirs})
Expand Down
6 changes: 3 additions & 3 deletions Applications/histogram/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ EXTERNAL_DIR := ../../External
GPU_RUNTIME ?= HIP

# HIP variables
ROCM_INSTALL_DIR ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_INSTALL_DIR)/include
ROCM_PATH ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_PATH)/include

HIPCXX ?= $(ROCM_INSTALL_DIR)/bin/hipcc
HIPCXX ?= $(ROCM_PATH)/bin/hipcc

# Common variables and flags
CXX_STD := c++17
Expand Down
16 changes: 1 addition & 15 deletions Applications/monte_carlo_pi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,7 @@ set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_EXTENSIONS OFF)
set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_STANDARD_REQUIRED ON)
select_hip_platform()

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(ROCM_ROOT
"$ENV{HIP_PATH}"
CACHE PATH
"Root directory of the ROCm installation"
)
else()
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()

list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
include("${CMAKE_CURRENT_LIST_DIR}/../../Common/ROCmPath.cmake")

find_package(hipcub REQUIRED)
find_package(hiprand REQUIRED)
Expand Down
8 changes: 4 additions & 4 deletions Applications/monte_carlo_pi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ EXTERNAL_DIR := ../../External
GPU_RUNTIME ?= HIP

# HIP variables
ROCM_INSTALL_DIR ?= /opt/rocm
ROCM_PATH ?= /opt/rocm
CUDA_INSTALL_DIR ?= /usr/local/cuda

HIP_INCLUDE_DIR := $(ROCM_INSTALL_DIR)/include
HIP_INCLUDE_DIR := $(ROCM_PATH)/include
HIPCUB_INCLUDE_DIR := $(HIP_INCLUDE_DIR)
HIPRAND_INCLUDE_DIR := $(HIP_INCLUDE_DIR)

HIPCXX ?= $(ROCM_INSTALL_DIR)/bin/hipcc
HIPCXX ?= $(ROCM_PATH)/bin/hipcc
CUDACXX ?= $(CUDA_INSTALL_DIR)/bin/nvcc

# Common variables and flags
CXX_STD := c++17
ICXXFLAGS := -std=$(CXX_STD)
ICPPFLAGS := -I $(COMMON_INCLUDE_DIR) -isystem $(HIPCUB_INCLUDE_DIR) -isystem $(HIPRAND_INCLUDE_DIR) \
-I $(COMMON_INCLUDE_DIR) -I $(EXTERNAL_DIR)
ILDFLAGS := -L $(ROCM_INSTALL_DIR)/lib
ILDFLAGS := -L $(ROCM_PATH)/lib
ILDLIBS := -lhiprand

ifeq ($(GPU_RUNTIME), CUDA)
Expand Down
18 changes: 2 additions & 16 deletions Applications/prefix_sum/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,7 @@ set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_EXTENSIONS OFF)
set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_STANDARD_REQUIRED ON)
select_hip_platform()

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(ROCM_ROOT
"$ENV{HIP_PATH}"
CACHE PATH
"Root directory of the ROCm installation"
)
else()
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()

list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
include("${CMAKE_CURRENT_LIST_DIR}/../../Common/ROCmPath.cmake")

add_executable(${example_name} main.hip)
# Make example runnable using ctest
Expand All @@ -57,7 +43,7 @@ add_test(NAME ${example_name} COMMAND ${example_name})
set(include_dirs "../../Common" "../../External")
# For examples targeting NVIDIA, include the HIP header directory.
if(ROCM_EXAMPLES_HIP_PLATFORM STREQUAL "nvidia")
list(APPEND include_dirs "${ROCM_ROOT}/include")
list(APPEND include_dirs "${ROCM_PATH}/include")
endif()

target_include_directories(${example_name} PRIVATE ${include_dirs})
Expand Down
6 changes: 3 additions & 3 deletions Applications/prefix_sum/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ EXTERNAL_DIR := ../../External
GPU_RUNTIME ?= HIP

# HIP variables
ROCM_INSTALL_DIR ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_INSTALL_DIR)/include
ROCM_PATH ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_PATH)/include

HIPCXX ?= $(ROCM_INSTALL_DIR)/bin/hipcc
HIPCXX ?= $(ROCM_PATH)/bin/hipcc

# Common variables and flags
CXX_STD := c++17
Expand Down
18 changes: 2 additions & 16 deletions Applications/sobel_filter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,7 @@ set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_EXTENSIONS OFF)
set(CMAKE_${ROCM_EXAMPLES_GPU_LANGUAGE}_STANDARD_REQUIRED ON)
select_hip_platform()

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(ROCM_ROOT
"$ENV{HIP_PATH}"
CACHE PATH
"Root directory of the ROCm installation"
)
else()
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()

list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
include("${CMAKE_CURRENT_LIST_DIR}/../../Common/ROCmPath.cmake")

add_executable(${example_name} main.hip ../../External/glad/glad.cpp)

Expand All @@ -57,7 +43,7 @@ add_test(NAME ${example_name} COMMAND ${example_name})
set(include_dirs "../../Common" "../../External")

if(ROCM_EXAMPLES_HIP_PLATFORM STREQUAL "nvidia")
list(APPEND include_dirs "${ROCM_ROOT}/include")
list(APPEND include_dirs "${ROCM_PATH}/include")
endif()

find_package(glfw3 REQUIRED)
Expand Down
6 changes: 3 additions & 3 deletions Applications/sobel_filter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ EXTERNAL_DIR := ../../External
GPU_RUNTIME ?= HIP

# HIP variables
ROCM_INSTALL_DIR ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_INSTALL_DIR)/include
ROCM_PATH ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_PATH)/include

HIPCXX ?= $(ROCM_INSTALL_DIR)/bin/hipcc
HIPCXX ?= $(ROCM_PATH)/bin/hipcc

# Common variables and flags
CXX_STD := c++17
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ project(ROCm-SDK-Examples LANGUAGES CXX VERSION 6.4.0)
include(CTest)

include("${CMAKE_CURRENT_LIST_DIR}/Common/HipPlatform.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/Common/ROCmPath.cmake")

# Set default build type to Release
if(NOT CMAKE_BUILD_TYPE)
Expand Down
Loading
Loading