On Tue, 14 Nov 2023 10:25:03 +0100 (CET)
Romain Pierlot <romain.pier...@u-bordeaux.fr> wrote:

> 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.

Sorry about that. Was there an option to reply and explain? I once
argued my way out of a rejection after I explained a mistake on the
reviewer's part, but one has to be careful not to take too much time
from one of the seven people keeping ~20000 packages working.

Let's do the workaround then.

> >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 ?

#!/bin/sh
# taken from Writing R Extensions, 1.2. Configure and cleanup
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
  echo "could not determine R_HOME"
  exit 1
fi
# determine the Fortran compiler
FC="`"${R_HOME}/bin/R" CMD config FC`"
# Use --version output to determine the compiler
# A different compiler will either accept --version and print something
# else or fail due to "unknown argument". In both cases the branch will
# not be taken
if "$FC" --version 2>/dev/null | grep -q 'flang-new version 17'; then
 # deactivate OpenMP, see below
fi

> And what about OpenMP deactivation ? 

In your src/Makevars, you use Make variables SHLIB_OPENMP_FFLAGS and
SHLIB_OPENMP_CFLAGS to enable OpenMP support. The configure script can
edit this file in various ways, for example, setting the variables to
an empty string:

echo 'SHLIB_OPENMP_FFLAGS =' >>src/Makevars
echo 'SHLIB_OPENMP_CFLAGS =' >>src/Makevars

This is untested, but should work.

I think that workaround (1) should be easier to test (you can try
disabling OpenMP when the Fortran compiler is gfortran, verify that it
works, then switch the test to detect flang-new which you don't have
installed), but if you're more comfortable editing Fortran code, (2)
should also be viable.

-- 
Best regards,
Ivan

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to