Skip to content
Snippets Groups Projects
Commit 4f96ec3c authored by Jan Siwiec's avatar Jan Siwiec
Browse files

Update nvidia-hip.md

parent aaa80a7e
No related branches found
No related tags found
No related merge requests found
Pipeline #29505 failed
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
ROCm HIP allows developers to convert [CUDA code][a] to portable C++. The same source code can be compiled to run on NVIDIA or AMD GPUs. ROCm HIP allows developers to convert [CUDA code][a] to portable C++. The same source code can be compiled to run on NVIDIA or AMD GPUs.
## This page documents the use of pre-built Singularity / apptainer image on karolina Accelerated nodes (acnXX) This page documents the use of pre-built Singularity/apptainer image on Karolina Accelerated nodes (acn).
## Installed Versions of Singularity / apptainer ## Installed Versions of Singularity / apptainer
...@@ -21,21 +21,25 @@ module load apptainer/1.1.5 ...@@ -21,21 +21,25 @@ module load apptainer/1.1.5
``` ```
Run the container: Run the container:
```console ```console
singularity shell /home/vic0092/rocm/centos7-nvidia-rocm.sif singularity shell /home/vic0092/rocm/centos7-nvidia-rocm.sif
``` ```
The above gives you Singularity / apptainer shell prompt: The above gives you Singularity / apptainer shell prompt:
```console ```console
Singularity> Singularity>
``` ```
Verify that you have GPUs active and accessible on the given node: Verify that you have GPUs active and accessible on the given node:
```console ```console
nvidia-smi nvidia-smi
``` ```
You should get output similar to: You should get output similar to:
```console ```console
+-----------------------------------------------------------------------------+ +-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.65.07 Driver Version: 515.65.07 CUDA Version: 11.7 | | NVIDIA-SMI 515.65.07 Driver Version: 515.65.07 CUDA Version: 11.7 |
...@@ -173,12 +177,14 @@ int main(int argc, char *argv[]) ...@@ -173,12 +177,14 @@ int main(int argc, char *argv[])
``` ```
First convert the CUDA sample code into HIP code: First convert the CUDA sample code into HIP code:
```console ```console
cd /tmp cd /tmp
/opt/rocm/hip/bin/hipify-perl sample.cu > sample.cpp /opt/rocm/hip/bin/hipify-perl sample.cu > sample.cpp
``` ```
This code can then be compiled using the following commands: This code can then be compiled using the following commands:
```console ```console
cd /tmp cd /tmp
export HIP_PLATFORM=$( /opt/rocm/hip/bin/hipconfig --platform ) export HIP_PLATFORM=$( /opt/rocm/hip/bin/hipconfig --platform )
...@@ -187,6 +193,7 @@ $HIPCC sample.cpp -o sample ...@@ -187,6 +193,7 @@ $HIPCC sample.cpp -o sample
``` ```
Running it, you should get the following output: Running it, you should get the following output:
```console ```console
Singularity> cd /tmp Singularity> cd /tmp
Singularity> ./sample Singularity> ./sample
...@@ -200,6 +207,4 @@ info: check result ...@@ -200,6 +207,4 @@ info: check result
PASSED! PASSED!
``` ```
That's all folks!
[a]: nvidia-cuda.md [a]: nvidia-cuda.md
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment