CRAN Package Check Results for Package mvbutils

Last updated on 2026-08-03 11:52:41 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.29 72.12 75.41 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.05 103.50 107.55 OK
r-release-macos-arm64 2.12.120 1.00 57.00 58.00 ERROR
r-release-macos-x86_64 2.12.120 4.00 177.00 181.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 71.00 72.00 ERROR
r-oldrel-macos-x86_64 2.12.120 3.00 167.00 170.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/Rtmp0r1WEX’ ‘~/tmp/scratch/Rtmp27eYYM’ ‘~/tmp/scratch/Rtmp2ZGRq6’ ‘~/tmp/scratch/Rtmp2h1sjZ’ ‘~/tmp/scratch/Rtmp2pVCj7’ ‘~/tmp/scratch/Rtmp2rWvKr’ ‘~/tmp/scratch/Rtmp3Ff4EL’ ‘~/tmp/scratch/Rtmp3bAzXR’ ‘~/tmp/scratch/Rtmp3c3TWT’ ‘~/tmp/scratch/Rtmp3uIzY5’ ‘~/tmp/scratch/Rtmp4Vj7zd’ ‘~/tmp/scratch/Rtmp5Cx3ei’ ‘~/tmp/scratch/Rtmp6wVdgI’ ‘~/tmp/scratch/Rtmp7CSJh0’ ‘~/tmp/scratch/Rtmp7RyPCX’ ‘~/tmp/scratch/Rtmp7jV2cY’ ‘~/tmp/scratch/Rtmp8TnAqw’ ‘~/tmp/scratch/Rtmp8l8y1i’ ‘~/tmp/scratch/RtmpA5Y7HU’ ‘~/tmp/scratch/RtmpA5r236’ ‘~/tmp/scratch/RtmpBBOKw4’ ‘~/tmp/scratch/RtmpBYLvD6’ ‘~/tmp/scratch/RtmpBeNA7G’ ‘~/tmp/scratch/RtmpBvQ7uN’ ‘~/tmp/scratch/RtmpChtzg7’ ‘~/tmp/scratch/RtmpCzfJIZ’ ‘~/tmp/scratch/RtmpDL7X92’ ‘~/tmp/scratch/RtmpDe6nEu’ ‘~/tmp/scratch/RtmpDnwmIG’ ‘~/tmp/scratch/RtmpDxYLxw’ ‘~/tmp/scratch/RtmpEQPCH5’ ‘~/tmp/scratch/RtmpEXpULv’ ‘~/tmp/scratch/RtmpF4UwF2’ ‘~/tmp/scratch/RtmpFAE9kG’ ‘~/tmp/scratch/RtmpFyGlvq’ ‘~/tmp/scratch/RtmpG4370X’ ‘~/tmp/scratch/RtmpGWUpE7’ ‘~/tmp/scratch/RtmpHBl1e5’ ‘~/tmp/scratch/RtmpHMXNKt’ ‘~/tmp/scratch/RtmpHZIZqM’ ‘~/tmp/scratch/RtmpK6UzdU’ ‘~/tmp/scratch/RtmpKC4OIJ’ ‘~/tmp/scratch/RtmpKkaRG8’ ‘~/tmp/scratch/RtmpL7KNvk’ ‘~/tmp/scratch/RtmpLRED9H’ ‘~/tmp/scratch/RtmpLZQEFT’ ‘~/tmp/scratch/RtmpM35utx’ ‘~/tmp/scratch/RtmpM3NPQU’ ‘~/tmp/scratch/RtmpNeUMiC’ ‘~/tmp/scratch/RtmpNxSzec’ ‘~/tmp/scratch/RtmpOKw8mA’ ‘~/tmp/scratch/RtmpPAAf58’ ‘~/tmp/scratch/RtmpPIwfxk’ ‘~/tmp/scratch/RtmpPR60Qu’ ‘~/tmp/scratch/RtmpQXBWcY’ ‘~/tmp/scratch/RtmpQtbBwj’ ‘~/tmp/scratch/RtmpR7lcbQ’ ‘~/tmp/scratch/RtmpRZM9Fd’ ‘~/tmp/scratch/RtmpRclPwS’ ‘~/tmp/scratch/RtmpSWDCMd’ ‘~/tmp/scratch/RtmpSiC2G7’ ‘~/tmp/scratch/RtmpThfOca’ ‘~/tmp/scratch/RtmpUGwYKP’ ‘~/tmp/scratch/RtmpVqmoOS’ ‘~/tmp/scratch/RtmpW00Huk’ ‘~/tmp/scratch/RtmpWRKWxw’ ‘~/tmp/scratch/RtmpWjo7Zy’ ‘~/tmp/scratch/RtmpXPscOR’ ‘~/tmp/scratch/RtmpXgxCya’ ‘~/tmp/scratch/RtmpXqONra’ ‘~/tmp/scratch/RtmpXviNKr’ ‘~/tmp/scratch/RtmpY3StGX’ ‘~/tmp/scratch/RtmpYIbKea’ ‘~/tmp/scratch/RtmpYIdkyk’ ‘~/tmp/scratch/RtmpYrXC8U’ ‘~/tmp/scratch/RtmpZ1gd9C’ ‘~/tmp/scratch/RtmpZAbBCF’ ‘~/tmp/scratch/RtmpakwCap’ ‘~/tmp/scratch/RtmpbQ47R7’ ‘~/tmp/scratch/RtmpcQmLEU’ ‘~/tmp/scratch/RtmpdxE3j1’ ‘~/tmp/scratch/Rtmpe8XJop’ ‘~/tmp/scratch/RtmpeYyLVX’ ‘~/tmp/scratch/Rtmpeyhzhu’ ‘~/tmp/scratch/Rtmpg5V5U4’ ‘~/tmp/scratch/RtmpgBmZpP’ ‘~/tmp/scratch/Rtmph70oce’ ‘~/tmp/scratch/RtmphSAh4a’ ‘~/tmp/scratch/RtmpiCqTco’ ‘~/tmp/scratch/RtmpifB14P’ ‘~/tmp/scratch/RtmpipZpQI’ ‘~/tmp/scratch/Rtmpj8S0jp’ ‘~/tmp/scratch/RtmpjLLRWt’ ‘~/tmp/scratch/RtmpjxdBN5’ ‘~/tmp/scratch/RtmpkCVoRO’ ‘~/tmp/scratch/Rtmpkwxiyv’ ‘~/tmp/scratch/RtmplaRreX’ ‘~/tmp/scratch/RtmplxkzSr’ ‘~/tmp/scratch/RtmpmK6GH8’ ‘~/tmp/scratch/RtmpmZw3ro’ ‘~/tmp/scratch/Rtmpnx0xZY’ ‘~/tmp/scratch/RtmpoEKYAn’ ‘~/tmp/scratch/RtmpoZa0ij’ ‘~/tmp/scratch/RtmpolmOni’ ‘~/tmp/scratch/Rtmpp8ajSe’ ‘~/tmp/scratch/RtmppbiHkO’ ‘~/tmp/scratch/RtmppmmGRK’ ‘~/tmp/scratch/RtmppqqOrc’ ‘~/tmp/scratch/RtmpqAceUQ’ ‘~/tmp/scratch/RtmpqTadcq’ ‘~/tmp/scratch/RtmprjMOKu’ ‘~/tmp/scratch/Rtmps8LUNf’ ‘~/tmp/scratch/RtmpsQyMqb’ ‘~/tmp/scratch/Rtmpt5LevC’ ‘~/tmp/scratch/RtmpuDo9iC’ ‘~/tmp/scratch/RtmpuG7AM0’ ‘~/tmp/scratch/Rtmpuk7tub’ ‘~/tmp/scratch/RtmpvYbowz’ ‘~/tmp/scratch/RtmpvtR9Qz’ ‘~/tmp/scratch/Rtmpvu3zpC’ ‘~/tmp/scratch/Rtmpvz3drW’ ‘~/tmp/scratch/Rtmpx2pbkn’ ‘~/tmp/scratch/Rtmpx6wYuE’ ‘~/tmp/scratch/RtmpxANqRs’ ‘~/tmp/scratch/RtmpxKw1Jg’ ‘~/tmp/scratch/RtmpxbLFNr’ ‘~/tmp/scratch/RtmpxfBkQT’ ‘~/tmp/scratch/RtmpxrceAx’ ‘~/tmp/scratch/RtmpzctR1G’ ‘~/tmp/scratch/xvfb-run.11S4uL’ ‘~/tmp/scratch/xvfb-run.2KZYQp’ ‘~/tmp/scratch/xvfb-run.3vqTJi’ ‘~/tmp/scratch/xvfb-run.6MosL9’ ‘~/tmp/scratch/xvfb-run.AfQOb2’ ‘~/tmp/scratch/xvfb-run.BN1ZlI’ ‘~/tmp/scratch/xvfb-run.BVOpTu’ ‘~/tmp/scratch/xvfb-run.DZdk1P’ ‘~/tmp/scratch/xvfb-run.DsuCZC’ ‘~/tmp/scratch/xvfb-run.Er6YsW’ ‘~/tmp/scratch/xvfb-run.IIjCbB’ ‘~/tmp/scratch/xvfb-run.K7PF5F’ ‘~/tmp/scratch/xvfb-run.KRL6Cr’ ‘~/tmp/scratch/xvfb-run.LBVIVA’ ‘~/tmp/scratch/xvfb-run.LHs951’ ‘~/tmp/scratch/xvfb-run.MUYTzk’ ‘~/tmp/scratch/xvfb-run.N33OEQ’ ‘~/tmp/scratch/xvfb-run.N5M8gZ’ ‘~/tmp/scratch/xvfb-run.NEqpNR’ ‘~/tmp/scratch/xvfb-run.Nh3b4n’ ‘~/tmp/scratch/xvfb-run.QPtEAJ’ ‘~/tmp/scratch/xvfb-run.QQ0cTr’ ‘~/tmp/scratch/xvfb-run.QwgMpX’ ‘~/tmp/scratch/xvfb-run.R5JI7q’ ‘~/tmp/scratch/xvfb-run.RGm6mv’ ‘~/tmp/scratch/xvfb-run.RpJh96’ ‘~/tmp/scratch/xvfb-run.Rtoo53’ ‘~/tmp/scratch/xvfb-run.Sbaiip’ ‘~/tmp/scratch/xvfb-run.WL1x1K’ ‘~/tmp/scratch/xvfb-run.aOBjyY’ ‘~/tmp/scratch/xvfb-run.bL1tnN’ ‘~/tmp/scratch/xvfb-run.bTGYBb’ ‘~/tmp/scratch/xvfb-run.eSMtO8’ ‘~/tmp/scratch/xvfb-run.eyVWua’ ‘~/tmp/scratch/xvfb-run.fXD5A0’ ‘~/tmp/scratch/xvfb-run.fmqVxD’ ‘~/tmp/scratch/xvfb-run.go8B0M’ ‘~/tmp/scratch/xvfb-run.iEnr6x’ ‘~/tmp/scratch/xvfb-run.iL1JKO’ ‘~/tmp/scratch/xvfb-run.ile7Wr’ ‘~/tmp/scratch/xvfb-run.iqVEwA’ ‘~/tmp/scratch/xvfb-run.jEzYrJ’ ‘~/tmp/scratch/xvfb-run.kPLalT’ ‘~/tmp/scratch/xvfb-run.mJczS8’ ‘~/tmp/scratch/xvfb-run.mxvco0’ ‘~/tmp/scratch/xvfb-run.njNMnY’ ‘~/tmp/scratch/xvfb-run.tOsUSJ’ ‘~/tmp/scratch/xvfb-run.uEjnan’ ‘~/tmp/scratch/xvfb-run.ugBzSY’ ‘~/tmp/scratch/xvfb-run.uxRCqH’ ‘~/tmp/scratch/xvfb-run.w2ue8g’ 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