Skip to content

Commit

Permalink
rocm sdk documentation update
Browse files Browse the repository at this point in the history
- fixes: #65

Signed-off-by: Mika Laitio <[email protected]>
  • Loading branch information
lamikr committed Oct 9, 2024
1 parent f12f82b commit ca2fd52
Show file tree
Hide file tree
Showing 7 changed files with 424 additions and 173 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ docs/examples/openmpi/mpi_msg_ping/mpi_msg_ping
packages
envsetup_pre.sh
node_modules
docs/examples/llm/vllm/sys
490 changes: 318 additions & 172 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions binfo/core/001_rocm_core.binfo
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ BINFO_APP_POST_INSTALL_CMD_ARRAY=(
"install -d ${INSTALL_DIR_PREFIX_SDK_ROOT}/docs/examples/opencl/hello_world"
"install -Dm660 ${SDK_ROOT_DIR}/docs/examples/opencl/hello_world/Makefile ${INSTALL_DIR_PREFIX_SDK_ROOT}/docs/examples/opencl/hello_world"
"install -Dm660 ${SDK_ROOT_DIR}/docs/examples/opencl/hello_world/*.c* ${INSTALL_DIR_PREFIX_SDK_ROOT}/docs/examples/opencl/hello_world"
"install -Dm750 ${SDK_ROOT_DIR}/docs/examples/opencl/hello_world/*.sh ${INSTALL_DIR_PREFIX_SDK_ROOT}/docs/examples/opencl/hello_world"
"install -d ${INSTALL_DIR_PREFIX_SDK_ROOT}/docs/examples/llm/vllm"
"install -Dm660 ${SDK_ROOT_DIR}/docs/examples/llm/vllm/*.txt ${INSTALL_DIR_PREFIX_SDK_ROOT}/docs/examples/llm/vllm"
"install -Dm660 ${SDK_ROOT_DIR}/docs/examples/llm/vllm/*.py ${INSTALL_DIR_PREFIX_SDK_ROOT}/docs/examples/llm/vllm"
Expand Down
2 changes: 1 addition & 1 deletion binfo/envsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fi
echo "ROCM_TARGET_TRIPLED: ${ROCM_TARGET_TRIPLED}"
echo "ROCM_PYTHON_VERSION: ${ROCM_PYTHON_VERSION}"

# set INSTALL_DIR_PREFIX_SDK_ROOT only if it not already set in the user environment variable or user_config.sh
# set INSTALL_DIR_PREFIX_SDK_ROOT only if it is not already set in the user environment variable or in ./envsetup_pre.sh
INSTALL_DIR_PREFIX_SDK_ROOT="${INSTALL_DIR_PREFIX_SDK_ROOT:-/opt/rocm_sdk_${ROCM_MAJOR_VERSION}${ROCM_MINOR_VERSION}${ROCM_PATCH_VERSION}}"
export INSTALL_DIR_PREFIX_SDK_ROOT
echo "INSTALL_DIR_PREFIX_SDK_ROOT: $INSTALL_DIR_PREFIX_SDK_ROOT"
Expand Down
103 changes: 103 additions & 0 deletions docs/examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Example Applications

## Setup the rocm_sdk

ROCm SDK builder environment needs to be first set to environment variables
like path with following command:

```
# source /opt/rocm_sdk_612/bin/env_rocm.sh
```
Note that this command needs to be executed only once for each bash terminal session evenghouth we set it up on exery example below.

## Test Pytorch Install

```
# source /opt/rocm_sdk_612/bin/env_rocm.sh
# cd /opt/rocm_sdk_612/docs/examples/pytorch
# ./run_pytorch_gpu_simple_test.sh
```

## Test Jupyter-notebook usage with Pytorch.

Following command will test that jupyter-notebook opens properly and
show information about installed pytorch version and your GPU.
(Note that AMD gpus are also handled as a cuda GPU on pytorch language)

```
# source /opt/rocm_sdk_612/bin/env_rocm.sh
# cd /opt/rocm_sdk_612/docs/examples/pytorch
# jupyter-notebook pytorch_amd_gpu_intro.ipynb
```

## Test Pytorch MIGraphX integration

```
# source /opt/rocm_sdk_612/bin/env_rocm.sh
# cd /opt/rocm_sdk_612/docs/examples/pytorch
# python test_torch_migraphx_resnet50.py
```

## Test MIGraphX

```
# source /opt/rocm_sdk_612/bin/env_rocm.sh
# cd /opt/rocm_sdk_612/docs/examples/migraphx
# ./test_migraphx_install.sh
```

## Test ONNXRuntime

```
# source /opt/rocm_sdk_612/bin/env_rocm.sh
# cd /opt/rocm_sdk_612/docs/examples/onnxruntime
# test_onnxruntime_providers.py*
```

This should printout: ['MIGraphXExecutionProvider', 'ROCMExecutionProvider', 'CPUExecutionProvider']

## Test HIPCC compiler

Following code shows how to transfer data to GPU and back
by using hipcc.

```
# source /opt/rocm_sdk_612/bin/env_rocm.sh
# cd /opt/rocm_sdk_612/docs/examples/hipcc/hello_world
# ./build.sh
```

## Test OpenCL Integration

Following code printouts some information about OpenCL platform and devices found

```
# source /opt/rocm_sdk_612/bin/env_rocm.sh
# cd /opt/rocm_sdk_612/docs/examples/opencl/check_opencl_caps
# make
# ./check_opencl_caps
```

Following code sends 200 numbers for GPU kernels which modifies and sends them back to userspace.

```
# source /opt/rocm_sdk_612/bin/env_rocm.sh
# cd /opt/rocm_sdk_612/docs/examples/opencl/hello_world
# make
# ./hello_world
```

## Run Pytorch GPU Benchmark

This test is pretty extensive and takes about 50 minutes on RX 6800.
Test results are collected to result-folder but the python code which
is supposed to parse the results from CSV files and plot pictures needs to be fixed.

Results for different AMD and Nvidia GPUs are available in results folder.

```
# git clone https://github.com/lamikr/pytorch-gpu-benchmark/
# cd pytorch-gpu-benchmark
# source /opt/rocm_sdk_612/bin/env_rocm.sh
# ./test.sh
```
Binary file added docs/presentations/rocm_sdk_builder.odp
Binary file not shown.
Binary file added docs/tutorial/pics/rocm_sdk_builder_env.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ca2fd52

Please sign in to comment.