Skip to content

[flang] Flang requiring openmp for a cuda compilation #161012

@Nir-Cohen-2003

Description

@Nir-Cohen-2003

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cudaflangFlang issues not falling into any other category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions