OpenMP offload doesn't recognize my Nvidia GPU

317 Views Asked by At

I'm trying to test OpenMP's GPU offloading on my machine with a GTX 1660ti card. Running this code gives me a 0.

#include <omp.h>
#include <stdio.h>

int main() {
    printf("%d\n", omp_get_num_devices());
    return 0;
}

I'm compiling with

./gcc -fopenmp -foffload=nvptx-none example.cpp -o example

Here are the results of running gcc -v

Using built-in specs.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/home/stefan/offload/install/libexec/gcc/x86_64-pc-linux-gnu/11.3.1/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --enable-offload-targets=nvptx-none --with-cuda-driver-include=/opt/cuda/include --with-cuda-driver-lib=/opt/cuda/lib64 --disable-bootstrap --disable-multilib --enable-languages=c,c++,fortran,lto --prefix=/home/stefan/offload/install
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.1 20221006 (GCC)

From what I can tell, I've built gcc with the GPU target correctly, as gcc doesn't tell me that nvptx-none isn't a valid offload target. Here's the results of nvidia-smi as well

Sun Oct  9 18:58:34 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.76       Driver Version: 515.76       CUDA Version: 11.7     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0  On |                  N/A |
| N/A   59C    P0    25W /  N/A |    685MiB /  6144MiB |      3%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

I can't seem to figure out what's missing.

0

There are 0 best solutions below