I have three large lists that need to have certain values removed from them. Each list is completely independent of each other, so three threads should be able to execute these in parallel. Here's a MWE of what I want to do:
In serial:
maxN = 1000000;
list1=RandomReal[1,maxN];
list2=RandomReal[1,maxN];
list3=RandomReal[1,maxN];
list1=DeleteCases[list1,x_/;x>=0.5];
list2=DeleteCases[list2,x_/;x>=0.5];
list3=DeleteCases[list3,x_/;x>=0.5];
As you can see, it is very straight forward. I have tried wrapping the entire block of "DeleteCases" with Parallelize
and ParallelTry
but it shows no speedup. In fact, it actually slows it down a bit. Of course, I am using LaunchKernels[]
first, which loads 4 kernels (I have 1 physical CPU, 4 physical cores, 8 logical cores).
Is there a way I can execute each line on a different kernel such that I can evaluate a single cell and have it fork the jobs to 3 kernels? (i.e. this is a piece of larger cell which I do not want to split between cells or other notebooks)
Again, this is a MWE. I do not have 3 simple lists like this, but I do want to delete specific cases from each list. That's the part I need to parallelize.
This is running on Mathematica 9, Win 10 x64.
Thanks!
3
with{3}
and then it'll run. However, I need to save the results of the output, and that doesn't happen. I will modify above to show what I need. Ok: so say I usedParallelTable[ list[[i]]=DeleteCases[list[[i]], x_ /; x >= 0.5], {i, 1, 3}]
It still doesn't actually save it to list[[i]] for some reason... $\endgroup$