[R-pkg-devel] Package submission issue - OMP reduction (flang-new)

Romain Pierlot rom@|n@p|er|ot @end|ng |rom u-borde@ux@|r
Tue Nov 14 10:25:03 CET 2023


Thanks again for your help.


>Have you tried explaining this in the package submission comment? What
>was the response? Does the reviewer need more evidence? Linking to the
>LLVM issue on GitHub and/or the previous R-package-devel thread may
>help.

We indicated the possible bug in the comment section, with a link on the GitHub issue. 
They didn't consider this, and just refused the package, sending us the .log file explaining the issue on .omp reduction.

>1. In your ./configure script, check for the Fortran compiler being
>flang-new version 17. If the check succeeds, disable OpenMP altogether.

How can I do that ? I can create a .configure file on the root folder, but how do I check the compiler version ? As in .R file, with FC = ... ? And what about OpenMP deactivation ? 

>2. Rewrite your Fortran code so that a variable is never touched before
>it is used in an OpenMP reduction. You may have to declare a new
>variable for every OpenMP reduction loop inside a function.

I'll try this, thanks. I'm still unable to install flang-new on my device, as it is too voluminate and my computer systematically crash. So i'll do the changes and send it on CRAN, hopefully it'll be ok. 


Many thanks for all your help ! 

Best regards, 

Romain Pierlot


----- Mail original -----
De: "Ivan Krylov" <krylov.r00t using gmail.com>
À: "Romain Pierlot" <romain.pierlot using u-bordeaux.fr>
Cc: "r-package-devel" <r-package-devel using r-project.org>
Envoyé: Lundi 13 Novembre 2023 19:18:32
Objet: Re: [R-pkg-devel] Package submission issue - OMP reduction (flang-new)

On Mon, 13 Nov 2023 16:39:45 +0100 (CET)
Romain Pierlot <romain.pierlot using u-bordeaux.fr> wrote:

> Here is the error message, and the adequate code part is joint in the
> mail : 
> 
> 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 

Have you tried explaining this in the package submission comment? What
was the response? Does the reviewer need more evidence? Linking to the
LLVM issue on GitHub and/or the previous R-package-devel thread may
help.

(LLVM giveth and LLVM taketh away. While I'm sure that their
diagnostics helped improve many packages, I have encountered a few
places in the R code where clang suggested to replace boolean
expressions && and || with bitwise operations & and |. The code still
works, but now relies on boolean constants having certain exact bits
set. Replace a 1 with a 2 and things will break.)

It might be the case that CRAN cannot afford to make an exception for
this compiler bug. I can imagine a number of workarounds:

1. In your ./configure script, check for the Fortran compiler being
flang-new version 17. If the check succeeds, disable OpenMP altogether.

2. Rewrite your Fortran code so that a variable is never touched before
it is used in an OpenMP reduction. You may have to declare a new
variable for every OpenMP reduction loop inside a function.

If you don't succeed in convincing CRAN regarding the compiler bug,
which one of the two workarounds would you prefer?

-- 
Best regards,
Ivan
-- 
[ https://www.u-bordeaux.fr/ ] [ http://www.aquitaine-poitou-charentes.inserm.fr/ ] 

[ mailto: | Romain Pierlot ] 
Ingénieur de recherches Bio-Informatique 
Équipe BIOSTAT 


[ https://www.u-bordeaux.fr/ | https://www.u-bordeaux.fr ]



More information about the R-package-devel mailing list