Changes

Jump to: navigation, search

GPU621/GPU Targeters

399 bytes added, 14:01, 18 December 2020
Instructions for AMD
3. Yunseon Lee
== Progress ==  == Difference of CPU and GPU for parallel applications (Yunseon) ==
OpenMP API specification for parallel programming provides an application programming interface (API) that supports multi-platform shared memory multiprocessing programming in C, C++, and Fortran, on most platforms. It consists of a set of compiler directives, library routines, and environment variables that influence run-time behavior.
Benefits of OpenMPIOpenMP. Why to choose over GPU kernel model?
-supports multi-core, vectorization and GPU
-allows for "teams of threads"
-portable between various plaforms
-heterogeneous memory allocation and custom data mappers
 
[More information (compare OpenMP syntax with CUDA, HIP and other):
https://github.com/ROCm-Developer-Tools/aomp/blob/master/docs/openmp_terms.md]
== Programming GPUs with OpenMP ==
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>
== Results and Graphs (Nathan/Elena) ==
To see the name of your device for (-march== Conclusions (Nathangfx803) you may run 'rocminfo' tool: <pre>$ /opt/rocm/bin/rocminfo</pre> If further problems with compiling and running, try starting with examples:https://github.com/ROCm-Developer-Tools/aomp/tree/master/Elenaexamples/Yunseon) ==openmp
== Sources ==
51
edits

Navigation menu