CRAN Package Check Results for Package mvbutils

Last updated on 2026-08-01 12:50:48 CEST.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 2.12.120 3.77 104.65 108.42 OK
r-devel-linux-x86_64-debian-gcc 2.12.120 3.39 70.60 73.99 NOTE
r-devel-linux-x86_64-fedora-clang 2.12.120 175.82 OK
r-devel-linux-x86_64-fedora-gcc 2.12.120 74.45 OK
r-devel-windows-x86_64 2.12.120 6.00 124.00 130.00 OK
r-patched-linux-x86_64 2.12.120 7.24 102.93 110.17 OK
r-release-linux-x86_64 2.12.120 4.21 103.06 107.27 OK
r-release-macos-arm64 2.12.120 1.00 68.00 69.00 ERROR
r-release-macos-x86_64 2.12.120 3.00 164.00 167.00 ERROR
r-release-windows-x86_64 2.12.120 5.00 130.00 135.00 OK
r-oldrel-macos-arm64 2.12.120 1.00 74.00 75.00 ERROR
r-oldrel-macos-x86_64 2.12.120 3.00 161.00 164.00 ERROR
r-oldrel-windows-x86_64 2.12.120 8.00 153.00 161.00 NOTE

Check Details

Version: 2.12.120
Check: for new files in some other directories
Result: NOTE Found the following files/directories: ‘~/tmp/scratch/Rtmp0h8rHA’ ‘~/tmp/scratch/Rtmp2606Sg’ ‘~/tmp/scratch/Rtmp2ZDVMF’ ‘~/tmp/scratch/Rtmp42R5ER’ ‘~/tmp/scratch/Rtmp4d3Fez’ ‘~/tmp/scratch/Rtmp4pRB97’ ‘~/tmp/scratch/Rtmp5SnoS1’ ‘~/tmp/scratch/Rtmp5U7XLI’ ‘~/tmp/scratch/Rtmp6DHECL’ ‘~/tmp/scratch/Rtmp6a3PUn’ ‘~/tmp/scratch/Rtmp73kmfo’ ‘~/tmp/scratch/Rtmp7CPKbh’ ‘~/tmp/scratch/Rtmp7NdIvc’ ‘~/tmp/scratch/Rtmp7lCuzV’ ‘~/tmp/scratch/Rtmp83Rx9d’ ‘~/tmp/scratch/Rtmp8iur9p’ ‘~/tmp/scratch/Rtmp92nANg’ ‘~/tmp/scratch/Rtmp9xR3oT’ ‘~/tmp/scratch/Rtmp9zXGIw’ ‘~/tmp/scratch/RtmpAWDN5x’ ‘~/tmp/scratch/RtmpAdv9ft’ ‘~/tmp/scratch/RtmpAiJo6b’ ‘~/tmp/scratch/RtmpAkrR3R’ ‘~/tmp/scratch/RtmpAuIz3T’ ‘~/tmp/scratch/RtmpBFkWzo’ ‘~/tmp/scratch/RtmpBKho42’ ‘~/tmp/scratch/RtmpBTIWe2’ ‘~/tmp/scratch/RtmpBxnqVx’ ‘~/tmp/scratch/RtmpCDJ1pf’ ‘~/tmp/scratch/RtmpCMRwk1’ ‘~/tmp/scratch/RtmpCkoWAn’ ‘~/tmp/scratch/RtmpEyNLqL’ ‘~/tmp/scratch/RtmpFlbyYE’ ‘~/tmp/scratch/RtmpG8R5RS’ ‘~/tmp/scratch/RtmpGHeRbP’ ‘~/tmp/scratch/RtmpGPo8x2’ ‘~/tmp/scratch/RtmpGeQoAh’ ‘~/tmp/scratch/RtmpGqPbNZ’ ‘~/tmp/scratch/RtmpH9hKt1’ ‘~/tmp/scratch/RtmpJwmecC’ ‘~/tmp/scratch/RtmpL9qCXa’ ‘~/tmp/scratch/RtmpLOXsR7’ ‘~/tmp/scratch/RtmpLqqfcy’ ‘~/tmp/scratch/RtmpMXuLdv’ ‘~/tmp/scratch/RtmpMhVIu0’ ‘~/tmp/scratch/RtmpNV0k4w’ ‘~/tmp/scratch/RtmpO52aUz’ ‘~/tmp/scratch/RtmpOHV92X’ ‘~/tmp/scratch/RtmpOLSxQA’ ‘~/tmp/scratch/RtmpOLq8eJ’ ‘~/tmp/scratch/RtmpOSB6zG’ ‘~/tmp/scratch/RtmpOu5Pmg’ ‘~/tmp/scratch/RtmpP11Vbn’ ‘~/tmp/scratch/RtmpPh3Xmj’ ‘~/tmp/scratch/RtmpQ0521k’ ‘~/tmp/scratch/RtmpQ1BoXA’ ‘~/tmp/scratch/RtmpQ3Qhqt’ ‘~/tmp/scratch/RtmpQHEbSQ’ ‘~/tmp/scratch/RtmpQc7TlR’ ‘~/tmp/scratch/RtmpRskc1y’ ‘~/tmp/scratch/RtmpRurv2e’ ‘~/tmp/scratch/RtmpSsHtm7’ ‘~/tmp/scratch/RtmpUUWtuc’ ‘~/tmp/scratch/RtmpVBlFIE’ ‘~/tmp/scratch/RtmpXeWknA’ ‘~/tmp/scratch/RtmpXx9urx’ ‘~/tmp/scratch/RtmpYfqPXC’ ‘~/tmp/scratch/RtmpZEPz08’ ‘~/tmp/scratch/RtmpZjsm38’ ‘~/tmp/scratch/RtmpZk1EIC’ ‘~/tmp/scratch/Rtmpa5w6MN’ ‘~/tmp/scratch/RtmpbaGgCN’ ‘~/tmp/scratch/RtmpcFSl5E’ ‘~/tmp/scratch/RtmpcaT9hS’ ‘~/tmp/scratch/RtmpcbFWAA’ ‘~/tmp/scratch/RtmpdKcUI4’ ‘~/tmp/scratch/RtmpdQ6Qm2’ ‘~/tmp/scratch/RtmpdfUg5c’ ‘~/tmp/scratch/RtmpdnGKAS’ ‘~/tmp/scratch/RtmpdogzY4’ ‘~/tmp/scratch/Rtmpf2BcPz’ ‘~/tmp/scratch/RtmpfN1U16’ ‘~/tmp/scratch/RtmpfUpevZ’ ‘~/tmp/scratch/RtmpgglEUk’ ‘~/tmp/scratch/RtmpgpQdVZ’ ‘~/tmp/scratch/RtmpgpghhQ’ ‘~/tmp/scratch/Rtmph4IkHc’ ‘~/tmp/scratch/RtmphhZ166’ ‘~/tmp/scratch/RtmpigcRzA’ ‘~/tmp/scratch/RtmpihzElu’ ‘~/tmp/scratch/RtmpisHH9d’ ‘~/tmp/scratch/RtmpjGEFs0’ ‘~/tmp/scratch/RtmpjeRhND’ ‘~/tmp/scratch/RtmpkCvqz7’ ‘~/tmp/scratch/RtmpkfNkxj’ ‘~/tmp/scratch/Rtmpks6I9k’ ‘~/tmp/scratch/Rtmpl2scIS’ ‘~/tmp/scratch/Rtmpl9jd2B’ ‘~/tmp/scratch/Rtmplul4YF’ ‘~/tmp/scratch/RtmpmHxf8u’ ‘~/tmp/scratch/Rtmpmpk3uK’ ‘~/tmp/scratch/Rtmpmv3oFl’ ‘~/tmp/scratch/RtmpnMFvqA’ ‘~/tmp/scratch/Rtmpo8ILeJ’ ‘~/tmp/scratch/RtmppduWu4’ ‘~/tmp/scratch/RtmppqNDx5’ ‘~/tmp/scratch/RtmpqAo0Si’ ‘~/tmp/scratch/RtmpqvLqvM’ ‘~/tmp/scratch/RtmpraMkzq’ ‘~/tmp/scratch/RtmprcJnsN’ ‘~/tmp/scratch/RtmpsiM22E’ ‘~/tmp/scratch/Rtmpt7is8d’ ‘~/tmp/scratch/RtmptM2ZM0’ ‘~/tmp/scratch/RtmptwqtoT’ ‘~/tmp/scratch/RtmpuOy5qH’ ‘~/tmp/scratch/Rtmpv0KwkH’ ‘~/tmp/scratch/RtmpvSAK1F’ ‘~/tmp/scratch/RtmpvlMVG7’ ‘~/tmp/scratch/RtmpvuXFJ5’ ‘~/tmp/scratch/RtmpwLi1fR’ ‘~/tmp/scratch/RtmpwqRNkN’ ‘~/tmp/scratch/RtmpxPU0x7’ ‘~/tmp/scratch/RtmpxxklbO’ ‘~/tmp/scratch/Rtmpy6m6ae’ ‘~/tmp/scratch/RtmpybU18n’ ‘~/tmp/scratch/Rtmpz5Uo6A’ ‘~/tmp/scratch/RtmpzXKju8’ ‘~/tmp/scratch/RtmpzcQk0f’ ‘~/tmp/scratch/RtmpzoYwgM’ ‘~/tmp/scratch/xvfb-run.1HaDTa’ ‘~/tmp/scratch/xvfb-run.22GK1x’ ‘~/tmp/scratch/xvfb-run.2EGWdM’ ‘~/tmp/scratch/xvfb-run.2LU6rX’ ‘~/tmp/scratch/xvfb-run.3ev9vs’ ‘~/tmp/scratch/xvfb-run.4uyWYz’ ‘~/tmp/scratch/xvfb-run.5ljf31’ ‘~/tmp/scratch/xvfb-run.5uKY7E’ ‘~/tmp/scratch/xvfb-run.6Omjlu’ ‘~/tmp/scratch/xvfb-run.6ykxmj’ ‘~/tmp/scratch/xvfb-run.8s07k4’ ‘~/tmp/scratch/xvfb-run.9YxR0q’ ‘~/tmp/scratch/xvfb-run.B7ZrhI’ ‘~/tmp/scratch/xvfb-run.Bq9WmB’ ‘~/tmp/scratch/xvfb-run.Brk6b3’ ‘~/tmp/scratch/xvfb-run.GD6di8’ ‘~/tmp/scratch/xvfb-run.GchZK0’ ‘~/tmp/scratch/xvfb-run.HXNN6O’ ‘~/tmp/scratch/xvfb-run.ILNkHG’ ‘~/tmp/scratch/xvfb-run.IZiMZz’ ‘~/tmp/scratch/xvfb-run.IwQIsa’ ‘~/tmp/scratch/xvfb-run.MdSptI’ ‘~/tmp/scratch/xvfb-run.Mgjryx’ ‘~/tmp/scratch/xvfb-run.NWR7Oy’ ‘~/tmp/scratch/xvfb-run.Ob6Edh’ ‘~/tmp/scratch/xvfb-run.P1oYmQ’ ‘~/tmp/scratch/xvfb-run.Qzwnx4’ ‘~/tmp/scratch/xvfb-run.RQcRBM’ ‘~/tmp/scratch/xvfb-run.Rryjd9’ ‘~/tmp/scratch/xvfb-run.SmGr6g’ ‘~/tmp/scratch/xvfb-run.UA9HBe’ ‘~/tmp/scratch/xvfb-run.UXc2l3’ ‘~/tmp/scratch/xvfb-run.YCEFvC’ ‘~/tmp/scratch/xvfb-run.ZZVQ6s’ ‘~/tmp/scratch/xvfb-run.ZcBvzS’ ‘~/tmp/scratch/xvfb-run.bIIR6b’ ‘~/tmp/scratch/xvfb-run.gUlxGP’ ‘~/tmp/scratch/xvfb-run.h3ZpVU’ ‘~/tmp/scratch/xvfb-run.hTmwdP’ ‘~/tmp/scratch/xvfb-run.iZzIrS’ ‘~/tmp/scratch/xvfb-run.jZT2jJ’ ‘~/tmp/scratch/xvfb-run.jfKtBU’ ‘~/tmp/scratch/xvfb-run.lFQuJ6’ ‘~/tmp/scratch/xvfb-run.m0ADj8’ ‘~/tmp/scratch/xvfb-run.mrmSJE’ ‘~/tmp/scratch/xvfb-run.oaX2Sy’ ‘~/tmp/scratch/xvfb-run.ogBFaP’ ‘~/tmp/scratch/xvfb-run.p8sYtz’ ‘~/tmp/scratch/xvfb-run.poAa1H’ ‘~/tmp/scratch/xvfb-run.rv3mpA’ ‘~/tmp/scratch/xvfb-run.sYQKpM’ ‘~/tmp/scratch/xvfb-run.vPDykO’ ‘~/tmp/scratch/xvfb-run.weqyU9’ ‘~/tmp/scratch/xvfb-run.zPEV5c’ Flavor: r-devel-linux-x86_64-debian-gcc

Version: 2.12.120
Check: examples
Result: ERROR Running examples in ‘mvbutils-Ex.R’ failed The error most likely occurred in: > ### Name: numvbderiv_parallel > ### Title: Economy numerical derivatives > ### Aliases: numvbderiv_parallel numvbderiv > ### Keywords: misc > > ### ** Examples > > # Complex numbers are OK: > numvbderiv( function( x) x*x, complex( real=1, imaginary=3)) [1] 2+6i > # [1] 2+6i > # Parallel example... the whole point is to show speed and generality > # Works fine on my machine > # But if testing under CRAN, which I normally never do, > # then CRAN's ludicrous 2-core limit, and deliberate inability to > # check CRANality (or even number of cores _allowed_) while running, > # makes this completely ridiculous > # Not for the first time > # I have used the function 'get_ncores_CRANal' to try to get round this... > if( require( 'doParallel')){ # auto loads foreach, iterators, parallel thx2 "Depends" + ncores <- detectCores( logical=FALSE) + scatn( '%i cores really found', ncores) + if( ncores > 2 ){ # pointless otherwise + # Need a slowish example. 1e5 is too small; 1e7 better, + # ... but hard on auto builders eg R-universe + BIGGOVAL <- 1e5 + slowfun <- function( pars, BIGGO) + sum( sqr( 1+1/outer( seq_len( BIGGO), pars))) + parstart <- rep( 2, 8) + system.time( + dscalar <- numvbderiv( slowfun, parstart, + BIGGO=BIGGOVAL # named extra param (part of ...) + ) + ) # scalar + # Make "doPar back end". I do not know what I am doing ... + # NB I like to leave some cores spare, hence "-1"-- + # superstition, really + ncores_target <- min( ncores-1, length( parstart)) + # Anti CRANky: ignore on your own machine: + # ncores_target should just work + ncores_avail <- get_ncores_CRANal( ncores_target) + scatn( 'Using %i cores eg cozza CRAN', ncores_avail) + CLUSTO <- makeCluster( ncores_avail) + registerDoParallel( CLUSTO, ncores_avail) + # Next bit ensures slaves can find packages... sigh. + # Necessary _here_ coz example, but you may not need it + # clusterCall does not work properly :/, so the "obvious" fails: + # clusterCall( CLUSTO, .libPaths, .libPaths()) + # Instead, we are forced into this nonsense: + print( # for debuggery with as-CRAN + eval( substitute( + clusterEvalQ( CLUSTO, .libPaths( lb)), + list( lb=.libPaths()))) + ) + # Need 'mvbutils::sqr', hence '.packages' arg + scatn( 'Starting parallel time test') + print( system.time( + dpara <- numvbderiv_parallel( slowfun, parstart, + BIGGO=BIGGOVAL, # named extra parameter + FOREACH_ARGS=list( .packages= 'mvbutils') + ) + ) + ) + scatn( 'Done') + print( rbind( dscalar, dpara)) + # To refer to other data (ie beside params) + # best practice is to put it into function's environment + # (generally true, not just for numvbderiv) + e <- new.env() + e$paroffset <- c( 6, -3) + fun2 <- function( pars) { # not a speed test, can be smaller + sum( sqr( 1+1/outer( 1:1e3, pars+paroffset))) + } + environment( fun2) <- e + scatn( 'Scalar, using extra data via environment') + print( numvbderiv( fun2, parstart)) + # Parallel version should still work, coz function's environment + # is also passed to slaves + scatn( 'Trying parallel version...') + print( try({ + numvbderiv_parallel( fun2, parstart, + FOREACH_ARGS=list( .packages= 'mvbutils') + ) + }) + ) + # Sometimes you do need to explicitly export stuff to the slave processes + # Here's a version that will get paroffset from datenv + # datenv must exist... + alt_fun2 <- function( pars){ + environment( fun2) <- list2env( datenv) + fun2( pars) + } + scatn( 'With explicit data (in parallel)') + datenv <- as.list( e) + print( numvbderiv_parallel( alt_fun2, parstart, + FOREACH_ARGS=list( + .packages= 'mvbutils', + .export= cq( datenv, fun2) # stuff that alt_fun2 refers to + ) + ) + ) + # Always tidy up your clusters once you have finished playing + stopImplicitCluster() + stopCluster( CLUSTO) + rm( CLUSTO) + } # if ncores>2 + } # parallel Loading required package: doParallel Loading required package: foreach Loading required package: iterators Loading required package: parallel 12 cores really found Error in stopCluster(CLUSTO) : CRANtidote Calls: get_ncores_CRANal -> stopCluster Execution halted Flavor: r-release-macos-arm64

Version: 2.12.120
Check: examples
Result: ERROR Running examples in ‘mvbutils-Ex.R’ failed The error most likely occurred in: > ### Name: numvbderiv_parallel > ### Title: Economy numerical derivatives > ### Aliases: numvbderiv_parallel numvbderiv > ### Keywords: misc > > ### ** Examples > > # Complex numbers are OK: > numvbderiv( function( x) x*x, complex( real=1, imaginary=3)) [1] 2+6i > # [1] 2+6i > # Parallel example... the whole point is to show speed and generality > # Works fine on my machine > # But if testing under CRAN, which I normally never do, > # then CRAN's ludicrous 2-core limit, and deliberate inability to > # check CRANality (or even number of cores _allowed_) while running, > # makes this completely ridiculous > # Not for the first time > # I have used the function 'get_ncores_CRANal' to try to get round this... > if( require( 'doParallel')){ # auto loads foreach, iterators, parallel thx2 "Depends" + ncores <- detectCores( logical=FALSE) + scatn( '%i cores really found', ncores) + if( ncores > 2 ){ # pointless otherwise + # Need a slowish example. 1e5 is too small; 1e7 better, + # ... but hard on auto builders eg R-universe + BIGGOVAL <- 1e5 + slowfun <- function( pars, BIGGO) + sum( sqr( 1+1/outer( seq_len( BIGGO), pars))) + parstart <- rep( 2, 8) + system.time( + dscalar <- numvbderiv( slowfun, parstart, + BIGGO=BIGGOVAL # named extra param (part of ...) + ) + ) # scalar + # Make "doPar back end". I do not know what I am doing ... + # NB I like to leave some cores spare, hence "-1"-- + # superstition, really + ncores_target <- min( ncores-1, length( parstart)) + # Anti CRANky: ignore on your own machine: + # ncores_target should just work + ncores_avail <- get_ncores_CRANal( ncores_target) + scatn( 'Using %i cores eg cozza CRAN', ncores_avail) + CLUSTO <- makeCluster( ncores_avail) + registerDoParallel( CLUSTO, ncores_avail) + # Next bit ensures slaves can find packages... sigh. + # Necessary _here_ coz example, but you may not need it + # clusterCall does not work properly :/, so the "obvious" fails: + # clusterCall( CLUSTO, .libPaths, .libPaths()) + # Instead, we are forced into this nonsense: + print( # for debuggery with as-CRAN + eval( substitute( + clusterEvalQ( CLUSTO, .libPaths( lb)), + list( lb=.libPaths()))) + ) + # Need 'mvbutils::sqr', hence '.packages' arg + scatn( 'Starting parallel time test') + print( system.time( + dpara <- numvbderiv_parallel( slowfun, parstart, + BIGGO=BIGGOVAL, # named extra parameter + FOREACH_ARGS=list( .packages= 'mvbutils') + ) + ) + ) + scatn( 'Done') + print( rbind( dscalar, dpara)) + # To refer to other data (ie beside params) + # best practice is to put it into function's environment + # (generally true, not just for numvbderiv) + e <- new.env() + e$paroffset <- c( 6, -3) + fun2 <- function( pars) { # not a speed test, can be smaller + sum( sqr( 1+1/outer( 1:1e3, pars+paroffset))) + } + environment( fun2) <- e + scatn( 'Scalar, using extra data via environment') + print( numvbderiv( fun2, parstart)) + # Parallel version should still work, coz function's environment + # is also passed to slaves + scatn( 'Trying parallel version...') + print( try({ + numvbderiv_parallel( fun2, parstart, + FOREACH_ARGS=list( .packages= 'mvbutils') + ) + }) + ) + # Sometimes you do need to explicitly export stuff to the slave processes + # Here's a version that will get paroffset from datenv + # datenv must exist... + alt_fun2 <- function( pars){ + environment( fun2) <- list2env( datenv) + fun2( pars) + } + scatn( 'With explicit data (in parallel)') + datenv <- as.list( e) + print( numvbderiv_parallel( alt_fun2, parstart, + FOREACH_ARGS=list( + .packages= 'mvbutils', + .export= cq( datenv, fun2) # stuff that alt_fun2 refers to + ) + ) + ) + # Always tidy up your clusters once you have finished playing + stopImplicitCluster() + stopCluster( CLUSTO) + rm( CLUSTO) + } # if ncores>2 + } # parallel Loading required package: doParallel Loading required package: foreach Loading required package: iterators Loading required package: parallel 6 cores really found Error in stopCluster(CLUSTO) : CRANtidote Calls: get_ncores_CRANal -> stopCluster Execution halted Flavors: r-release-macos-x86_64, r-oldrel-macos-x86_64

Version: 2.12.120
Check: R code for possible problems
Result: NOTE cd.load: possible error in mget("tasks", pos = 2, ifnotfound = list(character(0))): unused argument (pos = 2) get.cd.from.menu: possible error in mget("tasks", pos = 1, ifnotfound = list(structure(character(0), names = character(0)))): unused argument (pos = 1) make.new.cd.task: possible error in mget("tasks", pos = 2, ifnotfound = list(character(0))): unused argument (pos = 2) Flavors: r-oldrel-macos-arm64, r-oldrel-macos-x86_64, r-oldrel-windows-x86_64

Version: 2.12.120
Check: examples
Result: ERROR Running examples in ‘mvbutils-Ex.R’ failed The error most likely occurred in: > ### Name: numvbderiv_parallel > ### Title: Economy numerical derivatives > ### Aliases: numvbderiv_parallel numvbderiv > ### Keywords: misc > > ### ** Examples > > # Complex numbers are OK: > numvbderiv( function( x) x*x, complex( real=1, imaginary=3)) [1] 2+6i > # [1] 2+6i > # Parallel example... the whole point is to show speed and generality > # Works fine on my machine > # But if testing under CRAN, which I normally never do, > # then CRAN's ludicrous 2-core limit, and deliberate inability to > # check CRANality (or even number of cores _allowed_) while running, > # makes this completely ridiculous > # Not for the first time > # I have used the function 'get_ncores_CRANal' to try to get round this... > if( require( 'doParallel')){ # auto loads foreach, iterators, parallel thx2 "Depends" + ncores <- detectCores( logical=FALSE) + scatn( '%i cores really found', ncores) + if( ncores > 2 ){ # pointless otherwise + # Need a slowish example. 1e5 is too small; 1e7 better, + # ... but hard on auto builders eg R-universe + BIGGOVAL <- 1e5 + slowfun <- function( pars, BIGGO) + sum( sqr( 1+1/outer( seq_len( BIGGO), pars))) + parstart <- rep( 2, 8) + system.time( + dscalar <- numvbderiv( slowfun, parstart, + BIGGO=BIGGOVAL # named extra param (part of ...) + ) + ) # scalar + # Make "doPar back end". I do not know what I am doing ... + # NB I like to leave some cores spare, hence "-1"-- + # superstition, really + ncores_target <- min( ncores-1, length( parstart)) + # Anti CRANky: ignore on your own machine: + # ncores_target should just work + ncores_avail <- get_ncores_CRANal( ncores_target) + scatn( 'Using %i cores eg cozza CRAN', ncores_avail) + CLUSTO <- makeCluster( ncores_avail) + registerDoParallel( CLUSTO, ncores_avail) + # Next bit ensures slaves can find packages... sigh. + # Necessary _here_ coz example, but you may not need it + # clusterCall does not work properly :/, so the "obvious" fails: + # clusterCall( CLUSTO, .libPaths, .libPaths()) + # Instead, we are forced into this nonsense: + print( # for debuggery with as-CRAN + eval( substitute( + clusterEvalQ( CLUSTO, .libPaths( lb)), + list( lb=.libPaths()))) + ) + # Need 'mvbutils::sqr', hence '.packages' arg + scatn( 'Starting parallel time test') + print( system.time( + dpara <- numvbderiv_parallel( slowfun, parstart, + BIGGO=BIGGOVAL, # named extra parameter + FOREACH_ARGS=list( .packages= 'mvbutils') + ) + ) + ) + scatn( 'Done') + print( rbind( dscalar, dpara)) + # To refer to other data (ie beside params) + # best practice is to put it into function's environment + # (generally true, not just for numvbderiv) + e <- new.env() + e$paroffset <- c( 6, -3) + fun2 <- function( pars) { # not a speed test, can be smaller + sum( sqr( 1+1/outer( 1:1e3, pars+paroffset))) + } + environment( fun2) <- e + scatn( 'Scalar, using extra data via environment') + print( numvbderiv( fun2, parstart)) + # Parallel version should still work, coz function's environment + # is also passed to slaves + scatn( 'Trying parallel version...') + print( try({ + numvbderiv_parallel( fun2, parstart, + FOREACH_ARGS=list( .packages= 'mvbutils') + ) + }) + ) + # Sometimes you do need to explicitly export stuff to the slave processes + # Here's a version that will get paroffset from datenv + # datenv must exist... + alt_fun2 <- function( pars){ + environment( fun2) <- list2env( datenv) + fun2( pars) + } + scatn( 'With explicit data (in parallel)') + datenv <- as.list( e) + print( numvbderiv_parallel( alt_fun2, parstart, + FOREACH_ARGS=list( + .packages= 'mvbutils', + .export= cq( datenv, fun2) # stuff that alt_fun2 refers to + ) + ) + ) + # Always tidy up your clusters once you have finished playing + stopImplicitCluster() + stopCluster( CLUSTO) + rm( CLUSTO) + } # if ncores>2 + } # parallel Loading required package: doParallel Loading required package: foreach Loading required package: iterators Loading required package: parallel 16 cores really found Error in stopCluster(CLUSTO) : CRANtidote Calls: get_ncores_CRANal -> stopCluster Execution halted Flavor: r-oldrel-macos-arm64