[R] Debugging foreach loop with doMC
Jannis
bt_jannis at yahoo.de
Mon May 23 15:33:13 CEST 2011
Dear list members,
I am running a rather long forach loop while using 16 cores on a cluster simultaneously using the package doMC. After approximately 12000 calculations I get the following error message:
Fehler in calcs.iter(i) :
task 5166 failed - "Indizierung auÃerhalb der Grenzen"
calcs.iter here is the function that is executed in each foreach iteration. The error clearly indicates some sort of indexing error.My problem is that I can not reproduce it by running the calcs.iter function outside foreach to identify which line of code actually causes the error. For this I would need the value of i where the error actually occurred. This value does not seem to be related to the task number (5166) given in the error message.
Is there any way to retrieve this i? I added a print(i) to calc.iter and tried to reproduce the error with several of the i values that were printed before the error occurred but to no avail.
The forach call is:
library(forach)
library(doMC)
registerDoMC(16)
data.results.all=foreach(i=1:n.iters, .combine=abind.mod,
.multicombine = TRUE) %dopar% calcs.iter(i)
calcs.iter is quite a complicated combination of functions so posting all of them here would probably not really help.
Thanks a lot
Jannis
More information about the R-help
mailing list