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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/build_tools/configure_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
DISTRO_MAP = {
"ubuntu-22.04": {"image": "ghcr.io/rocm/rocm-examples-ubuntu-22.04:latest", "label": "Ubuntu 22.04"},
"sles-15.7": {"image": "ghcr.io/rocm/rocm-examples-sles-15.7:latest", "label": "SLES 15.7"},
"rhel-8": {"image": "ghcr.io/sshi-amd/rocm-examples-rhel-8:latest", "label": "RHEL 8"},
}

def _is_all(value):
Expand Down
2 changes: 1 addition & 1 deletion .github/build_tools/generate_skip_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

# Tests to skip per GPU target (one list per target that has skips)
SKIP_TESTS = {
# rccl is not supported on gfx1151 yet
"gfx1151": [
# rccl is not supported on gfx1151 yet
"rccl_allgather",
"rccl_allreduce",
"rccl_broadcast",
Expand Down
Empty file removed .github/build_tools/skip_tests.txt
Empty file.
39 changes: 33 additions & 6 deletions .github/workflows/build-rocm-examples-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ jobs:
echo "LD_LIBRARY_PATH=${ROCM_PATH}/lib:${ROCM_PATH}/llvm/lib:${ROCM_PATH}/lib/rocprofiler-systems" >> $GITHUB_ENV
echo "ENABLE_OPENMP=ON" >> $GITHUB_ENV

- name: Fix Vulkan SDK glslangValidator for RHEL 8
run: |
# The prebuilt glslangValidator in the Vulkan SDK requires glibc 2.34+,
# but RHEL 8 only has glibc 2.28. If a source-built version exists at
# /usr/local/bin, use it instead. Safe no-op on distros with newer glibc.
if [ -f /usr/local/bin/glslangValidator ] && [ -n "${VULKAN_SDK:-}" ] && [ -f "${VULKAN_SDK}/bin/glslangValidator" ]; then
cp /usr/local/bin/glslangValidator "${VULKAN_SDK}/bin/glslangValidator"
echo "Replaced Vulkan SDK glslangValidator with source-built version"
fi

- name: CMake configure
run: |
cmake -S . -B build -DCMAKE_HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" -DROCM_ROOT="${ROCM_PATH}" -DCMAKE_BUILD_RPATH="${ROCM_PATH}/lib" -DROCM_EXAMPLES_ENABLE_OPENMP="${ENABLE_OPENMP}" -Wno-dev 2> >(tee cmake_error.log >&2)
Expand Down Expand Up @@ -172,7 +182,9 @@ jobs:
- name: Test summary
if: ${{ !cancelled() }}
run: |
if [ ! -f ctest_output.log ]; then
LAST_TEST_LOG="build/Testing/Temporary/LastTest.log"
if [ ! -f ctest_output.log ] || [ ! -f "${LAST_TEST_LOG}" ]; then
echo "No test logs found." >> $GITHUB_STEP_SUMMARY
exit 0
fi

Expand All @@ -182,24 +194,39 @@ jobs:
SUMMARY=$(grep "tests passed" ctest_output.log)
echo "**${SUMMARY}**" >> $GITHUB_STEP_SUMMARY

FAILED=$(grep -c "Failed" ctest_output.log || true)

if [ "${FAILED}" -gt 0 ]; then
FAILED_LOG="build/Testing/Temporary/LastTestsFailed.log"
if [ -s "${FAILED_LOG}" ]; then
echo "## Failed tests" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat build/Testing/Temporary/LastTestsFailed.log >> $GITHUB_STEP_SUMMARY
cat "${FAILED_LOG}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

echo "<details><summary>Failed tests output</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
awk '/^[[:space:]]*Start[[:space:]]+[0-9]+:/ {found=0; next} /\*\*\*/ && !/Passed/ {found=1} found' ctest_output.log >> $GITHUB_STEP_SUMMARY

awk '
/^[0-9]+\/[0-9]+ Testing: / { if (inblock && failed) print block; block = $0; inblock = 1; failed = 0; seen_result = 0; next }
inblock { block = block "\n" $0 }
/^Test Failed\.$/ { failed = 1; seen_result = 1 }
/^Test Passed\.$/ { seen_result = 1 }
/^-+$/ { if (inblock && seen_result) { if (failed) print block; inblock = 0 } }
END { if (inblock && failed) print block }
' "${LAST_TEST_LOG}" >> $GITHUB_STEP_SUMMARY

echo '```' >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
fi

- name: Upload test logs
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ctest-logs-${{ inputs.distro }}-${{ matrix.gpu_config.gpu_target }}-${{ steps.sanity-check.outputs.rocm_version || steps.install-tarball.outputs.rocm_version }}-${{ matrix.install_method }}
path: build/Testing/Temporary/

- name: Clean the workspace
if: always()
run: find "$GITHUB_WORKSPACE" -mindepth 1 -delete
1 change: 1 addition & 0 deletions .github/workflows/ci_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ on:
- all
- ubuntu-22.04
- sles-15.7
- rhel-8

permissions:
contents: read
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci_therock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ on:
- all
- ubuntu-22.04
- sles-15.7
- rhel-8

permissions:
contents: read
Expand Down
1 change: 1 addition & 0 deletions Dockerfiles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ Dockerfiles:

- [ubuntu-22.04.Dockerfile](ubuntu-22.04.Dockerfile)
- [sles-15.7.Dockerfile](sles-15.7.Dockerfile)
- [rhel-8.Dockerfile](rhel-8.Dockerfile)
101 changes: 101 additions & 0 deletions Dockerfiles/rhel-8-subscription.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
FROM registry.access.redhat.com/ubi8/ubi:latest

ARG VULKAN_SDK_VERSION=1.4.335.0
ARG GLFW_VERSION=3.4
ARG GLSLANG_VERSION=13.1.1

# GPU_TARGET and THEROCK_FAMILY are set at workflow runtime, not in the base image
ENV VULKAN_SDK_VERSION=${VULKAN_SDK_VERSION}

# NOTE: This Dockerfile is for local testing only. Do not push the built image
# to a public registry — the subscription entitlements are baked into the layer.
ARG RHSM_USER
ARG RHSM_PASS
RUN subscription-manager register \
--username="${RHSM_USER}" \
--password="${RHSM_PASS}" && \
subscription-manager attach --auto && \
subscription-manager repos \
--enable codeready-builder-for-rhel-8-x86_64-rpms && \
dnf install -y \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm && \
dnf update -y && \
dnf install -y \
unzip \
xz \
gcc \
gcc-c++ \
make \
wget \
git \
curl \
python3.11 \
python3.11-pip \
elfutils-devel \
mesa-libGL-devel \
wayland-devel \
libxkbcommon-devel \
libXcursor-devel \
libXi-devel \
libXinerama-devel \
libXrandr-devel \
ffmpeg-devel && \
dnf clean all && \
ln -s /usr/include/ffmpeg/libavcodec /usr/include/libavcodec && \
ln -s /usr/include/ffmpeg/libavformat /usr/include/libavformat && \
ln -s /usr/include/ffmpeg/libavutil /usr/include/libavutil && \
subscription-manager unregister

# ============================================================================
# Python virtual environment (ready for ROCm wheel or tarball installation)
# ROCm installation is delegated to the CI workflow to support both methods
# ============================================================================

RUN python3.11 -m venv /opt/venv && \
/opt/venv/bin/pip install --upgrade pip && \
/opt/venv/bin/pip install pyyaml cmake

ENV PATH="/opt/venv/bin:${PATH}"
ENV VIRTUAL_ENV="/opt/venv"

# Build GLFW from source (not available in RHEL 8 repos)
WORKDIR /tmp
RUN wget https://github.com/glfw/glfw/releases/download/${GLFW_VERSION}/glfw-${GLFW_VERSION}.zip && \
unzip glfw-${GLFW_VERSION}.zip && \
cmake -S glfw-${GLFW_VERSION} -B glfw-${GLFW_VERSION}/build \
-DGLFW_BUILD_EXAMPLES=OFF \
-DGLFW_BUILD_TESTS=OFF \
-DGLFW_BUILD_DOCS=OFF && \
cmake --build glfw-${GLFW_VERSION}/build --target install && \
rm -rf /tmp/glfw-${GLFW_VERSION}*

# Build glslang from source (Vulkan SDK prebuilt binaries require glibc 2.34+,
# but RHEL 8 ships glibc 2.28)
RUN git clone --branch ${GLSLANG_VERSION} --depth 1 https://github.com/KhronosGroup/glslang.git && \
cmake -S glslang -B glslang/build \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_OPT=OFF \
-DENABLE_CTEST=OFF && \
cmake --build glslang/build -j$(nproc) --target glslang-standalone && \
cp glslang/build/StandAlone/glslang /usr/local/bin/glslangValidator && \
rm -rf /tmp/glslang

# Install Vulkan SDK (headers, libraries, and layers — prebuilt CLI tools are
# superseded by the glslang build above via PATH ordering)
ENV VULKAN_SDK=/opt/vulkan-sdk/${VULKAN_SDK_VERSION}/x86_64
RUN mkdir -p /opt/vulkan-sdk && \
wget https://sdk.lunarg.com/sdk/download/${VULKAN_SDK_VERSION}/linux/vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz && \
tar -xvf vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz -C /opt/vulkan-sdk && \
rm vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz

ENV PATH="/usr/local/bin:${VULKAN_SDK}/bin:${PATH}"
ENV LD_LIBRARY_PATH="${VULKAN_SDK}/lib"
ENV VK_ADD_LAYER_PATH="${VULKAN_SDK}/share/vulkan/explicit_layer.d"
ENV PKG_CONFIG_PATH="${VULKAN_SDK}/share/pkgconfig:${VULKAN_SDK}/lib/pkgconfig"

ENV HIP_PLATFORM=amd

WORKDIR /workspace

CMD ["/bin/bash"]
97 changes: 97 additions & 0 deletions Dockerfiles/rhel-8.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
FROM almalinux:8

ARG VULKAN_SDK_VERSION=1.4.335.0
ARG GLFW_VERSION=3.4
ARG GLSLANG_VERSION=13.1.1

# GPU_TARGET and THEROCK_FAMILY are set at workflow runtime, not in the base image
ENV VULKAN_SDK_VERSION=${VULKAN_SDK_VERSION}

RUN dnf install -y dnf-plugins-core && \
dnf config-manager --set-enabled powertools && \
dnf update -y && \
dnf install -y \
unzip \
xz \
gcc \
gcc-c++ \
make \
wget \
git \
curl \
nasm \
python3.11 \
python3.11-pip \
elfutils-devel \
mesa-libGL-devel \
wayland-devel \
libxkbcommon-devel \
libXcursor-devel \
libXi-devel \
libXinerama-devel \
libXrandr-devel \
libatomic && \
dnf clean all

# ============================================================================
# Python virtual environment (ready for ROCm wheel or tarball installation)
# ROCm installation is delegated to the CI workflow to support both methods
# ============================================================================

RUN python3.11 -m venv /opt/venv && \
/opt/venv/bin/pip install --upgrade pip && \
/opt/venv/bin/pip install pyyaml cmake

ENV PATH="/opt/venv/bin:${PATH}"
ENV VIRTUAL_ENV="/opt/venv"

# Build GLFW from source (not available in RHEL 8 repos)
WORKDIR /tmp
RUN wget https://github.com/glfw/glfw/releases/download/${GLFW_VERSION}/glfw-${GLFW_VERSION}.zip && \
unzip glfw-${GLFW_VERSION}.zip && \
cmake -S glfw-${GLFW_VERSION} -B glfw-${GLFW_VERSION}/build \
-DGLFW_BUILD_EXAMPLES=OFF \
-DGLFW_BUILD_TESTS=OFF \
-DGLFW_BUILD_DOCS=OFF && \
cmake --build glfw-${GLFW_VERSION}/build --target install && \
rm -rf /tmp/glfw-${GLFW_VERSION}*

# Build glslang from source (Vulkan SDK prebuilt binaries require glibc 2.34+,
# but RHEL 8 ships glibc 2.28)
RUN git clone --branch ${GLSLANG_VERSION} --depth 1 https://github.com/KhronosGroup/glslang.git && \
cmake -S glslang -B glslang/build \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_OPT=OFF \
-DENABLE_CTEST=OFF && \
cmake --build glslang/build -j$(nproc) --target glslang-standalone && \
cp glslang/build/StandAlone/glslang /usr/local/bin/glslangValidator && \
rm -rf /tmp/glslang

# Install Vulkan SDK (headers, libraries, and layers)
ENV VULKAN_SDK=/opt/vulkan-sdk/${VULKAN_SDK_VERSION}/x86_64
RUN mkdir -p /opt/vulkan-sdk && \
wget https://sdk.lunarg.com/sdk/download/${VULKAN_SDK_VERSION}/linux/vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz && \
tar -xvf vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz -C /opt/vulkan-sdk && \
rm vulkansdk-linux-x86_64-${VULKAN_SDK_VERSION}.tar.xz && \
cp /usr/local/bin/glslangValidator ${VULKAN_SDK}/bin/glslangValidator

ENV PATH="${VULKAN_SDK}/bin:${PATH}"
ENV LD_LIBRARY_PATH="${VULKAN_SDK}/lib"
ENV VK_ADD_LAYER_PATH="${VULKAN_SDK}/share/vulkan/explicit_layer.d"
ENV PKG_CONFIG_PATH="${VULKAN_SDK}/share/pkgconfig:${VULKAN_SDK}/lib/pkgconfig"

# Build FFmpeg from source (not available in RHEL 8 repos)
WORKDIR /tmp
RUN wget https://ffmpeg.org/releases/ffmpeg-4.4.6.tar.xz && \
tar -xvf ffmpeg-4.4.6.tar.xz && \
cd ffmpeg-4.4.6 && \
./configure --enable-pic --enable-shared && \
make -j$(nproc) && \
make install && \
rm -rf /tmp/ffmpeg-4.4.6*

ENV HIP_PLATFORM=amd

WORKDIR /workspace

CMD ["/bin/bash"]
11 changes: 11 additions & 0 deletions Dockerfiles/sles-15.7.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ RUN zypper -qni update -y && \
wget \
git \
curl \
nasm \
python313 \
libdw-devel \
Mesa-libGL-devel \
Expand Down Expand Up @@ -65,6 +66,16 @@ ENV LD_LIBRARY_PATH="${VULKAN_SDK}/lib"
ENV VK_ADD_LAYER_PATH="${VULKAN_SDK}/share/vulkan/explicit_layer.d"
ENV PKG_CONFIG_PATH="${VULKAN_SDK}/share/pkgconfig:${VULKAN_SDK}/lib/pkgconfig"

# build ffmpeg from source
WORKDIR /tmp
RUN wget https://ffmpeg.org/releases/ffmpeg-4.4.6.tar.xz && \
tar -xvf ffmpeg-4.4.6.tar.xz && \
cd ffmpeg-4.4.6 && \
./configure --enable-pic --enable-shared && \
make -j$(nproc) && \
make install && \
rm -rf /tmp/ffmpeg-4.4.6*

ENV HIP_PLATFORM=amd

WORKDIR /workspace
Expand Down
1 change: 1 addition & 0 deletions Dockerfiles/ubuntu-22.04.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RUN apt-get update -qq && \
libvulkan-dev \
glslang-tools \
libtiff-dev \
# libopencv-dev also installs FFmpeg dev packages
libopencv-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

__global__ void simpleKernel(double *data, std::size_t elems)
{
int idx = blockIdx.x * blockDim.x + threadIdx.x;
std::size_t idx = blockIdx.x * blockDim.x + threadIdx.x;
if(idx < elems)
data[idx] = idx * 2.0;
}
Expand All @@ -65,6 +65,25 @@ int main()
int deviceId0 = 0;
int deviceId1 = 1;

// Check whether peer-to-peer access is supported between the two devices.
int canAccessPeer01 = 0;
int canAccessPeer10 = 0;
HIP_CHECK(hipDeviceCanAccessPeer(&canAccessPeer01, deviceId0, deviceId1));
HIP_CHECK(hipDeviceCanAccessPeer(&canAccessPeer10, deviceId1, deviceId0));
if(!canAccessPeer01 || !canAccessPeer10)
{
hipDeviceProp_t props0{};
hipDeviceProp_t props1{};
HIP_CHECK(hipGetDeviceProperties(&props0, deviceId0));
HIP_CHECK(hipGetDeviceProperties(&props1, deviceId1));
std::cout << "Peer-to-peer access is not supported between device " << deviceId0
<< " (arch: " << props0.gcnArchName << ")"
<< " and device " << deviceId1
<< " (arch: " << props1.gcnArchName << ")"
<< ". Skipping example." << std::endl;
return EXIT_SUCCESS;
}

// Enable peer access to the memory (allocated and future) on the peer device.
// Ensure the device is active before enabling peer access.
HIP_CHECK(hipSetDevice(deviceId0));
Expand Down
9 changes: 8 additions & 1 deletion Libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ if(
add_subdirectory(rocALUTION)
add_subdirectory(rocBLAS)
add_subdirectory(rocCV)
add_subdirectory(rocDecode)

option(ENABLE_ROCDECODE "Enable rocDecode examples (enabled by default)" ON)
if(ENABLE_ROCDECODE)
add_subdirectory(rocDecode)
else()
message(STATUS "rocDecode examples disabled, not building rocDecode examples.")
endif()

add_subdirectory(rocJPEG)
add_subdirectory(rocFFT)
add_subdirectory(rocPRIM)
Expand Down
Loading
Loading