paternogbc / sensiPhy

R package to perform sensitivity analysis for comparative methods
http://onlinelibrary.wiley.com/doi/10.1111/2041-210X.12990/full
GNU General Public License v2.0
12 stars 4 forks source link

CRANT tests: sensiPhy v0.8.0 #173

Closed paternogbc closed 6 years ago

paternogbc commented 6 years ago

Tests before merging branches.

CRAN test for trait_evol branch

Results: Error possible at clade_continuous() example:

R CMD check results
1 error  | 3 warnings | 2 notes
checking examples ... ERROR
Running examples in ‘sensiPhy-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: clade_continuous
> ### Title: Influential Clade Detection - Trait Evolution Continuous
> ###   Characters
> ### Aliases: clade_continuous
> 
> ### ** Examples
> 
> #Load data:
> data("primates")
> #Model trait evolution accounting for phylogenetic uncertainty
> clade_cont<-clade_continuous(data=primates$data,phy = primates$phy[[1]],model="OU",
+ trait.col = "adultMass",clade.col="family",n.sim=30,n.species=10,track=TRUE)
Error in .check_ncores(cores) : 8 simultaneous processes spawned
Calls: clade_continuous ... <Anonymous> -> fxopt -> <Anonymous> -> .check_ncores
Execution halted

Hey guys, @gijsbertwerner and @gijsbertwerner I am trying to find where this error is happening. Can you please test if you also get this Error when running Cran checks on the trait_evol branch?

paternogbc commented 6 years ago

Same issue with clade_discrete() after removing the example from clade_continuous() documentation.

Status: 1 ERROR, 3 WARNINGs, 2 NOTEs
checking examples ... ERROR
Running examples in ‘sensiPhy-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: clade_discrete
> ### Title: Influential Clade Detection - Trait Evolution Discrete
> ###   Characters
> ### Aliases: clade_discrete
> 
> ### ** Examples
> 
> #Load data:
> data("primates")
> #Create a binary trait factor 
> primates$data$adultMass_binary<-ifelse(primates$data$adultMass > 7350, "big", "small")
> clade_binary<-clade_discrete(data=primates$data,phy = primates$phy[[1]],model="SYM",
+ trait.col = "adultMass_binary",clade.col="family",nsim=30,n.species=10)
Error in .check_ncores(cores) : 8 simultaneous processes spawned
Calls: clade_discrete ... <Anonymous> -> fxopt -> <Anonymous> -> .check_ncores
Execution halted
paternogbc commented 6 years ago

Apparently this is related to the number of cores used when multithreading (maximum allowed by CRAN is 2). Working on it! link of similar issue: https://github.com/thibautjombart/adegenet/issues/128

paternogbc commented 6 years ago

Possible solution is to add ncores = 2 in all examples. Trying that now based on Hadley twit about it. https://twitter.com/hadleywickham/status/517671043465363456

gijsbertwerner commented 6 years ago

Ah, this is almost certainly caused because within the iterations I currently use ncores = NULL for both the fitDiscrete/fitContinuous calls. I had don that on purpose because the help says 'If NULL then number of cores is detected', which seemed practical to me, but I hadn't considered CRAN imposing this limitation.

Probably easiest to change is by setting a a n.cores = NULL in all functions, and then using n.cores = 2 in the examples.

Shall I do this, @paternogbc , or are you working on this now? Can easily do, but don't want to mess things up by conflicting changes.

gijsbertwerner commented 6 years ago

Ok, I have now implemented this here: https://github.com/paternogbc/sensiPhy/commit/12634d855c88703e19120bf37b0b965919185455. I have given users the option to manually set n.cores, and set n.cores = 2 in all the examples, so it should now hopefully pass CRAN tests.

paternogbc commented 6 years ago

Sure, thanks @gijsbertwerner. Perfect solution. That was exactly the problem (how would you know about the ncore limit from CRAN tests? ). I had no idea my self. Moving on with tests now. =))

gijsbertwerner commented 6 years ago

👍🏻👌🏻


Dr. Gijsbert Werner Newton Fellow, Department of Zoology Junior Research Fellow, Balliol College University of Oxford

Balliol College <x-apple-data-detectors://2/1>Broad Street<x-apple-data-detectors://2/1> <x-apple-data-detectors://2/1>Oxford<x-apple-data-detectors://2/1> <x-apple-data-detectors://2/1>OX1 3BJ<x-apple-data-detectors://2/1> <x-apple-data-detectors://2/1>United Kingdom<x-apple-data-detectors://2/1>

On 4 Dec 2017, at 10:48, Gustavo Paterno notifications@github.com<mailto:notifications@github.com> wrote:

Sure, thanks @gijsbertwernerhttps://github.com/gijsbertwerner. Perfect solution. That was exactly the problem (how would you know about the ncore limit from CRAN tests? ). I had no idea my self. Moving on with tests now. =))

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/paternogbc/sensiPhy/issues/173#issuecomment-348926244, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGauyDieMxcS1s8S3xl22FE14ZkzGVWeks5s883ggaJpZM4Q0Ojz.