Hi all, Any tips on how to use doParallel as part of a function in a package that I am writing? The function calls compiled C code, and (as far as I know), doParallel requires you to load C functions for each core that you use (either with the .packages argument to foreach(), or by explicitly loading the object for each loop). However - the package doesn't pass the "check" command when I try to build it. I suspect that this is because the package isn't yet loaded into the namespace while it is being checked, and doParallel can therefore not find it. Does anyone know whether my suspicion is wrong, or whether there is a better way to handle doParallel in this case? Many thanks, -- Adam Clark PhD Candidate, Dept. Ecology, Evolution, and Behavior University of Minnesota, Twin Cities 100 Ecology Building, 1987 Upper Buford Circle, St. Paul, MN 55108 atclark@umn.edu, (857)-544-6782, www.cbs.umn.edu/lab/tilman/adamclark [[alternative HTML version deleted]]
I am going to go out on a limb and suggest that you not do this at all. Packages are good places for algorithms, and parallel processing is an infrastructure optimization that a) is not always an efficiency win, and b) can be quite sensitive to the actual infrastructure that is available (best solutions for Windows and *nix platforms often being noticeably different). If you have considered this already and still intend to proceed, I have to defer to someone else for an answer to your actual question. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. On April 26, 2014 11:52:18 AM PDT, Adam Clark <atclark at umn.edu> wrote:>Hi all, > >Any tips on how to use doParallel as part of a function in a package >that I >am writing? The function calls compiled C code, and (as far as I know), >doParallel requires you to load C functions for each core that you use >(either with the .packages argument to foreach(), or by explicitly >loading >the object for each loop). > >However - the package doesn't pass the "check" command when I try to >build >it. I suspect that this is because the package isn't yet loaded into >the >namespace while it is being checked, and doParallel can therefore not >find >it. > >Does anyone know whether my suspicion is wrong, or whether there is a >better way to handle doParallel in this case? > >Many thanks,