Search code examples
rparallel-processinghpclsf

BatchJobs results gives the function result * -1 + job#?


I am running a minimal example using BatchJobs, and the results are not as expected. I'm using the global_config settings, with debug=TRUE. I am running the following code in R on my HPC server:

library(BatchJobs)
reg <- makeRegistry(id = "batchtest")

batchMap(reg, identity, 1)
submitJobs(reg)
showStatus(reg)

load("batchtest-files/jobs/01/1-result.RData")
1-result
[1] 0

If I run batchMap(reg, identity, 2) the result is -1, and with batchMap(reg, identity, 3) the result is -2. Any ideas why this might be happening? The identity function should just return the argument (so it should be 1 for the code above). I find the same issue with other functions. For example, if I use mean(rnorm(100, mean=100)) for the function I send to batchMap, I end up with results around -99. If I run this on multiple nodes, the results from each node are around -100 + node number (so the results from the 5th node are around -95).


Solution

  • Try an ls(). Probably the correct result from the load command is stored in the variable result. When you calculate 1-result you will get exactly the results you described.