51
edits
Changes
→Instructions for AMD
3. Yunseon Lee
How to set up compiler and target offloading for Linux on AMD GPU:
Note: user should be member of 'video' group; if this doesn't help, may add user to 'render' group
[AOMP https://github.com/ROCm-Developer-Tools/aomp] is an open source Clang/LLVM based compiler with added support for the OpenMP® API on Radeon™ GPUs.
#include <omp.h>
#include <stdio.h>
int main(void)
{
#pragma omp target
#pragma omp parallel { printf("Hello world from GPU!THREAD %d\n", omp_get_thread_num()); }
}
</pre>
export AOMP="/usr/lib/aomp"
export PATH=$AOMP/bin:$PATH
export LIBOMPTARGGET_KERNEL_TRACELIBOMPTARGET_KERNEL_TRACE=1
clang -O2-fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 helloWorld.c -0 helloWorld
./helloWorld
</pre>
</pre>
== Sources ==