Browse Source

Add cmake-format to CI (#121)

* Add cmake file formatting to CI
   - Using gersemi - https://github.com/BlankSpruce/gersemi
* Fix failures in CMake linting

---------

Signed-off-by: David Galiffi <David.Galiffi@amd.com>
pull/124/head
David Galiffi 1 year ago committed by GitHub
parent
commit
b725fd7633
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 10
      .gersemirc
  2. 31
      .github/workflows/linting.yml
  3. 18
      Applications/bitonic_sort/CMakeLists.txt
  4. 18
      Applications/convolution/CMakeLists.txt
  5. 18
      Applications/floyd_warshall/CMakeLists.txt
  6. 18
      Applications/histogram/CMakeLists.txt
  7. 19
      Applications/monte_carlo_pi/CMakeLists.txt
  8. 18
      Applications/prefix_sum/CMakeLists.txt
  9. 57
      HIP-Basic/CMakeLists.txt
  10. 107
      HIP-Basic/assembly_to_executable/CMakeLists.txt
  11. 18
      HIP-Basic/bandwidth/CMakeLists.txt
  12. 18
      HIP-Basic/bit_extract/CMakeLists.txt
  13. 23
      HIP-Basic/cooperative_groups/CMakeLists.txt
  14. 18
      HIP-Basic/device_globals/CMakeLists.txt
  15. 18
      HIP-Basic/device_query/CMakeLists.txt
  16. 18
      HIP-Basic/dynamic_shared/CMakeLists.txt
  17. 18
      HIP-Basic/events/CMakeLists.txt
  18. 18
      HIP-Basic/gpu_arch/CMakeLists.txt
  19. 18
      HIP-Basic/hello_world/CMakeLists.txt
  20. 19
      HIP-Basic/hello_world_cuda/CMakeLists.txt
  21. 36
      HIP-Basic/hipify/CMakeLists.txt
  22. 18
      HIP-Basic/inline_assembly/CMakeLists.txt
  23. 140
      HIP-Basic/llvm_ir_to_executable/CMakeLists.txt
  24. 18
      HIP-Basic/matrix_multiplication/CMakeLists.txt
  25. 27
      HIP-Basic/module_api/CMakeLists.txt
  26. 18
      HIP-Basic/moving_average/CMakeLists.txt
  27. 18
      HIP-Basic/multi_gpu_data_transfer/CMakeLists.txt
  28. 18
      HIP-Basic/occupancy/CMakeLists.txt
  29. 18
      HIP-Basic/opengl_interop/CMakeLists.txt
  30. 18
      HIP-Basic/runtime_compilation/CMakeLists.txt
  31. 18
      HIP-Basic/saxpy/CMakeLists.txt
  32. 18
      HIP-Basic/shared_memory/CMakeLists.txt
  33. 23
      HIP-Basic/static_host_library/CMakeLists.txt
  34. 18
      HIP-Basic/streams/CMakeLists.txt
  35. 23
      HIP-Basic/texture_management/CMakeLists.txt
  36. 35
      HIP-Basic/vulkan_interop/CMakeLists.txt
  37. 18
      HIP-Basic/warp_shuffle/CMakeLists.txt
  38. 4
      Libraries/CMakeLists.txt
  39. 14
      Libraries/hipBLAS/CMakeLists.txt
  40. 19
      Libraries/hipBLAS/gemm_strided_batched/CMakeLists.txt
  41. 19
      Libraries/hipBLAS/her/CMakeLists.txt
  42. 19
      Libraries/hipBLAS/scal/CMakeLists.txt
  43. 14
      Libraries/hipCUB/CMakeLists.txt
  44. 17
      Libraries/hipCUB/device_radix_sort/CMakeLists.txt
  45. 17
      Libraries/hipCUB/device_sum/CMakeLists.txt
  46. 21
      Libraries/hipSOLVER/CMakeLists.txt
  47. 19
      Libraries/hipSOLVER/gels/CMakeLists.txt
  48. 19
      Libraries/hipSOLVER/geqrf/CMakeLists.txt
  49. 19
      Libraries/hipSOLVER/gesvd/CMakeLists.txt
  50. 19
      Libraries/hipSOLVER/getrf/CMakeLists.txt
  51. 19
      Libraries/hipSOLVER/potrf/CMakeLists.txt
  52. 20
      Libraries/hipSOLVER/syevd/CMakeLists.txt
  53. 19
      Libraries/hipSOLVER/syevdx/CMakeLists.txt
  54. 19
      Libraries/hipSOLVER/syevj/CMakeLists.txt
  55. 19
      Libraries/hipSOLVER/syevj_batched/CMakeLists.txt
  56. 19
      Libraries/hipSOLVER/sygvd/CMakeLists.txt
  57. 19
      Libraries/hipSOLVER/sygvj/CMakeLists.txt
  58. 14
      Libraries/rocBLAS/CMakeLists.txt
  59. 14
      Libraries/rocBLAS/level_1/axpy/CMakeLists.txt
  60. 14
      Libraries/rocBLAS/level_1/dot/CMakeLists.txt
  61. 14
      Libraries/rocBLAS/level_1/nrm2/CMakeLists.txt
  62. 14
      Libraries/rocBLAS/level_1/scal/CMakeLists.txt
  63. 14
      Libraries/rocBLAS/level_1/swap/CMakeLists.txt
  64. 14
      Libraries/rocBLAS/level_2/gemv/CMakeLists.txt
  65. 14
      Libraries/rocBLAS/level_2/her/CMakeLists.txt
  66. 14
      Libraries/rocBLAS/level_3/gemm/CMakeLists.txt
  67. 14
      Libraries/rocBLAS/level_3/gemm_strided_batched/CMakeLists.txt
  68. 14
      Libraries/rocPRIM/CMakeLists.txt
  69. 12
      Libraries/rocPRIM/block_sum/CMakeLists.txt
  70. 12
      Libraries/rocPRIM/device_sum/CMakeLists.txt
  71. 14
      Libraries/rocRAND/CMakeLists.txt
  72. 7
      Libraries/rocRAND/simple_distributions_cpp/CMakeLists.txt
  73. 24
      Libraries/rocSOLVER/CMakeLists.txt
  74. 16
      Libraries/rocSOLVER/getf2/CMakeLists.txt
  75. 14
      Libraries/rocSOLVER/getri/CMakeLists.txt
  76. 16
      Libraries/rocSOLVER/syev/CMakeLists.txt
  77. 14
      Libraries/rocSOLVER/syev_batched/CMakeLists.txt
  78. 16
      Libraries/rocSOLVER/syev_strided_batched/CMakeLists.txt
  79. 19
      Libraries/rocSPARSE/CMakeLists.txt
  80. 14
      Libraries/rocSPARSE/level_2/bsrmv/CMakeLists.txt
  81. 14
      Libraries/rocSPARSE/level_2/bsrsv/CMakeLists.txt
  82. 14
      Libraries/rocSPARSE/level_2/bsrxmv/CMakeLists.txt
  83. 14
      Libraries/rocSPARSE/level_2/coomv/CMakeLists.txt
  84. 14
      Libraries/rocSPARSE/level_2/csrmv/CMakeLists.txt
  85. 14
      Libraries/rocSPARSE/level_2/csrsv/CMakeLists.txt
  86. 14
      Libraries/rocSPARSE/level_2/ellmv/CMakeLists.txt
  87. 14
      Libraries/rocSPARSE/level_2/gebsrmv/CMakeLists.txt
  88. 14
      Libraries/rocSPARSE/level_2/gemvi/CMakeLists.txt
  89. 14
      Libraries/rocSPARSE/level_2/spmv/CMakeLists.txt
  90. 14
      Libraries/rocSPARSE/level_2/spsv/CMakeLists.txt
  91. 14
      Libraries/rocSPARSE/level_3/bsrmm/CMakeLists.txt
  92. 14
      Libraries/rocSPARSE/level_3/bsrsm/CMakeLists.txt
  93. 14
      Libraries/rocSPARSE/level_3/csrmm/CMakeLists.txt
  94. 14
      Libraries/rocSPARSE/level_3/csrsm/CMakeLists.txt
  95. 14
      Libraries/rocSPARSE/level_3/gebsrmm/CMakeLists.txt
  96. 14
      Libraries/rocSPARSE/level_3/gemmi/CMakeLists.txt
  97. 14
      Libraries/rocSPARSE/level_3/sddmm/CMakeLists.txt
  98. 14
      Libraries/rocSPARSE/level_3/spmm/CMakeLists.txt
  99. 14
      Libraries/rocSPARSE/level_3/spsm/CMakeLists.txt
  100. 14
      Libraries/rocSPARSE/preconditioner/bsric0/CMakeLists.txt
  101. Some files were not shown because too many files have changed in this diff Show More

10
.gersemirc

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/BlankSpruce/gersemi/master/gersemi/configuration.schema.json
color: false
definitions: []
indent: 4
line_length: 80
list_expansion: favour-inlining
quiet: false
unsafe: false
workers: 12

31
.github/workflows/linting.yml

@ -3,16 +3,35 @@ name: Linting @@ -3,16 +3,35 @@ name: Linting
on:
push:
branches:
- develop
- main
- 'release/rocm-rel*'
- develop
- main
- 'release/rocm-rel*'
pull_request:
branches:
- develop
- main
- 'release/roc-rel*'
- develop
- main
- 'release/rocm-rel*'
jobs:
call-workflow-passing-data:
name: Documentation
uses: ROCm/rocm-docs-core/.github/workflows/linting.yml@develop
cmake-formatting:
name: CMake File Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
python3 -m pip install gersemi
- name: Run gersemi
run: |
gersemi --check .
if [ $? -ne 0 ]; then
echo "CMake files are not formatted correctly. Please run gersemi ..."
echo "For example: \`gersemi -i .\`"
exit 1
fi

18
Applications/bitonic_sort/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
Applications/convolution/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
Applications/floyd_warshall/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
Applications/histogram/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

19
Applications/monte_carlo_pi/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -39,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -39,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
Applications/prefix_sum/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

57
HIP-Basic/CMakeLists.txt

@ -25,49 +25,64 @@ project(HIP-Basic LANGUAGES CXX) @@ -25,49 +25,64 @@ project(HIP-Basic LANGUAGES CXX)
# ROCm installation path
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
# Only supported on HIP (not CUDA)
if(NOT "${GPU_RUNTIME}" STREQUAL "CUDA")
# Make sure the dependencies can be found before building.
find_program(
LLVM_DIS_COMMAND llvm-dis
LLVM_DIS_COMMAND
llvm-dis
PATH_SUFFIXES bin
PATHS
${ROCM_ROOT}/llvm
${CMAKE_INSTALL_PREFIX}/llvm)
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
)
find_program(
OFFLOAD_BUNDLER_COMMAND clang-offload-bundler
OFFLOAD_BUNDLER_COMMAND
clang-offload-bundler
PATH_SUFFIXES bin
PATHS
${ROCM_ROOT}/llvm
${CMAKE_INSTALL_PREFIX}/llvm)
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
)
find_program(
LLVM_MC_COMMAND llvm-mc
LLVM_MC_COMMAND
llvm-mc
PATH_SUFFIXES bin
PATHS
${ROCM_ROOT}/llvm
${CMAKE_INSTALL_PREFIX}/llvm)
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
)
if(LLVM_DIS_COMMAND AND OFFLOAD_BUNDLER_COMMAND AND LLVM_MC_COMMAND)
add_subdirectory(llvm_ir_to_executable)
else()
message("'llvm-dis', 'llvm-mc', or 'clang-offload-bundler' not found, not building assembly example.")
add_subdirectory(llvm_ir_to_executable)
else()
message(
"'llvm-dis', 'llvm-mc', or 'clang-offload-bundler' not found, not building assembly example."
)
if(NOT WIN32)
message(" These tools can be found in the 'rocm-llvm-dev' package.")
message(
" These tools can be found in the 'rocm-llvm-dev' package."
)
endif()
endif()
if(OFFLOAD_BUNDLER_COMMAND AND LLVM_MC_COMMAND)
add_subdirectory(assembly_to_executable)
else()
message("'llvm-mc' or 'clang-offload-bundler' not found, not building LLVM IR example.")
message(
"'llvm-mc' or 'clang-offload-bundler' not found, not building LLVM IR example."
)
if(NOT WIN32)
message(" These tools can be found in the 'rocm-llvm-dev' package.")
message(
" These tools can be found in the 'rocm-llvm-dev' package."
)
endif()
endif()

107
HIP-Basic/assembly_to_executable/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,9 @@ set(GPU_RUNTIME "HIP" CACHE STRING "Switches between HIP and CUDA") @@ -29,7 +29,9 @@ set(GPU_RUNTIME "HIP" CACHE STRING "Switches between HIP and CUDA")
# Only supported on HIP (not CUDA)
if(NOT "${GPU_RUNTIME}" STREQUAL "HIP")
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be HIP.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be HIP."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -39,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -39,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
@ -49,18 +59,30 @@ list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}") @@ -49,18 +59,30 @@ list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
if(NOT DEFINED CMAKE_HIP_ARCHITECTURES)
set(GPU_ARCHITECTURES "all" CACHE STRING "GPU architectures to compile for")
else()
set(GPU_ARCHITECTURES "${CMAKE_HIP_ARCHITECTURES}" CACHE STRING "GPU architectures to compile for")
set(GPU_ARCHITECTURES
"${CMAKE_HIP_ARCHITECTURES}"
CACHE STRING
"GPU architectures to compile for"
)
endif()
if(GPU_ARCHITECTURES STREQUAL "all")
set(GPU_ARCHITECTURES "gfx803;gfx900;gfx906;gfx908;gfx90a;gfx1030;gfx1100;gfx1101;gfx1102" CACHE STRING "GPU architectures to compile for" FORCE)
set(GPU_ARCHITECTURES
"gfx803;gfx900;gfx906;gfx908;gfx90a;gfx1030;gfx1100;gfx1101;gfx1102"
CACHE STRING
"GPU architectures to compile for"
FORCE
)
endif()
# Remove duplicates.
list(REMOVE_DUPLICATES GPU_ARCHITECTURES)
message(STATUS "GPU_ARCHITECTURES: ${GPU_ARCHITECTURES}")
set_source_files_properties(main.hip PROPERTIES COMPILE_OPTIONS "--cuda-host-only")
set_source_files_properties(
main.hip
PROPERTIES COMPILE_OPTIONS "--cuda-host-only"
)
if(WIN32)
set(OBJ_TYPE obj)
@ -81,22 +103,24 @@ foreach(HIP_ARCHITECTURE ${GPU_ARCHITECTURES}) @@ -81,22 +103,24 @@ foreach(HIP_ARCHITECTURE ${GPU_ARCHITECTURES})
add_custom_command(
OUTPUT main_${HIP_ARCHITECTURE}.${OBJ_TYPE}
COMMAND
${CMAKE_HIP_COMPILER} -fPIC -target amdgcn-amd-amdhsa -mcpu=${HIP_ARCHITECTURE}
${CMAKE_CURRENT_SOURCE_DIR}/main_${HIP_ARCHITECTURE}.s
-o ${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}
${CMAKE_HIP_COMPILER} -fPIC -target amdgcn-amd-amdhsa
-mcpu=${HIP_ARCHITECTURE}
${CMAKE_CURRENT_SOURCE_DIR}/main_${HIP_ARCHITECTURE}.s -o
${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/main_${HIP_ARCHITECTURE}.s
VERBATIM
COMMENT "Compiling ASM main_${HIP_ARCHITECTURE}.${OBJ_TYPE}")
COMMENT "Compiling ASM main_${HIP_ARCHITECTURE}.${OBJ_TYPE}"
)
endforeach()
# Create an offload-bundle from the assembled object files. This needs the clang-offload-bundler tool.
find_program(
OFFLOAD_BUNDLER_COMMAND clang-offload-bundler
OFFLOAD_BUNDLER_COMMAND
clang-offload-bundler
PATH_SUFFIXES bin
PATHS
${ROCM_ROOT}/llvm
${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED)
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED
)
# Generate object bundle.
# The invocation to generate is
@ -110,9 +134,19 @@ set(BUNDLE_INPUTS "-input=${NULDEV}") @@ -110,9 +134,19 @@ set(BUNDLE_INPUTS "-input=${NULDEV}")
# Generate BUNDLE_OBJECTS as a string of: ${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}
set(BUNDLE_OBJECTS "")
foreach(HIP_ARCHITECTURE ${GPU_ARCHITECTURES})
set(BUNDLE_TARGETS "${BUNDLE_TARGETS},hipv4-amdgcn-amd-amdhsa--${HIP_ARCHITECTURE}")
list(APPEND BUNDLE_INPUTS "-input=${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}")
list(APPEND BUNDLE_OBJECTS "${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}")
set(BUNDLE_TARGETS
"${BUNDLE_TARGETS},hipv4-amdgcn-amd-amdhsa--${HIP_ARCHITECTURE}"
)
list(
APPEND
BUNDLE_INPUTS
"-input=${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}"
)
list(
APPEND
BUNDLE_OBJECTS
"${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}"
)
endforeach()
# Invoke clang-offload-bundler to generate an offload bundle.
@ -120,46 +154,39 @@ set(BUNDLE "${CMAKE_CURRENT_BINARY_DIR}/offload_bundle.hipfb") @@ -120,46 +154,39 @@ set(BUNDLE "${CMAKE_CURRENT_BINARY_DIR}/offload_bundle.hipfb")
add_custom_command(
OUTPUT "${BUNDLE}"
COMMAND
"${OFFLOAD_BUNDLER_COMMAND}"
-type=o
-bundle-align=4096
"${BUNDLE_TARGETS}"
${BUNDLE_INPUTS}
"-output=${BUNDLE}"
"${OFFLOAD_BUNDLER_COMMAND}" -type=o -bundle-align=4096
"${BUNDLE_TARGETS}" ${BUNDLE_INPUTS} "-output=${BUNDLE}"
DEPENDS ${BUNDLE_OBJECTS}
VERBATIM
COMMENT "Bundling fat binary ${BUNDLE}")
COMMENT "Bundling fat binary ${BUNDLE}"
)
# Create the device binary by assembling the template that includes
# the offload bundle that was just generated using an .incbin directive.
# This needs an assembler.
find_program(
LLVM_MC_COMMAND llvm-mc
LLVM_MC_COMMAND
llvm-mc
PATH_SUFFIXES bin
PATHS
${ROCM_ROOT}/llvm
${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED)
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED
)
# Invoke llvm-mc to generate an object file containing the offload bundle.
set(DEVICE_OBJECT "${CMAKE_CURRENT_BINARY_DIR}/main_device.${OBJ_TYPE}")
add_custom_command(
OUTPUT "${DEVICE_OBJECT}"
COMMAND
"${LLVM_MC_COMMAND}"
-triple "${HOST_TARGET}"
"${CMAKE_CURRENT_SOURCE_DIR}/${HIP_OBJ_GEN_FILE}"
-o "${DEVICE_OBJECT}"
"${LLVM_MC_COMMAND}" -triple "${HOST_TARGET}"
"${CMAKE_CURRENT_SOURCE_DIR}/${HIP_OBJ_GEN_FILE}" -o "${DEVICE_OBJECT}"
--filetype=obj
DEPENDS "${BUNDLE}"
VERBATIM
COMMENT "Bundling object ${DEVICE_OBJECT}")
COMMENT "Bundling object ${DEVICE_OBJECT}"
)
# Finally, create the executable.
add_executable(
${example_name}
main.hip
${DEVICE_OBJECT})
add_executable(${example_name} main.hip ${DEVICE_OBJECT})
# Make example runnable using ctest.
add_test(${example_name} ${example_name})

18
HIP-Basic/bandwidth/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
HIP-Basic/bit_extract/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

23
HIP-Basic/cooperative_groups/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
@ -56,7 +66,10 @@ if(GPU_RUNTIME STREQUAL "CUDA") @@ -56,7 +66,10 @@ if(GPU_RUNTIME STREQUAL "CUDA")
list(APPEND include_dirs "${ROCM_ROOT}/include")
else()
# Add NDEBUG for HIP version >= 5.5 and < 6.0 due to a known bug in the cooperative groups header
if( ${hip-lang_VERSION} VERSION_GREATER_EQUAL 5.5 AND ${hip-lang_VERSION} VERSION_LESS 6 )
if(
${hip-lang_VERSION} VERSION_GREATER_EQUAL 5.5
AND ${hip-lang_VERSION} VERSION_LESS 6
)
add_compile_definitions(NDEBUG)
endif()
endif()

18
HIP-Basic/device_globals/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
HIP-Basic/device_query/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -47,9 +49,17 @@ set(CMAKE_${USED_LANGUAGE}_EXTENSIONS OFF) @@ -47,9 +49,17 @@ set(CMAKE_${USED_LANGUAGE}_EXTENSIONS OFF)
set(CMAKE_${USED_LANGUAGE}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
HIP-Basic/dynamic_shared/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
HIP-Basic/events/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
HIP-Basic/gpu_arch/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
HIP-Basic/hello_world/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

19
HIP-Basic/hello_world_cuda/CMakeLists.txt

@ -29,9 +29,17 @@ cmake_minimum_required(VERSION 3.21 FATAL_ERROR) @@ -29,9 +29,17 @@ cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(${example_name} LANGUAGES CUDA)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
add_executable(${example_name} main.hip)
@ -40,9 +48,10 @@ add_executable(${example_name} main.hip) @@ -40,9 +48,10 @@ add_executable(${example_name} main.hip)
add_test(${example_name} ${example_name})
# Make the HIP runtime headers accessible
target_include_directories(${example_name} PRIVATE
"${ROCM_ROOT}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/../../Common")
target_include_directories(
${example_name}
PRIVATE "${ROCM_ROOT}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../Common"
)
# Set up the compilation language for the source file.
# Usually this can be deduced from the file extension, but not in the case of .hip.

36
HIP-Basic/hipify/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -23,7 +23,10 @@ @@ -23,7 +23,10 @@
set(example_name hip_hipify)
if(WIN32)
message(FATAL_ERROR "The hipify example currently does not support Windows.")
message(
FATAL_ERROR
"The hipify example currently does not support Windows."
)
endif()
find_package(Perl REQUIRED)
@ -36,7 +39,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -36,7 +39,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -46,20 +51,31 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -46,20 +51,31 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
# create main.hip
add_custom_command(
OUTPUT main.hip
COMMAND ${PERL_EXECUTABLE} ${ROCM_ROOT}/bin/hipify-perl ${CMAKE_CURRENT_SOURCE_DIR}/main.cu
-o ${CMAKE_CURRENT_BINARY_DIR}/main.hip
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/main.cu
VERBATIM)
OUTPUT main.hip
COMMAND
${PERL_EXECUTABLE} ${ROCM_ROOT}/bin/hipify-perl
${CMAKE_CURRENT_SOURCE_DIR}/main.cu -o
${CMAKE_CURRENT_BINARY_DIR}/main.hip
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/main.cu
VERBATIM
)
add_executable(${example_name} ${CMAKE_CURRENT_BINARY_DIR}/main.hip)
# Make example runnable using ctest

18
HIP-Basic/inline_assembly/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

140
HIP-Basic/llvm_ir_to_executable/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,9 @@ set(GPU_RUNTIME "HIP" CACHE STRING "Switches between HIP and CUDA") @@ -29,7 +29,9 @@ set(GPU_RUNTIME "HIP" CACHE STRING "Switches between HIP and CUDA")
# Only supported on HIP (not CUDA)
if(NOT "${GPU_RUNTIME}" STREQUAL "HIP")
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be HIP.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be HIP."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -39,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -39,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
@ -49,40 +59,55 @@ list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}") @@ -49,40 +59,55 @@ list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
if(NOT DEFINED CMAKE_HIP_ARCHITECTURES)
set(GPU_ARCHITECTURES "all" CACHE STRING "GPU architectures to compile for")
else()
set(GPU_ARCHITECTURES "${CMAKE_HIP_ARCHITECTURES}" CACHE STRING "GPU architectures to compile for")
set(GPU_ARCHITECTURES
"${CMAKE_HIP_ARCHITECTURES}"
CACHE STRING
"GPU architectures to compile for"
)
endif()
if(GPU_ARCHITECTURES STREQUAL "all")
set(GPU_ARCHITECTURES "gfx803;gfx900;gfx906;gfx908;gfx90a;gfx1030;gfx1100;gfx1101;gfx1102" CACHE STRING "GPU architectures to compile for" FORCE)
set(GPU_ARCHITECTURES
"gfx803;gfx900;gfx906;gfx908;gfx90a;gfx1030;gfx1100;gfx1101;gfx1102"
CACHE STRING
"GPU architectures to compile for"
FORCE
)
endif()
# Remove duplicates
list(REMOVE_DUPLICATES GPU_ARCHITECTURES)
message(STATUS "GPU_ARCHITECTURES: ${GPU_ARCHITECTURES}")
set_source_files_properties(main.hip PROPERTIES COMPILE_OPTIONS "--cuda-host-only")
set_source_files_properties(
main.hip
PROPERTIES COMPILE_OPTIONS "--cuda-host-only"
)
find_program(
LLVM_DIS_COMMAND llvm-dis
PATH_SUFFIXES bin
PATHS
${ROCM_ROOT}/llvm
${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED)
LLVM_DIS_COMMAND
llvm-dis
PATH_SUFFIXES bin
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED
)
# Generate the device LLVM IR using the HIP compiler.
foreach(HIP_ARCHITECTURE ${GPU_ARCHITECTURES})
add_custom_command(
OUTPUT main_${HIP_ARCHITECTURE}.ll main_${HIP_ARCHITECTURE}.bc
COMMAND
${CMAKE_HIP_COMPILER} --cuda-device-only -c -emit-llvm ${CMAKE_CURRENT_SOURCE_DIR}/main.hip
--offload-arch=${HIP_ARCHITECTURE} -o main_${HIP_ARCHITECTURE}.bc
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../Common -std=c++17
COMMAND
${LLVM_DIS_COMMAND} main_${HIP_ARCHITECTURE}.bc -o main_${HIP_ARCHITECTURE}.ll
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/main.hip
VERBATIM
COMMENT "Generating main_${HIP_ARCHITECTURE}.ll")
OUTPUT main_${HIP_ARCHITECTURE}.ll main_${HIP_ARCHITECTURE}.bc
COMMAND
${CMAKE_HIP_COMPILER} --cuda-device-only -c -emit-llvm
${CMAKE_CURRENT_SOURCE_DIR}/main.hip
--offload-arch=${HIP_ARCHITECTURE} -o main_${HIP_ARCHITECTURE}.bc -I
${CMAKE_CURRENT_SOURCE_DIR}/../../Common -std=c++17
COMMAND
${LLVM_DIS_COMMAND} main_${HIP_ARCHITECTURE}.bc -o
main_${HIP_ARCHITECTURE}.ll
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/main.hip
VERBATIM
COMMENT "Generating main_${HIP_ARCHITECTURE}.ll"
)
endforeach()
if(WIN32)
@ -104,21 +129,23 @@ foreach(HIP_ARCHITECTURE ${GPU_ARCHITECTURES}) @@ -104,21 +129,23 @@ foreach(HIP_ARCHITECTURE ${GPU_ARCHITECTURES})
add_custom_command(
OUTPUT main_${HIP_ARCHITECTURE}.${OBJ_TYPE}
COMMAND
${CMAKE_HIP_COMPILER} -fPIC -target amdgcn-amd-amdhsa -mcpu=${HIP_ARCHITECTURE} main_${HIP_ARCHITECTURE}.ll
-o ${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}
${CMAKE_HIP_COMPILER} -fPIC -target amdgcn-amd-amdhsa
-mcpu=${HIP_ARCHITECTURE} main_${HIP_ARCHITECTURE}.ll -o
${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}
DEPENDS main_${HIP_ARCHITECTURE}.ll
VERBATIM
COMMENT "Generating main_${HIP_ARCHITECTURE}.${OBJ_TYPE}")
COMMENT "Generating main_${HIP_ARCHITECTURE}.${OBJ_TYPE}"
)
endforeach()
# Create an offload-bundle from the assembled object files. This needs the clang-offload-bundler tool.
find_program(
OFFLOAD_BUNDLER_COMMAND clang-offload-bundler
OFFLOAD_BUNDLER_COMMAND
clang-offload-bundler
PATH_SUFFIXES bin
PATHS
${ROCM_ROOT}/llvm
${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED)
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED
)
# Generate object bundle.
# The invocation to generate is
@ -132,9 +159,19 @@ set(BUNDLE_INPUTS "-input=${NULDEV}") @@ -132,9 +159,19 @@ set(BUNDLE_INPUTS "-input=${NULDEV}")
# Generate BUNDLE_OBJECTS as a string of: ${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}
set(BUNDLE_OBJECTS "")
foreach(HIP_ARCHITECTURE ${GPU_ARCHITECTURES})
set(BUNDLE_TARGETS "${BUNDLE_TARGETS},hipv4-amdgcn-amd-amdhsa--${HIP_ARCHITECTURE}")
list(APPEND BUNDLE_INPUTS "-input=${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}")
list(APPEND BUNDLE_OBJECTS "${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}")
set(BUNDLE_TARGETS
"${BUNDLE_TARGETS},hipv4-amdgcn-amd-amdhsa--${HIP_ARCHITECTURE}"
)
list(
APPEND
BUNDLE_INPUTS
"-input=${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}"
)
list(
APPEND
BUNDLE_OBJECTS
"${CMAKE_CURRENT_BINARY_DIR}/main_${HIP_ARCHITECTURE}.${OBJ_TYPE}"
)
endforeach()
# Invoke clang-offload-bundler to generate an offload bundle.
@ -142,44 +179,37 @@ set(BUNDLE "${CMAKE_CURRENT_BINARY_DIR}/offload_bundle.hipfb") @@ -142,44 +179,37 @@ set(BUNDLE "${CMAKE_CURRENT_BINARY_DIR}/offload_bundle.hipfb")
add_custom_command(
OUTPUT "${BUNDLE}"
COMMAND
"${OFFLOAD_BUNDLER_COMMAND}"
-type=o
-bundle-align=4096
"${BUNDLE_TARGETS}"
${BUNDLE_INPUTS}
"-output=${BUNDLE}"
"${OFFLOAD_BUNDLER_COMMAND}" -type=o -bundle-align=4096
"${BUNDLE_TARGETS}" ${BUNDLE_INPUTS} "-output=${BUNDLE}"
DEPENDS ${BUNDLE_OBJECTS}
VERBATIM)
VERBATIM
)
# Create the device binary by assembling the template that includes
# the offload bundle that was just generated using an .incbin directive.
# This needs an assembler.
find_program(
LLVM_MC_COMMAND llvm-mc
LLVM_MC_COMMAND
llvm-mc
PATH_SUFFIXES bin
PATHS
${ROCM_ROOT}/llvm
${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED)
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED
)
# Invoke llvm-mc to generate an object file containing the offload bundle.
set(DEVICE_OBJECT "${CMAKE_CURRENT_BINARY_DIR}/main_device.${OBJ_TYPE}")
add_custom_command(
OUTPUT "${DEVICE_OBJECT}"
COMMAND
"${LLVM_MC_COMMAND}"
-triple "${HOST_TARGET}"
"${CMAKE_CURRENT_SOURCE_DIR}/${HIP_OBJ_GEN_FILE}"
-o "${DEVICE_OBJECT}"
"${LLVM_MC_COMMAND}" -triple "${HOST_TARGET}"
"${CMAKE_CURRENT_SOURCE_DIR}/${HIP_OBJ_GEN_FILE}" -o "${DEVICE_OBJECT}"
--filetype=obj
DEPENDS "${BUNDLE}"
VERBATIM)
VERBATIM
)
# Finally, create the executable.
add_executable(
${example_name}
main.hip
${DEVICE_OBJECT})
add_executable(${example_name} main.hip ${DEVICE_OBJECT})
# Make example runnable using ctest
add_test(${example_name} ${example_name})

18
HIP-Basic/matrix_multiplication/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

27
HIP-Basic/module_api/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,9 @@ set(GPU_RUNTIME "HIP" CACHE STRING "Switches between HIP and CUDA") @@ -29,7 +29,9 @@ set(GPU_RUNTIME "HIP" CACHE STRING "Switches between HIP and CUDA")
# Only supported on HIP (not CUDA)
if(NOT "${GPU_RUNTIME}" STREQUAL "HIP")
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be HIP.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be HIP."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -39,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -39,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
@ -62,12 +72,15 @@ target_compile_options(${example_name}_module PRIVATE --cuda-device-only) @@ -62,12 +72,15 @@ target_compile_options(${example_name}_module PRIVATE --cuda-device-only)
# Copy the code object next to the executable
add_custom_command(
TARGET ${example_name}
TARGET ${example_name}
POST_BUILD
COMMAND "${CMAKE_COMMAND}"
ARGS -E copy $<TARGET_OBJECTS:${example_name}_module> $<TARGET_FILE_DIR:${example_name}>/module.co
ARGS
-E copy $<TARGET_OBJECTS:${example_name}_module>
$<TARGET_FILE_DIR:${example_name}>/module.co
COMMAND_EXPAND_LISTS
COMMENT "Copying HIP code object for ${example_name}")
COMMENT "Copying HIP code object for ${example_name}"
)
add_dependencies(${example_name} ${example_name}_module)
# Make example runnable using ctest

18
HIP-Basic/moving_average/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
HIP-Basic/multi_gpu_data_transfer/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
HIP-Basic/occupancy/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
HIP-Basic/opengl_interop/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
HIP-Basic/runtime_compilation/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
HIP-Basic/saxpy/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

18
HIP-Basic/shared_memory/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

23
HIP-Basic/static_host_library/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
@ -60,7 +70,10 @@ add_library(${library_name} STATIC library/library.hip) @@ -60,7 +70,10 @@ add_library(${library_name} STATIC library/library.hip)
target_include_directories(${library_name} PRIVATE ${include_dirs})
target_include_directories(${library_name} PUBLIC library)
set_target_properties(${library_name} PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_source_files_properties(library/library.hip PROPERTIES LANGUAGE ${GPU_RUNTIME})
set_source_files_properties(
library/library.hip
PROPERTIES LANGUAGE ${GPU_RUNTIME}
)
# Create a driver executable using ROCm's bundled version of clang.
add_executable(${example_name} main.cpp)

18
HIP-Basic/streams/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

23
HIP-Basic/texture_management/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
@ -53,7 +63,10 @@ add_test(${example_name} ${example_name}) @@ -53,7 +63,10 @@ add_test(${example_name} ${example_name})
# Temporary workaround: a known bug prevents the example from executing succesfully
# if multiple GPUs are visible
set_tests_properties(${example_name} PROPERTIES ENVIRONMENT "HIP_VISIBLE_DEVICES=0")
set_tests_properties(
${example_name}
PROPERTIES ENVIRONMENT "HIP_VISIBLE_DEVICES=0"
)
set(include_dirs "../../Common")
if(GPU_RUNTIME STREQUAL "CUDA")

35
HIP-Basic/vulkan_interop/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
@ -61,19 +71,30 @@ set(SHADER_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") @@ -61,19 +71,30 @@ set(SHADER_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
add_custom_command(
OUTPUT "${SHADER_BINARY_DIR}/sinewave.vert.spv.h"
COMMAND ${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE} -V100 --vn sinewave_vert -o "${SHADER_BINARY_DIR}/sinewave.vert.spv.h" "${CMAKE_CURRENT_SOURCE_DIR}/sinewave.vert"
COMMAND
${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE} -V100 --vn sinewave_vert -o
"${SHADER_BINARY_DIR}/sinewave.vert.spv.h"
"${CMAKE_CURRENT_SOURCE_DIR}/sinewave.vert"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/sinewave.vert"
COMMENT "Compiling vertex shader"
)
add_custom_command(
OUTPUT "${SHADER_BINARY_DIR}/sinewave.frag.spv.h"
COMMAND ${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE} -V100 --vn sinewave_frag -o "${SHADER_BINARY_DIR}/sinewave.frag.spv.h" "${CMAKE_CURRENT_SOURCE_DIR}/sinewave.frag"
COMMAND
${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE} -V100 --vn sinewave_frag -o
"${SHADER_BINARY_DIR}/sinewave.frag.spv.h"
"${CMAKE_CURRENT_SOURCE_DIR}/sinewave.frag"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/sinewave.frag"
COMMENT "Compiling fragment shader"
)
add_custom_target(shaders DEPENDS "${SHADER_BINARY_DIR}/sinewave.vert.spv.h" "${SHADER_BINARY_DIR}/sinewave.frag.spv.h")
add_custom_target(
shaders
DEPENDS
"${SHADER_BINARY_DIR}/sinewave.vert.spv.h"
"${SHADER_BINARY_DIR}/sinewave.frag.spv.h"
)
list(APPEND include_dirs ${SHADER_BINARY_DIR})
add_dependencies(${example_name} shaders)

18
HIP-Basic/warp_shuffle/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,9 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
set(ERROR_MESSAGE "GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA.")
set(ERROR_MESSAGE
"GPU_RUNTIME is set to \"${GPU_RUNTIME}\".\nGPU_RUNTIME must be either HIP or CUDA."
)
message(FATAL_ERROR ${ERROR_MESSAGE})
endif()
@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -40,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

4
Libraries/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -25,7 +25,7 @@ project(Libraries LANGUAGES NONE) @@ -25,7 +25,7 @@ project(Libraries LANGUAGES NONE)
# CMake configuration files for CUDA versions of HIP libraries are not yet
# included under the HIP SDK for Windows.
if (NOT (CMAKE_SYSTEM_NAME MATCHES Windows AND "${GPU_RUNTIME}" STREQUAL "CUDA"))
if(NOT (CMAKE_SYSTEM_NAME MATCHES Windows AND "${GPU_RUNTIME}" STREQUAL "CUDA"))
add_subdirectory(hipBLAS)
add_subdirectory(hipCUB)
add_subdirectory(hipSOLVER)

14
Libraries/hipBLAS/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -24,9 +24,17 @@ cmake_minimum_required(VERSION 3.21 FATAL_ERROR) @@ -24,9 +24,17 @@ cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(hipBLAS_examples LANGUAGES NONE)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

19
Libraries/hipBLAS/gemm_strided_batched/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -39,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -39,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

19
Libraries/hipBLAS/her/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -39,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -39,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

19
Libraries/hipBLAS/scal/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -39,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -39,9 +42,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/hipCUB/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -24,9 +24,17 @@ cmake_minimum_required(VERSION 3.21 FATAL_ERROR) @@ -24,9 +24,17 @@ cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(hipCUB_examples LANGUAGES CXX)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

17
Libraries/hipCUB/device_radix_sort/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -47,14 +50,8 @@ find_package(hipcub REQUIRED) @@ -47,14 +50,8 @@ find_package(hipcub REQUIRED)
add_executable(${example_name} main.hip)
add_test(${example_name} ${example_name})
target_link_libraries(${example_name}
PRIVATE
hip::hipcub
)
target_include_directories(${example_name}
PRIVATE
"../../../Common"
)
target_link_libraries(${example_name} PRIVATE hip::hipcub)
target_include_directories(${example_name} PRIVATE "../../../Common")
set_source_files_properties(main.hip PROPERTIES LANGUAGE ${GPU_RUNTIME})
if(WIN32)
target_compile_definitions(${example_name} PRIVATE WIN32)

17
Libraries/hipCUB/device_sum/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -47,14 +50,8 @@ find_package(hipcub REQUIRED) @@ -47,14 +50,8 @@ find_package(hipcub REQUIRED)
add_executable(${example_name} main.hip)
add_test(${example_name} ${example_name})
target_link_libraries(${example_name}
PRIVATE
hip::hipcub
)
target_include_directories(${example_name}
PRIVATE
"../../../Common"
)
target_link_libraries(${example_name} PRIVATE hip::hipcub)
target_include_directories(${example_name} PRIVATE "../../../Common")
set_source_files_properties(main.hip PROPERTIES LANGUAGE ${GPU_RUNTIME})
if(WIN32)
target_compile_definitions(${example_name} PRIVATE WIN32)

21
Libraries/hipSOLVER/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -24,16 +24,27 @@ cmake_minimum_required(VERSION 3.21 FATAL_ERROR) @@ -24,16 +24,27 @@ cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(hipSOLVER_examples LANGUAGES NONE)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
find_package(hipsolver)
if(NOT hipsolver_FOUND)
message(STATUS "hipSOLVER could not be found, not building hipSOLVER examples")
message(
STATUS
"hipSOLVER could not be found, not building hipSOLVER examples"
)
return()
endif()
@ -50,6 +61,6 @@ add_subdirectory(sygvd) @@ -50,6 +61,6 @@ add_subdirectory(sygvd)
# this example currently does not work with CUDA
# https://github.com/ROCmSoftwarePlatform/hipSOLVER/issues/152
if (NOT ("${GPU_RUNTIME}" STREQUAL "CUDA"))
if(NOT ("${GPU_RUNTIME}" STREQUAL "CUDA"))
add_subdirectory(sygvj)
endif()

19
Libraries/hipSOLVER/gels/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

19
Libraries/hipSOLVER/geqrf/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

19
Libraries/hipSOLVER/gesvd/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

19
Libraries/hipSOLVER/getrf/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

19
Libraries/hipSOLVER/potrf/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

20
Libraries/hipSOLVER/syevd/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
@ -67,4 +78,3 @@ if(CMAKE_SYSTEM_NAME MATCHES Windows) @@ -67,4 +78,3 @@ if(CMAKE_SYSTEM_NAME MATCHES Windows)
install(IMPORTED_RUNTIME_ARTIFACTS CUDA::cusolver)
endif()
endif()

19
Libraries/hipSOLVER/syevdx/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

19
Libraries/hipSOLVER/syevj/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

19
Libraries/hipSOLVER/syevj_batched/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

19
Libraries/hipSOLVER/sygvd/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

19
Libraries/hipSOLVER/sygvj/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -29,7 +29,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
enable_language(${GPU_RUNTIME})
@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF) @@ -38,9 +41,17 @@ set(CMAKE_${GPU_RUNTIME}_EXTENSIONS OFF)
set(CMAKE_${GPU_RUNTIME}_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocBLAS/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,9 +29,17 @@ if(GPU_RUNTIME STREQUAL "CUDA") @@ -29,9 +29,17 @@ if(GPU_RUNTIME STREQUAL "CUDA")
endif()
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocBLAS/level_1/axpy/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocBLAS/level_1/dot/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocBLAS/level_1/nrm2/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocBLAS/level_1/scal/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocBLAS/level_1/swap/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocBLAS/level_2/gemv/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocBLAS/level_2/her/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocBLAS/level_3/gemm/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocBLAS/level_3/gemm_strided_batched/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocPRIM/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,9 +29,17 @@ if(GPU_RUNTIME STREQUAL "CUDA") @@ -29,9 +29,17 @@ if(GPU_RUNTIME STREQUAL "CUDA")
endif()
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

12
Libraries/rocPRIM/block_sum/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -38,14 +38,8 @@ find_package(rocprim REQUIRED) @@ -38,14 +38,8 @@ find_package(rocprim REQUIRED)
add_executable(${example_name} main.hip)
add_test(${example_name} ${example_name})
target_link_libraries(${example_name}
PRIVATE
roc::rocprim
)
target_include_directories(${example_name}
PRIVATE
"../../../Common"
)
target_link_libraries(${example_name} PRIVATE roc::rocprim)
target_include_directories(${example_name} PRIVATE "../../../Common")
if(WIN32)
target_compile_definitions(${example_name} PRIVATE WIN32)
endif()

12
Libraries/rocPRIM/device_sum/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -38,14 +38,8 @@ find_package(rocprim REQUIRED) @@ -38,14 +38,8 @@ find_package(rocprim REQUIRED)
add_executable(${example_name} main.hip)
add_test(${example_name} ${example_name})
target_link_libraries(${example_name}
PRIVATE
roc::rocprim
)
target_include_directories(${example_name}
PRIVATE
"../../../Common"
)
target_link_libraries(${example_name} PRIVATE roc::rocprim)
target_include_directories(${example_name} PRIVATE "../../../Common")
if(WIN32)
target_compile_definitions(${example_name} PRIVATE WIN32)
endif()

14
Libraries/rocRAND/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -24,9 +24,17 @@ cmake_minimum_required(VERSION 3.21 FATAL_ERROR) @@ -24,9 +24,17 @@ cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(rocRAND_examples LANGUAGES CXX)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

7
Libraries/rocRAND/simple_distributions_cpp/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA") @@ -30,7 +30,10 @@ set(GPU_RUNTIMES "HIP" "CUDA")
set_property(CACHE GPU_RUNTIME PROPERTY STRINGS ${GPU_RUNTIMES})
if(NOT "${GPU_RUNTIME}" IN_LIST GPU_RUNTIMES)
message(FATAL_ERROR "Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}")
message(
FATAL_ERROR
"Only the following values are accepted for GPU_RUNTIME: ${GPU_RUNTIMES}"
)
endif()
if(GPU_RUNTIME STREQUAL "CUDA")

24
Libraries/rocSOLVER/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,22 +29,36 @@ if(GPU_RUNTIME STREQUAL "CUDA") @@ -29,22 +29,36 @@ if(GPU_RUNTIME STREQUAL "CUDA")
endif()
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
find_package(rocblas)
if(NOT rocblas_FOUND)
message(STATUS "rocBLAS could not be found, not building rocSOLVER examples")
message(
STATUS
"rocBLAS could not be found, not building rocSOLVER examples"
)
return()
endif()
find_package(rocsolver)
if(NOT rocsolver_FOUND)
message(STATUS "rocSOLVER could not be found, not building rocSOLVER examples")
message(
STATUS
"rocSOLVER could not be found, not building rocSOLVER examples"
)
return()
endif()

16
Libraries/rocSOLVER/getf2/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_HIP_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_HIP_EXTENSIONS OFF)
set(CMAKE_HIP_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
@ -57,4 +65,4 @@ target_include_directories(${example_name} PRIVATE "../../../Common") @@ -57,4 +65,4 @@ target_include_directories(${example_name} PRIVATE "../../../Common")
install(TARGETS ${example_name})
if(CMAKE_SYSTEM_NAME MATCHES Windows)
install(IMPORTED_RUNTIME_ARTIFACTS roc::rocsolver)
endif()
endif()

14
Libraries/rocSOLVER/getri/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -36,9 +36,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -36,9 +36,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

16
Libraries/rocSOLVER/syev/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_HIP_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_HIP_EXTENSIONS OFF)
set(CMAKE_HIP_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
@ -57,4 +65,4 @@ target_include_directories(${example_name} PRIVATE "../../../Common") @@ -57,4 +65,4 @@ target_include_directories(${example_name} PRIVATE "../../../Common")
install(TARGETS ${example_name})
if(CMAKE_SYSTEM_NAME MATCHES Windows)
install(IMPORTED_RUNTIME_ARTIFACTS roc::rocsolver)
endif()
endif()

14
Libraries/rocSOLVER/syev_batched/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_HIP_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_HIP_EXTENSIONS OFF)
set(CMAKE_HIP_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

16
Libraries/rocSOLVER/syev_strided_batched/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_HIP_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_HIP_EXTENSIONS OFF)
set(CMAKE_HIP_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
@ -57,4 +65,4 @@ target_include_directories(${example_name} PRIVATE "../../../Common") @@ -57,4 +65,4 @@ target_include_directories(${example_name} PRIVATE "../../../Common")
install(TARGETS ${example_name})
if(CMAKE_SYSTEM_NAME MATCHES Windows)
install(IMPORTED_RUNTIME_ARTIFACTS roc::rocsolver)
endif()
endif()

19
Libraries/rocSPARSE/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -29,16 +29,27 @@ if(GPU_RUNTIME STREQUAL "CUDA") @@ -29,16 +29,27 @@ if(GPU_RUNTIME STREQUAL "CUDA")
endif()
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")
find_package(rocsparse)
if(NOT rocsparse_FOUND)
message(STATUS "rocSPARSE could not be found, not building rocSPARSE examples")
message(
STATUS
"rocSPARSE could not be found, not building rocSPARSE examples"
)
return()
endif()

14
Libraries/rocSPARSE/level_2/bsrmv/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_2/bsrsv/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_2/bsrxmv/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_2/coomv/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_2/csrmv/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_2/csrsv/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_2/ellmv/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_2/gebsrmv/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_2/gemvi/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_2/spmv/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_2/spsv/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_3/bsrmm/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_3/bsrsm/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_3/csrmm/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_3/csrsm/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_3/gebsrmm/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_3/gemmi/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_3/sddmm/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_3/spmm/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/level_3/spsm/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

14
Libraries/rocSPARSE/preconditioner/bsric0/CMakeLists.txt

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF) @@ -37,9 +37,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(ROCM_ROOT "$ENV{HIP_PATH}" CACHE PATH "Root directory of the ROCm installation")
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")
set(ROCM_ROOT
"/opt/rocm"
CACHE PATH
"Root directory of the ROCm installation"
)
endif()
list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}")

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save