Hi,
I’m trying to run an application that checks if it runs on GPU or CPU.
#include <stdio.h>
#include <omp.h>
int main()
{
int runningOnGPU = 0;
/* Test if GPU is available using OpenMP4.5 */
#pragma omp target map(from:runningOnGPU)
{
if (omp_is_initial_device() == 0)
runningOnGPU = 1;
}
/*If still running on CPU, GPU must not be available */
if (runningOnGPU)
printf("### Able to use the GPU! ### \n");
else
printf("### Unable to use the GPU, using CPU! ###\n");
return 0;
}
My OS is Ubunto 18.04 LTS, VGA card - Quadro P4000, the driver is nvidia-driver-440-server and Cuda version 10.0.
I tried to follow those documents but none of them worked.
https://freecompilercamp.org/llvm-openmp-build/ - segmentation fault with this build command
clang -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda ongpu.c
https://github.com/clang-ykt/clang/wiki - build error
https://kristerw.blogspot.com/2017/04/building-gcc-with-support-for-nvidia.html - compilation error
Where can I find a document with instructions on how to build a simple OpenMP application?