Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version of OpenMP on clang-asan? #620

Closed
aadler opened this issue Jun 6, 2024 · 11 comments
Closed

Version of OpenMP on clang-asan? #620

aadler opened this issue Jun 6, 2024 · 11 comments

Comments

@aadler
Copy link

aadler commented Jun 6, 2024

Hi. I am trying to add OpenMP SIMD instructions to the Delaporte package. The clang-asan testbed fails in compilation where the other test beds complete (except for valgrind, which we know has false positives for OpenMP). Is this an issue with the version of the ASAN compiler or is it showing something deeper I need to investigate?

@gaborcsardi
Copy link
Collaborator

Is this an issue with the version of the ASAN compiler or is it showing something deeper I need to investigate?

I don't know, sorry.

@aadler
Copy link
Author

aadler commented Jun 6, 2024

As it compiles successfully on the six standard Github testbeds and the more exotic ones on rhub, I don't think it's a problem with the code.

@aadler
Copy link
Author

aadler commented Jun 10, 2024

Originally, it seemed as if it related to a change that happened between clang-16 and clang-17, as clang 16 passes but the rest do not. However, the clang-16 implementation looks as if it is running gcc:

R was compiled by
    gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
    GNU Fortran (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
* running under: Ubuntu 22.04.4 LTS

For that matter, so does the Ubuntu-clang testbed.

I'm very confused, as usual, but it looks like clang has not completely implemented OpenMP 4.5, as it's failing on the uniform declaration for a SIMD function where gcc or mkl or intel do not. Any thoughts, @gaborcsardi ?

@gaborcsardi
Copy link
Collaborator

For the record, because the logs will be deleted soon, this is the error:

using Fortran compiler: ‘Ubuntu flang-new version 19.0.0 (++20240609042219+715a5d8d93a8-1~exp1~20240609042339.1734)’
flang-new-19 -fopenmp  -fpic  -g -O2  -c  utils.f90 -o utils.o
error: Semantic errors in utils.f90
./utils.f90:138:53: error: Internal: no symbol found for 'k'
      !$omp declare simd(imk) linear(uval(i)) uniform(k) notinbranch
                                                      ^

I think this is probably a bug or just something that flang-new hasn't implemented yet. I suggest you open an issue in the llvm repo at https://github.com/llvm/llvm-project.

@aadler
Copy link
Author

aadler commented Jun 10, 2024

Thanks; done here: llvm/llvm-project#94997.

Edit: My fear is that flang isn't quite completely OpenMP 4.5 compliant even if clang is.

@aadler
Copy link
Author

aadler commented Jun 10, 2024

Oh, and before you close this, @gaborcsardi, please check the clang16 and Ubuntu-clang testbeds as they look as if they're running gcc and not clang. Thank you!

@gaborcsardi
Copy link
Collaborator

It is clearly using clang:

  * installing *source* package ‘Delaporte’ ...
  ** using staged installation
  ** libs
  using C compiler: ‘Ubuntu clang version 16.0.6 (++20231112100510+7cbf1a259152-1~exp1~20231112100554.106)’
  using Fortran compiler: ‘GNU Fortran (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0’
  gfortran-12 -fopenmp  -fpic  -g -O2  -c  utils.f90 -o utils.o
  gfortran-12 -fopenmp  -fpic  -g -O2  -c  delaporte.f90 -o delaporte.o
  clang-16 -I"/opt/R/devel/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -O3 -Wall -pedantic -c utils_and_wrappers.c -o utils_and_wrappers.o
  clang-16 -shared -L/opt/R/devel/lib/R/lib -L/usr/local/lib -o Delaporte.so delaporte.o utils.o utils_and_wrappers.o -llapack -lblas -lgfortran -lm -lquadmath -fopenmp -lgfortran -lm -lquadmath -L/opt/R/devel/lib/R/lib -lR
...

https://github.com/aadler/Delaporte/actions/runs/9441435213/job/26002150863#step:6:185

@aadler
Copy link
Author

aadler commented Jun 10, 2024

For C. It seems to be using Fortran and not flang for Fortran.

@gaborcsardi
Copy link
Collaborator

gaborcsardi commented Jun 10, 2024

For C. It seems to he using Fortran and not flang for Fortran.

gfortran yes, just like CRAN.

@aadler
Copy link
Author

aadler commented Jun 10, 2024

That’s actually a relief, since gfortran recognizes the uniform keyword for SIMD. It is flang which has the problem. Thanks, Gabor.

@gaborcsardi
Copy link
Collaborator

Well, yeah, clang16 is not really used for anything on CRAN any more:
https://www.stats.ox.ac.uk/pub/bdr/clang16/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants