For those of us coming from the linux world, Power shell has a tempting assortment of linux like commands, however every so often it still feels like you are trapped in bizaro land and the commands don’t quite match up. Today was one of those days.
Bash has a great history command that will list all (or most) of your recent shell commands. In PoSH history (er ok it is Get-History under the hood) only gives you for your current session.
Fear not, there is a one-liner that will get you the history that you need and love:
In Kyle’s problem he is implementing a naïve prime number generator where each loop takes an increasing amount of time. As he discovers, the dynamic scheduler makes the most sense in his case as each thread picks up a chunk of work (by default the chunks are sized 1). This sounds great but as with all things there is no such thing as a free lunch. Dynamic scheduling has a performance cost in added overhead.
In my case, I am leveraging the GNUMP library to run a test that will check to see if a number is very likely to be prime. Since the test takes a constant amount of time the default scheduler for Open MP ends up being the best as it does not have the overhead of the added book keeping that dynamic has. By default the static scheduler chunks the work into loop_count/number_of_threads chunks and then divides the work evenly between all of the threads.
Of note and worth further investigation is the auto scheduler where the developer yields control to the compiler to make the best scheduling decision. However this apparently requires using a better implementation than g++ and the default libgomp as it is hardcoded to take the static scheduler.