Closed yanyu2015 closed 1 month ago
parallel
does not parallelize a generic loop. You'll likely have to rewrite your code to use one of the existing parallelization strategies. The help lists the variety of approaches.
I have updated my question to better describe my problem.
My approach is based on the example of parfor
you provided. I believe I am using the strategy of 'Parallelizing a Stata command'. However, there don't seem to be more detailed examples to illustrate the specifics of this strategy, so I am currently confused about how this strategy parallelizes custom commands. Or could you suggest which strategy in the help documentation I should look at to achieve the above functionality? Are there more examples for reference? I also don't know what approach I should take to rewrite the code. I hope you can guide me. Thank you very much!
I review the intermediate output of this command, and I already know where the issue lies.
When I have two loops in my defined ‘prog’ command, for example:
or
When I run the following commands to parallel
Is it the outer loop that is executed in parallel, or the inner loop that is executed in parallel, or is there a different strategy for
foreach
versusforvalues
?