- completed = rep(FALSE, ............)
- #while there is jobs to do (i.e. size of tmp "file" is greater than nbSeriesPerChunk),
- #A) determine which tasks which processor will do (OK)
- #B) send each (sets of) tasks in parallel
+ #while there is jobs to do (i.e. size of tmp "file" is greater than nb_series_per_chunk)
+ nb_workers = nb_curves %/% nb_series_per_chunk
+ indices = list()
+ #incides[[i]] == (start_index,number_of_elements)
+ for (i in 1:nb_workers)
+ indices[[i]] = c(nb_series_per_chunk*(i-1)+1, nb_series_per_chunk)
+ remainder = nb_curves %% nb_series_per_chunk
+ if (remainder >= min_series_per_chunk)
+ {
+ nb_workers = nb_workers + 1
+ indices[[nb_workers]] = c(nb_curves-remainder+1, nb_curves)
+ } else if (remainder > 0)
+ {
+ #spread the load among other workers
+
+ }
+ li = parallel::parLapply(cl, indices, processChunk, WER=="mix")