[R-pkg-devel] Examples with CPU time is greater than elapsed time.

2022-11-05 Thread Jiaming Yuan

Hi all,

I tried to submit an update to the xgboost package but didn't pass the 
pre-tests with the following note (solved the other one, but this one is 
a bit confusing):


```
Flavor: r-devel-linux-x86_64-debian-gcc
Check: examples, Result: NOTE
  Examples with CPU time > 2.5 times elapsed time
   user system elapsed ratio
  cb.gblinear.history 1.454  0.0170.49 3.002

```

I can't reproduce the note on win-builder: 
https://win-builder.r-project.org/ as it's running on Windows but the 
note appears on debian tests. I'm not able to reproduce it on my local 
machine either with Ubuntu 22.04. I'm wondering what the note is trying 
to tell me and how can I resolve it with confidence.



The full log is here: 
https://win-builder.r-project.org/incoming_pretest/xgboost_1.7.1.1_20221104_194252/Debian/00check.log 
.



Many thanks!

Jiaming

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


Re: [R-pkg-devel] Examples with CPU time is greater than elapsed time.

2022-11-05 Thread Jiaming Yuan

Thank you for the detailed explanation, that's really helpful!

On 11/6/22 02:22, Henrik Bengtsson wrote:

I think it's because it suggests that the package uses more than 250%
of CPU load on average, which suggests it runs in parallel with more
than two parallel workers, which is the upper limit in the CRAN
Policies (https://cran.r-project.org/web/packages/policies.html);

"If running a package uses multiple threads/cores it must never use
more than two simultaneously: the check farm is a shared resource and
will typically be running many checks simultaneously. "

 From the R Internals
(https://cran.r-project.org/doc/manuals/r-release/R-ints.html):

"_R_CHECK_EXAMPLE_TIMING_CPU_TO_ELAPSED_THRESHOLD_: For checks with
timings enabled, report examples where the ratio of CPU time to
elapsed time exceeds this threshold (and the CPU time is at least one
second). This can help detect the simultaneous use of multiple CPU
cores. Default: NA."

It looks like CRAN incoming sets
_R_CHECK_EXAMPLE_TIMING_CPU_TO_ELAPSED_THRESHOLD_=2.5.

If multi-threading is involved, I guess you need to make sure to limit
it to ~2 parallel threads.

/Henrik

On Sat, Nov 5, 2022 at 11:10 AM Jiaming Yuan  wrote:

Hi all,

I tried to submit an update to the xgboost package but didn't pass the
pre-tests with the following note (solved the other one, but this one is
a bit confusing):

```
Flavor: r-devel-linux-x86_64-debian-gcc
Check: examples, Result: NOTE
Examples with CPU time > 2.5 times elapsed time
 user system elapsed ratio
cb.gblinear.history 1.454  0.0170.49 3.002

```

I can't reproduce the note on win-builder:
https://win-builder.r-project.org/ as it's running on Windows but the
note appears on debian tests. I'm not able to reproduce it on my local
machine either with Ubuntu 22.04. I'm wondering what the note is trying
to tell me and how can I resolve it with confidence.


The full log is here:
https://win-builder.r-project.org/incoming_pretest/xgboost_1.7.1.1_20221104_194252/Debian/00check.log
.


Many thanks!

Jiaming

__
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] Examples with CPU time is greater than elapsed time.

2022-11-05 Thread Jiaming Yuan
Thank you for the suggestions! I think I will hard-code the number of 
threads to 2 in that specific example.


On 11/6/22 02:30, Ivan Krylov wrote:

On Sat, 5 Nov 2022 22:41:45 +0800
Jiaming Yuan  wrote:


Examples with CPU time > 2.5 times elapsed time
I'm wondering what the note is trying to tell me and how can I
resolve it with confidence.

Henrik Bengtsson already gave a good explanation of the problem.

Not sure what exactly is the right thing to do, but one way to get rid
of this warning could be to pass the argument nthread =
min(parallel::detectCores(), 2) to the xgb.cv invocation (if you
already use the parallel package anywhere) or maybe to hard-code the
use of only one thread in the example.



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


[R-pkg-devel] [SPAM | WERBUNG] Re: CRAN Submission xgboost 1.7.11.1

2025-05-10 Thread jiaming yuan
Thank you for sharing, Ivan! This is really helpful.

From: Ivan Krylov 
Sent: Saturday, May 10, 2025 5:41:51 AM
To: jiaming yuan 
Cc: r-package-devel@r-project.org 
Subject: Re: [R-pkg-devel] CRAN Submission xgboost 1.7.11.1

� Fri, 9 May 2025 04:22:52 +
jiaming yuan  �:

> We are trying to resolve the test failures of XGBoost but so far no
> one has managed to reproduce them locally.
> https://github.com/dmlc/xgboost/issues/11431

One test failure really stands out:

>   Error ('test_feature_weights.R:17:5'): training with feature
> weights works
>   Error in `setinfo.xgb.DMatrix(dmat, names(p), p[[1]])`:
> cannot get data pointer of 'double' objects

This is particularly strange because the internal CHKVEC() function is
supposed to check for REALSXP vectors and pass them through. Such
"impossible" errors could be signs of a protection error. (Well, any
memory corruption, but arbitrary memory corruption is harder to
diagnose, so let's hope it's something to do with the garbage
collector.) Let's run the test suite check using a build of R-devel
compiled with .../configure --enable-strict-barrier.


testthat::test_check("xgboost")
# <...>
# Fatal error: Wrong thread calling 'RunFinalizers'
# Fatal error: Wrong thread calling 'RunFinalizers'
# Fatal error: Wrong thread calling 'RunFinalizers'
# Fatal error: Wrong thread calling 'RunFinalizers'
# Fatal error: Wrong thread calling 'RunFinalizers'
# Segmentation fault

Hmm.

Setting a breakpoint in Rstd_Suicide reveals the mistake. It's not a
protection error; it's R API being called from an OpenMP thread:

#5  ALTVEC_DATAPTR (x=0x2d825f58) at ../../../R/src/main/altrep.c:376
#6  0x7fbbd1e5ed98 in operator() (__closure=,
i=) at xgboost_R.cc:258
#7  dmlc::OMPException::Run, int> (this=0x7fffbfaef760, f=...)
at ./dmlc-core/include/dmlc/common.h:67
#8  
_ZN7xgboost6common11ParallelForIiZ18XGDMatrixSetInfo_REUlmE0_EEvT_iNS0_5SchedET0_._omp_fn.3(void)
 ()
at ./dmlc-core/include/../../src/common/threading_utils.h:208
#9  0x7fbbd4552a0e in gomp_thread_start (xdata=)
at ../../../libgomp/team.c:129
(gdb) frame 5
#5  ALTVEC_DATAPTR (x=0x2d825f58) at ../../../R/src/main/altrep.c:376
376 return ALTVEC_DATAPTR_EX(x, TRUE);
(gdb) call R_inspect(x)
@2d825f58 14 REALSXP g0c0 [REF(65535)]  1 : 9 (expanded)

The code would be better served by calling REAL_RO / INTEGER_RO once
and then using the returned pointer inside the OpenMP threads.

--
Best regards,
Ivan

[[alternative HTML version deleted]]

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


Re: [R-pkg-devel] CRAN Submission xgboost 1.7.11.1

2025-05-12 Thread Jiaming Yuan

Hi Uwe,


Please help take a look into reproducing the failure if possible. We 
really appreciate your help. Thanks to Ivan, we managed to reproduce the 
memory protection error. But we haven't reproduced other test failures.



Cheers!

Jiaming

On 5/12/25 17:23, Uwe Ligges wrote:
We realized this has already been answered by Ivan Krylov on the 
r-packages-devel list.


Best,
Uwe Ligges


On 12.05.2025 11:07, Uwe Ligges wrote:

I'll try to reproduce this locally.



On 09.05.2025 06:22, jiaming yuan wrote:

Hi CRAN,

May I ask if someone has tried to reproduce the openblas test 
environment from CRAN? We are trying to resolve the test failures of 
XGBoost but so far no one has managed to reproduce them locally. 
https://github.com/dmlc/xgboost/issues/11431


Would be great if you can share some guidance on how to reproduce 
that exact environment.


Cheers
Jiaming
____
From: jiaming yuan 
Sent: Friday, May 9, 2025 12:04:45 PM
To: Uwe Ligges ; CRAN submissi...@r-project.org>

Cc: CRAN Package Submission Form 
Subject: Re: CRAN Submission xgboost 1.7.11.1

Hi,

Others kindly provided help to reproduce the failure but so far no 
one has managed to do so.


Please see  https://github.com/dmlc/xgboost/ 
issues/11431#issuecomment-2864947065  and related discussions the 
thread. Would be great if you can share something more precise.



Cheers
Jiaming


From: Uwe Ligges 
Sent: Wednesday, May 7, 2025 9:48:56 PM
To: jiaming yuan ; CRAN project.org>

Cc: CRAN Package Submission Form 
Subject: Re: CRAN Submission xgboost 1.7.11.1

Note this is relevant, as most Linux clusters will have admis who will
link scientifiv software aagainst OpenBLAS for faster matriox 
operations.


Best,
Uwe Ligges

On 07.05.2025 15:48, Uwe Ligges wrote:

I think any Liniux system with R linked against the system's default
OpenBLAS installation will show this issue.
I'd try it with a standard Ubuntu or Debian with OpenBLAS installed 
and

link agasinst it.

Best,
Uwe Ligges



On 03.05.2025 08:29, jiaming yuan wrote:

Thank you for reaching out. We can't really dive into it unless
there's an easier way to reproduce the environment (like a container
or using some deterministic package managers). It's very unlikely 
that

we can try to build that environment on our own then try to fix all
errors and verify all fixes.




From: Uwe Ligges 
Sent: Friday, May 2, 2025 8:00:17 PM
To: Jiaming Yuan ; CRAN 
Cc: CRAN Package Submission Form 
Subject: Re: CRAN Submission xgboost 1.7.11.1

Thanks, we see you removed lots of tests. Is this really sensible and
are you sure that users with OpenBLAS (as most Linux users and 
cluster
admins will use) will get correct results? Sensibly relaxing 
numerical

assumptions may be a better way to tweak the tests.?

Best,
Uwe Ligges


On 01.05.2025 12:58, CRAN Package Submission Form via 
CRAN-submissions

wrote:

[This was generated from CRAN.R-project.org/submit.html]

The following package was uploaded to CRAN:
===

Package Information:
Package: xgboost
Version: 1.7.11.1
Title: Extreme Gradient Boosting
Author(s): Tianqi Chen [aut], Tong He [aut], Michael Benesty [aut],
Vadim
Khotilovich [aut], Yuan Tang [aut]
(<https://orcid.org/-0001-5243-233X>), Hyunsu Cho [aut],
Kailong Chen [aut], Rory Mitchell [aut], Ignacio Cano [aut],
Tianyi Zhou [aut], Mu Li [aut], Junyuan Xie [aut], Min Lin
[aut], Yifeng Geng [aut], Yutian Li [aut], Jiaming Yuan [aut,
cre], XGBoost contributors [cph] (base XGBoost implementation)
Maintainer: Jiaming Yuan 
Depends: R (>= 3.3.0)
Suggests: knitr, rmarkdown, ggplot2 (>= 1.0.1), DiagrammeR (>= 
0.9.0),

Ckmeans.1d.dp (>= 3.3.1), vcd (>= 1.3), cplm, e1071, caret,
testthat, lintr, igraph (>= 1.0.1), float, crayon, titanic
Description: Extreme Gradient Boosting, which is an efficient
implementation of the gradient boosting framework from Chen &
Guestrin (2016) . This package
is its R interface. The package includes efficient linear
model solver and tree learning algorithms. The package can
automatically do parallel computation on a single machine
which could be more than 10 times faster than existing
gradient boosting packages. It supports various objective
functions, including regression, classification and ranking.
The package is made to be extensible, so that users are also
allowed to define their own objectives easily.
License: Apache License (== 2.0) | file LICENSE
Imports: Matrix (>= 1.1-0), methods, data.table (>= 1.9.6), jsonlite
(>= 1.0),


The maintainer confirms that he or she
has read and agrees to the CRAN policies.

=

Original content of DESCRIPTION file:

Package: xgboost
Type: Package
Title: Extreme Gradient Boosting
Version: 1.7.11.1
Date: 2025-05-01
Authors@R: c(
person("Tianqi", "Chen", role = 

Re: [R-pkg-devel] CRAN Submission xgboost 1.7.11.1

2025-05-08 Thread jiaming yuan
Hi CRAN,

May I ask if someone has tried to reproduce the openblas test environment from 
CRAN? We are trying to resolve the test failures of XGBoost but so far no one 
has managed to reproduce them locally. 
https://github.com/dmlc/xgboost/issues/11431

Would be great if you can share some guidance on how to reproduce that exact 
environment.

Cheers
Jiaming

From: jiaming yuan 
Sent: Friday, May 9, 2025 12:04:45 PM
To: Uwe Ligges ; CRAN 

Cc: CRAN Package Submission Form 
Subject: Re: CRAN Submission xgboost 1.7.11.1

Hi,

Others kindly provided help to reproduce the failure but so far no one has 
managed to do so.

Please see  
https://github.com/dmlc/xgboost/issues/11431#issuecomment-2864947065  and 
related discussions the thread. Would be great if you can share something more 
precise.


Cheers
Jiaming


From: Uwe Ligges 
Sent: Wednesday, May 7, 2025 9:48:56 PM
To: jiaming yuan ; CRAN 
Cc: CRAN Package Submission Form 
Subject: Re: CRAN Submission xgboost 1.7.11.1

Note this is relevant, as most Linux clusters will have admis who will
link scientifiv software aagainst OpenBLAS for faster matriox operations.

Best,
Uwe Ligges

On 07.05.2025 15:48, Uwe Ligges wrote:
> I think any Liniux system with R linked against the system's default
> OpenBLAS installation will show this issue.
> I'd try it with a standard Ubuntu or Debian with OpenBLAS installed and
> link agasinst it.
>
> Best,
> Uwe Ligges
>
>
>
> On 03.05.2025 08:29, jiaming yuan wrote:
>> Thank you for reaching out. We can't really dive into it unless
>> there's an easier way to reproduce the environment (like a container
>> or using some deterministic package managers). It's very unlikely that
>> we can try to build that environment on our own then try to fix all
>> errors and verify all fixes.
>>
>>
>>
>> ____
>> From: Uwe Ligges 
>> Sent: Friday, May 2, 2025 8:00:17 PM
>> To: Jiaming Yuan ; CRAN > project.org>
>> Cc: CRAN Package Submission Form 
>> Subject: Re: CRAN Submission xgboost 1.7.11.1
>>
>> Thanks, we see you removed lots of tests. Is this really sensible and
>> are you sure that users with OpenBLAS (as most Linux users and cluster
>> admins will use) will get correct results? Sensibly relaxing numerical
>> assumptions may be a better way to tweak the tests.?
>>
>> Best,
>> Uwe Ligges
>>
>>
>> On 01.05.2025 12:58, CRAN Package Submission Form via CRAN-submissions
>> wrote:
>>> [This was generated from CRAN.R-project.org/submit.html]
>>>
>>> The following package was uploaded to CRAN:
>>> ===
>>>
>>> Package Information:
>>> Package: xgboost
>>> Version: 1.7.11.1
>>> Title: Extreme Gradient Boosting
>>> Author(s): Tianqi Chen [aut], Tong He [aut], Michael Benesty [aut],
>>> Vadim
>>> Khotilovich [aut], Yuan Tang [aut]
>>> (<https://orcid.org/-0001-5243-233X>), Hyunsu Cho [aut],
>>> Kailong Chen [aut], Rory Mitchell [aut], Ignacio Cano [aut],
>>> Tianyi Zhou [aut], Mu Li [aut], Junyuan Xie [aut], Min Lin
>>> [aut], Yifeng Geng [aut], Yutian Li [aut], Jiaming Yuan [aut,
>>> cre], XGBoost contributors [cph] (base XGBoost implementation)
>>> Maintainer: Jiaming Yuan 
>>> Depends: R (>= 3.3.0)
>>> Suggests: knitr, rmarkdown, ggplot2 (>= 1.0.1), DiagrammeR (>= 0.9.0),
>>> Ckmeans.1d.dp (>= 3.3.1), vcd (>= 1.3), cplm, e1071, caret,
>>> testthat, lintr, igraph (>= 1.0.1), float, crayon, titanic
>>> Description: Extreme Gradient Boosting, which is an efficient
>>> implementation of the gradient boosting framework from Chen &
>>> Guestrin (2016) . This package
>>> is its R interface. The package includes efficient linear
>>> model solver and tree learning algorithms. The package can
>>> automatically do parallel computation on a single machine
>>> which could be more than 10 times faster than existing
>>> gradient boosting packages. It supports various objective
>>> functions, including regression, classification and ranking.
>>> The package is made to be extensible, so that users are also
>>> allowed to define their own objectives easily.
>>> License: Apache License (== 2.0) | file LICENSE
>>> Imports: Matrix (>= 1.1-0), methods, data.table (>= 1.9.6), jsonlite
>>> (>= 1.0),
>>>
>>>
>>> The maintainer confirms that he or she
>>> has read and agrees to the CRAN policies.
>>>
>&g