Skip to content

Commit 1d7206d

Browse files
authored
Added ability to build for local gpu by env Variable (#204)
* Added the ability to compile for Local gpu by environment variable * adding gfx950 on default only on rocm 7.0 and above * Updated docs * removed xnack+ on specific gfx targets --------- Co-authored-by: Yiltan Hassan Temucin <yiltan.temucin@amd.com> [ROCm/rocshmem commit: be630d9]
1 parent 56eb68b commit 1d7206d

File tree

4 files changed

+45
-5
lines changed

4 files changed

+45
-5
lines changed

projects/rocshmem/CMakeLists.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ include(ROCMCheckTargetIds)
9292

9393
rocm_setup_version(VERSION ${VERSION_STRING})
9494

95+
9596
#############################################################################
9697
# SET GPU ARCHITECTURES
9798
#############################################################################
@@ -100,10 +101,15 @@ include(cmake/rocm_local_targets.cmake)
100101
set(DEFAULT_GPUS
101102
gfx90a:xnack-;
102103
gfx90a:xnack+;
103-
gfx942:xnack-;
104-
gfx942:xnack+;
105-
gfx950:xnack-;
106-
gfx950:xnack+)
104+
gfx942)
105+
106+
if(${ROCM_MAJOR_VERSION} GREATER 6)
107+
list(APPEND DEFAULT_GPUS gfx950)
108+
endif()
109+
110+
if($ENV{BUILD_LOCAL_GPU_TARGET_ONLY})
111+
set(BUILD_LOCAL_GPU_TARGET_ONLY ON)
112+
endif()
107113

108114
if (BUILD_LOCAL_GPU_TARGET_ONLY)
109115
message(STATUS "Building only for local GPU target")

projects/rocshmem/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ rocSHMEM base requirements:
2828
* AMD GPUs
2929
* MI250X
3030
* MI300X
31+
* MI350X (Requires ROCm 7.0 or later)
3132
* ROCm-aware Open MPI and UCX as described in
3233
[Building the Dependencies](#building-the-dependencies)
3334

projects/rocshmem/cmake/setup_project.cmake

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,37 @@ set(CMAKE_BUILD_TYPE "Release" CACHE STRING
3131
###############################################################################
3232
# GLOBAL COMPILE FLAGS
3333
###############################################################################
34+
35+
# Try to establish ROCM_PATH (for find_package)
36+
#==================================================================================================
37+
if(NOT DEFINED ROCM_PATH)
38+
# Guess default location
39+
set(ROCM_PATH "/opt/rocm")
40+
message(WARNING "Unable to find ROCM_PATH: Falling back to ${ROCM_PATH}")
41+
else()
42+
message(STATUS "ROCM_PATH found: ${ROCM_PATH}")
43+
endif()
44+
set(ENV{ROCM_PATH} ${ROCM_PATH})
45+
46+
## Check for ROCm version
47+
48+
if(ROCM_PATH)
49+
message(STATUS "Reading ROCM version from ${ROCM_PATH}/.info/version")
50+
file(READ "${ROCM_PATH}/.info/version" rocm_version_string)
51+
else()
52+
message(FATAL_ERROR "Could not determine ROCM version (set EXPLICIT_ROCM_VERSION or set ROCM_PATH to a valid installation)")
53+
endif()
54+
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" rocm_version_matches ${rocm_version_string})
55+
if (rocm_version_matches)
56+
set(ROCM_MAJOR_VERSION ${CMAKE_MATCH_1})
57+
set(ROCM_MINOR_VERSION ${CMAKE_MATCH_2})
58+
set(ROCM_PATCH_VERSION ${CMAKE_MATCH_3})
59+
60+
message(STATUS "ROCm version: ${ROCM_MAJOR_VERSION}.${ROCM_MINOR_VERSION}.${ROCM_PATCH_VERSION}")
61+
else()
62+
message(WARNING "Failed to extract ROCm version.")
63+
endif()
64+
3465
foreach (root ${hip_ROOT} $ENV{hip_ROOT} ${ROCM_ROOT} $ENV{ROCM_ROOT} ${ROCM_PATH} $ENV{ROCM_PATH})
3566
if (IS_DIRECTORY ${root})
3667
list(PREPEND CMAKE_PREFIX_PATH ${root})

projects/rocshmem/docs/install.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Requirements
2121

2222
* MI300X
2323

24+
* MI350X (Requires ROCm 7.0 or later)
25+
2426
* ROCm-aware Open MPI and UCX. For more information, see :ref:`install-dependencies`.
2527

2628
* Inter-node communication requires MPI, and is tested with Open MPI and CX7 Infiniband NICs.
@@ -34,7 +36,7 @@ rocSHMEM supports two network backends:
3436
* The **RO (Reverse Offload)** backend enables communication between GPUs on different nodes through a NIC, using a host-based proxy to forward communication orders to and from the GPU. In this release, RO is the only inter-node communication backend and is built on an MPI-RMA compatibility layer.
3537

3638

37-
You can activate IPC and RO backends in the same rocSHMEM build. In this case, IPC handles intra-node communication, while RO handles inter-node communication.
39+
You can activate IPC and RO backends in the same rocSHMEM build. In this case, IPC handles intra-node communication, while RO handles inter-node communication.
3840

3941
.. note::
4042

0 commit comments

Comments
 (0)