llvm / llvm/llvm-project

[flang] Flang requiring openmp for a cuda compilation

Open
#161,012 0 comments 0 reactions 0 assignees View on GitHub
cuda flang
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

I a mtrying to compile fortran cuda code, after building the flang-rt for cuda offloading, and when i run this command:
```
flang --offload-targets=nvptx64-nvidia-cuda -static-libflangrt -v --offload-arch=sm_89 --offloadlib \
test_cuda_fortran.cuf -L"$CUDA_LIB64" \
-lcudart_static -lcudadevrt -ldl -lrt -lpthread -lm \
-o test_cuda_fortran
```
I get the error:
```log
flang-21: error: '-fopenmp-targets' must be used in conjunction with a '-fopenmp' option compatible with offloading; e.g., '-fopenmp=libomp' or '-fopenmp=libiomp5'
```
now, am i doing something wrong, or is it a bug in flang? I don't use any openmp code in the file I'm trying to compile, so I don't see why should openmp be involved or needed.
version used is 21.1.2.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.