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

2023-11-13 Thread Ivan Krylov
On Mon, 13 Nov 2023 16:39:45 +0100 (CET)
Romain Pierlot  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

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


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

2023-11-13 Thread Romain Pierlot
An issue has already been sent on the GitHub page of llvm for 2 weeks : 
https://github.com/llvm/llvm-project/issues/70828

But even if it is a compiler bug, as many people are waiting for my package, it 
would be nice to find a way to avoid the bug in order to sent it on the CRAN.

Any advice ? 

Thanks, 

Romain Pierlot

- Mail original -
De: "Tomas Kalibera" 
À: "Romain Pierlot" , "r-package-devel" 

Envoyé: Lundi 13 Novembre 2023 18:12:31
Objet: Re: [R-pkg-devel] Package submission issue - OMP reduction (flang-new)

On 11/13/23 16:39, Romain Pierlot wrote:
> Hi everyone,
>
> I sent a first message a few weeks ago. I'm still in trouble for sending a 
> package (Frailtypack) on the CRAN. It was removed because of reinforcement in 
> CRAN requirements.
> We corrected the few issues, but more appeared, and one that I'm still enable 
> to correct.
>
> 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
>
> I've already received precious help, that indicated me that the error 
> probably comes from the flang-new compiler used by the CRAN (He replicated 
> the error, I send you the code he made in attachment too : test_fortran.f90).
> I tried the code portion with other compilers (gfortran), and the error 
> didn't appear.
>
> Nevertheless, It may be a compiler error, the CRAN keeps denying the package.
>
> Does anyone have a solution, to avoid this error please ?

If you are sufficiently confident this is a compiler bug, it would be 
great if you could submit a bug report for LLVM/flang-new, so that it 
could be fixed. You would also likely get feedback this way confirming 
whether it really is a compiler bug or a problem in your code. And if it 
is a confirmed bug, you might even get an advice for a work-around for 
older compilers.

Tomas

>
> Thanks a lot for your answers !
>
> Romain Pierlot
>
>
>
>
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
-- 
[ 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 ]

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


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

2023-11-13 Thread Tomas Kalibera



On 11/13/23 16:39, Romain Pierlot wrote:

Hi everyone,

I sent a first message a few weeks ago. I'm still in trouble for sending a 
package (Frailtypack) on the CRAN. It was removed because of reinforcement in 
CRAN requirements.
We corrected the few issues, but more appeared, and one that I'm still enable 
to correct.

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

I've already received precious help, that indicated me that the error probably 
comes from the flang-new compiler used by the CRAN (He replicated the error, I 
send you the code he made in attachment too : test_fortran.f90).
I tried the code portion with other compilers (gfortran), and the error didn't 
appear.

Nevertheless, It may be a compiler error, the CRAN keeps denying the package.

Does anyone have a solution, to avoid this error please ?


If you are sufficiently confident this is a compiler bug, it would be 
great if you could submit a bug report for LLVM/flang-new, so that it 
could be fixed. You would also likely get feedback this way confirming 
whether it really is a compiler bug or a problem in your code. And if it 
is a confirmed bug, you might even get an advice for a work-around for 
older compilers.


Tomas



Thanks a lot for your answers !

Romain Pierlot





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


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


Re: [R-pkg-devel] Package submission fail

2023-11-13 Thread Dirk Eddelbuettel


On 13 November 2023 at 16:46, Ivan Krylov wrote:
| Hello Christiaan and welcome to R-package-devel!

Seconded but PLEASE do not send large attachments to the list and all its
subscriber. Point us to your code repository, you will like get a kind
response from a volunteer or two peeking at it.

Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

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


Re: [R-pkg-devel] Package submission fail

2023-11-13 Thread Ivan Krylov
Hello Christiaan and welcome to R-package-devel!

В Fri, 10 Nov 2023 20:35:49 +0200
Christiaan Pieterse  пишет:

> Check: CRAN incoming feasibility, Result: NOTE
>   Maintainer: 'C.J Pieterse '
> 
>   New submission

This one is to be expected for a first submission.

>   Size of tarball: 10537094 bytes

I highly recommend to find a way to replace the 50-megabyte
inst/extdata/ExampleTradeData.csv with a smaller file. CRAN policy [*]
says "As a general rule, neither data nor documentation should exceed
5MB", and your package tarball mostly consists of example data.

> Flavor: r-devel-linux-x86_64-debian-gcc, r-devel-windows-x86_64
> Check: Rd files, Result: NOTE
>   checkRd: (-1) IOPS.Rd:17: Escaped LaTeX specials: \_ \_
>   checkRd: (-1) IOPS.Rd:36: Escaped LaTeX specials: \_
>   checkRd: (-1) IOPS.Rd:42: Escaped LaTeX specials: \_
>   checkRd: (-1) IOPS.Rd:44: Escaped LaTeX specials: \_
>   checkRd: (-1) IOPS.Rd:46: Escaped LaTeX specials: \_
>   checkRd: (-1) IOPS.Rd:48: Escaped LaTeX specials: \_ \_
>   checkRd: (-1) IOPS.Rd:50: Escaped LaTeX specials: \_

Not sure why roxygen2 is generating these for you. Maybe you need to
update roxygen2 to a newer version that doesn't generate
country\_codes\_V202201 from country_codes_V202201 and run roxygenise()
again. Duncan's idea to encode these as \code{} (or maybe \verb{} if
it's not intended to be R code) is also good.

> Check: examples, Result: NOTE
>   Examples with CPU (user + system) or elapsed time > 5s
>  user system elapsed
>   IOPS 170.57  2.971 173.549

CRAN policy says: "Checking the package should take as little CPU time
as possible". Once you make a smaller example file, it will probably be
also faster to process.

The examples in the help pages are not only for R CMD check to run and
for CRAN to complain about; they are also present in the package for
the user to run example(IOPS) and see it in action. As a user, I would
probably get bored and interrupt your example if it takes more than 2
minutes to run.
 
> Check: for non-standard things in the check directory, Result: NOTE
>   Found the following files/directories:
> 'Combined_Results.csv' 'Combined_Results.xlsx'

"Packages should not write <...> anywhere <...> on the file system apart
from the R session’s temporary directory"

As a user, I would prefer example(IOPS) to modify as little of my
environment as possible. If I had valuable data saved as
"Combined_Results.csv" in the current directory, example(IOPS) would
have overwritten this file. As already pointed out by Duncan Murdoch,
the example will have to create its files under tempdir() and remove
them after it's done.

These are not the only problems you need to fix. Currently, your code
begins by loading a number of packages:

> #requireNamespace("roxygen2")
> requireNamespace("Rcpp")
> requireNamespace("dplyr")
> requireNamespace("tidyr")
> #requireNamespace("readxl")
> requireNamespace("economiccomplexity")
> requireNamespace("usethis")
> requireNamespace("Matrix")
> requireNamespace("tibble")
> requireNamespace("openxlsx")
> requireNamespace("utils")
> #requireNamespace("stats")
> 
> library("Rcpp")
> library("tidyr")
> library("dplyr")
> library("readxl")
> library("economiccomplexity")
> library("usethis")
> library("roxygen2")
> library("openxlsx")
This doesn't play well with the package dependency mechanism. You
should specify which functions you export, import individual functions
or whole packages in the NAMESPACE file [**]. Since you're using
roxygen2, you can use the @importFrom tag to declare your dependencies,
and it will generate the NAMESPACE file for you. Packages shouldn't be
calling library(), and for any optional dependencies, the return value
of requireNamespace() should be checked.

> if( ComplexMethod == "reflections"&& ComplexMethod == "eigenvalues" &&
> ComplexMethod == "fitness") stop('Invalid complexity method')
You probably meant to say !(condition || condition || condition)
instead of condition && condition && condition here. You can also use
the built-in R function stopifnot() as a shorthand for validating
various conditions. switch() with a default stop() and/or match.args()
is also an option.

> CorrectCountryNr <- readline("Please enter correct country
> (corresponding integer): ")
You will probably want to condition this on interactive() and transform
this into an error when the R session is running in batch mode,
unattended. There is not enough error checking after readline() (what
if the user makes a typo?). The menu() function can do most of this for
you.

Good luck, and I hope your next version of the package gets accepted!

-- 
Best regards,
Ivan

[*] https://cran.r-project.org/web/packages/policies.html

[**]
https://cran.r-project.org/doc/manuals/R-exts.html#Specifying-imports-and-exports

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


Re: [R-pkg-devel] Package submission fail

2023-11-13 Thread Duncan Murdoch

On 10/11/2023 1:35 p.m., Christiaan Pieterse wrote:

Good day development team, I trust this email finds you well.

I am trying to upload a package onto CRAN. Note that this is a second
version of an existing package on CRAN, called iopspackage. I have built
the package using the R CMD build function and checked the function using R
CMD check --as cran--. The check yields 3 notes. 2 of them are regarding
run time and big file sizes, which is expected and I can't fix since it is
external functions used in my package that take that much time and a big
example file required. 


You will have to fix the run time.  Try running the example on a smaller 
dataset, or don't run it at all (by putting it in \donttest{}). The file 
size may be acceptable to CRAN; you will need to make an argument to 
them in your upload.


The note about the "\_" entries comes from "country\_codes\_V202201" 
(and similar).  That's not legal Rd syntax.  You could use 
"\code{country_codes_V202201}" or some other verbatim wrapper.


I see a 4th note, about files Combined_Results.csv and 
Combined_Results.xlsx.  If those files are produced by an example or 
test, they should be in tempdir().


Duncan Murdoch

The 3rd note I do not know how to solve. I submitted

this file but it did not pass the automatic checks. Please see the part
from the CRAN-submission email below, as well as my attached .tar.gz file.
Any assistance to get this package open-source uploaded to CRAN would be
appreciated, thank you!

Kind regards
Christiaan

*CRAN-submission email:*
Dear maintainer,

package iopspackage_2.1.0.tar.gz does not pass the incoming checks
automatically, please see the following pre-tests:
Windows: <
https://win-builder.r-project.org/incoming_pretest/iopspackage_2.1.0_20231109_155428/Windows/00check.log



Status: 3 NOTEs
Debian: <
https://win-builder.r-project.org/incoming_pretest/iopspackage_2.1.0_20231109_155428/Debian/00check.log



Status: 4 NOTEs


Please fix all problems and resubmit a fixed version via the webform.
If you are not sure how to fix the problems shown, please ask for help on
the R-package-devel mailing list:

If you are fairly certain the rejection is a false positive, please
reply-all to this message and explain.

More details are given in the directory:
<
https://win-builder.r-project.org/incoming_pretest/iopspackage_2.1.0_20231109_155428/



The files will be removed after roughly 7 days.

No strong reverse dependencies to be checked.

Best regards,
CRAN teams' auto-check service
Flavor: r-devel-linux-x86_64-debian-gcc, r-devel-windows-x86_64
Check: CRAN incoming feasibility, Result: NOTE
   Maintainer: 'C.J Pieterse '

   New submission

   Size of tarball: 10537094 bytes

Flavor: r-devel-linux-x86_64-debian-gcc, r-devel-windows-x86_64
Check: Rd files, Result: NOTE
   checkRd: (-1) IOPS.Rd:17: Escaped LaTeX specials: \_ \_
   checkRd: (-1) IOPS.Rd:36: Escaped LaTeX specials: \_
   checkRd: (-1) IOPS.Rd:42: Escaped LaTeX specials: \_
   checkRd: (-1) IOPS.Rd:44: Escaped LaTeX specials: \_
   checkRd: (-1) IOPS.Rd:46: Escaped LaTeX specials: \_
   checkRd: (-1) IOPS.Rd:48: Escaped LaTeX specials: \_ \_
   checkRd: (-1) IOPS.Rd:50: Escaped LaTeX specials: \_

Flavor: r-devel-windows-x86_64
Check: examples, Result: NOTE
   Examples with CPU (user + system) or elapsed time > 10s
  user system elapsed
   IOPS 127.61   5.58   133.2

Flavor: r-devel-linux-x86_64-debian-gcc
Check: examples, Result: NOTE
   Examples with CPU (user + system) or elapsed time > 5s
  user system elapsed
   IOPS 170.57  2.971 173.549

Flavor: r-devel-linux-x86_64-debian-gcc
Check: for non-standard things in the check directory, Result: NOTE
   Found the following files/directories:
 'Combined_Results.csv' 'Combined_Results.xlsx'


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


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