R: Difference between revisions

Jump to navigation Jump to search
17 bytes added ,  3 years ago
Link to Scalability
(Heavier workload for the doParallel example)
(Link to Scalability)
Line 279: Line 279:
=== doParallel and foreach === <!--T:39-->
=== doParallel and foreach === <!--T:39-->
====Usage====  
====Usage====  
Foreach can be considered as a unified interface for all backends (i.e. doMC, doMPI, doParallel, doRedis, etc.). It works on all platforms, assuming that the backend works. doParallel acts as an interface between foreach and the parallel package and can be loaded alone. There are some known efficiency issues when using foreach to run a very large number of very small tasks. Therefore, keep in mind that the following code is not the best example of an optimized use of the foreach() call but rather that the function chosen was kept at a minimum for demonstration purposes.
Foreach can be considered as a unified interface for all backends (i.e. doMC, doMPI, doParallel, doRedis, etc.). It works on all platforms, assuming that the backend works. doParallel acts as an interface between foreach and the parallel package and can be loaded alone. There are some [[Scalability|known efficiency issues]] when using foreach to run a very large number of very small tasks. Therefore, keep in mind that the following code is not the best example of an optimized use of the foreach() call but rather that the function chosen was kept at a minimum for demonstration purposes.


<!--T:48-->
<!--T:48-->
Line 288: Line 288:
# to register the backend;
# to register the backend;
# to call foreach() by keeping it on the same line as the %do% (serial) or %dopar% operator.
# to call foreach() by keeping it on the same line as the %do% (serial) or %dopar% operator.
====Running==== <!--T:40-->  
====Running==== <!--T:40-->  


cc_staff
782

edits

Navigation menu