I'm new to coding in parallel, but I really could use it. I need a command to call a function on each element in a huge list, and then add them all up. Currently I use something like this:
This is faster than just using
Map, but it quickly is maxing out my computer's memory. Since each evaluation on the huge list is independent and since the results are simply added, I was wondering if there was a way to get Mathematica to evaluate the sum as it is evaluating the mapping. The idea is for Mathematica to not have to keep the entire result of
ParallelMap in memory and to instead just keep the running total as it is evaluating the mapping. Is there a way to do this?