[R-pkg-devel] Issue with R Package on CRAN - OpenMP and clang17

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Mon Oct 30 16:52:29 CET 2023


В Mon, 30 Oct 2023 15:58:31 +0100 (CET)
Romain Pierlot <romain.pierlot using u-bordeaux.fr> пишет:

> I'm sorry to disturb, I hope I send a mail at the right place. 

This is exactly the right place to ask. Welcome to R-package-devel!

> It appears that I have addressed the Fortran issues, but upon
> resubmission to CRAN, the package was not accepted, and the following
> error was returned : 
> 
> 
> ''With clang17 it still fails to install: 
> 
> error:
> loc("/data/gannet/ripley/R/packages/incoming/frailtypack.Rcheck/00_pkg_src/frailtypack/src/Integrale_mult_scl.f90":1811:17):
> 'omp.reduction' op must be used within an operation supporting
> reduction clause interface error: verification of lowering to FIR
> failed 
> 
> LLVM trunk gives the same error. 
> '' 

I'm not 100% sure, but I currently think that this is a compiler bug.

You have a variable, ss, declared inside a function.

If nb_procs==1, you start an OpenMP parallel region with a reduction on
that variable. The OpenMP parallel region starts and ends inside that
if clause. Outside the parallel region, in another branch, you add to
it as usual.

Flang-new complains about your use of the 'ss' variable outside the
parallel region, alleging that it's not valid for an OpenMP reduction.
There is no OpenMP reduction in sight where the error is reported. I
think that Flang-new is wrong to signal an error here.

Unfortunately, proving that this is a compiler bug might be hard. I'll
try to reproduce your problem, starting by downloading and compiling
flang from https://github.com/llvm/llvm-project.git commit
092b6c5ee3707ea10b9f10d0a674e8d12395369b (as stated at
<https://www.stats.ox.ac.uk/pub/bdr/clang17/frailtypack.log>). I hope
it will be possible to simplify Integrale_mult_scl.f90 until it looks
manageable for their bug tracker.

> Moreover, I don't know if it is normal or not, but when I check my
> package with R CMD chech --as-cran, I don't have any error or note
> message. But when I submit the package to the CRAN, they return
> errors and notes. 

These errors only happen with the "flang-new" Fortran compiler that's
part of the LLVM compiler infrastructure. You're probably using
gfortran or some other, more well-polished Fortran compiler.

-- 
Best regards,
Ivan




More information about the R-package-devel mailing list