How to change/add target device architecture for OpenMP GPU Offload

Hello Everyone,

I have quick questions. Firstly, how can I change target device architecture? I have quick questions. Firstly, how can I change target device architecture? As far as I understood, clang uses sm_35 as default, if I don’t change anything. Another question is that, can I produce an executable using multiple device architectures?

Thanks in advance

Best

Hi,

you can pass -Xopenmp-target -march=sm_60 to target Pascal GPUs, for example.
Another option would be to build Clang with -DCLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_60 which changes the default architecture.

At the moment OpenMP offloading isn't able to target more than one architecture.

Cheers,
Jonas

Thanks Jonas! It works great! I couldn't figure it out by myself.
If you define multiple target triple, can you target multiple device architectures?

Do you mean by passing the same target multiple times to -fopenmp-targets? I think the targets are deduplicated, so you can't use that to build for multiple (GPU) architectures.