Skip to content

parallelLibrary() not effective if parallelStartSocket was called with level #67

@mb706

Description

@mb706

parallelLibrary() does not have any effect if parallelStartSocket was called with a level argument. I assume this happens because whatever distributes the library to the worker processes is run without the correct level. Some other functions, for example parallelSource(), may also be affected (not checked this).

> library("parallelMap")
> parallelRegisterLevels(levels = "test")
> parallelStartSocket(1, level = "custom.test")
Starting parallelization in mode=socket with cpus=1.
> parallelLibrary("randomForest")
Loading required package: randomForest
randomForest 4.6-14
Type rfNews() to see new features/changes/bug fixes.
> parallelMap(function(.) search(), 1, level = "custom.test")
Mapping in parallel: mode = socket; level = custom.test; cpus = 1; elements = 1.
[[1]]
[1] ".GlobalEnv"        "package:stats"     "package:graphics" 
[4] "package:grDevices" "package:utils"     "package:datasets" 
[7] "package:methods"   "Autoloads"         "package:base"     

note that "package:randomForest" is not in search().

Cf. parallelStart without level:

> parallelStartSocket(1)
Warning in parallelStart(mode = MODE_SOCKET, cpus = cpus, socket.hosts = socket.hosts,  :
  Parallelization was not stopped, doing it now.
Stopped parallelization. All cleaned up.
Starting parallelization in mode=socket with cpus=1.
> parallelLibrary("randomForest")
Loading packages on slaves for mode socket: randomForest
> parallelMap(function(.) search(), 1, level = "custom.test")
Mapping in parallel: mode = socket; level = custom.test; cpus = 1; elements = 1.
[[1]]
 [1] ".GlobalEnv"           "package:randomForest" "package:stats"
 [4] "package:graphics"     "package:grDevices"    "package:utils"
 [7] "package:datasets"     "package:methods"      "Autoloads"
[10] "package:base"

which has "package:randomForest" present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions