I am using tasks.Parallel.ForEach(pieces, helper) that I copied from the Grasshopper parallel.py code to speed up Python when processing a mesh with 2.2M vertices. In order to minimize thread overhead, I divide the data into n pieces where n is the number of threads on my computer. But n is not fixed since I use my laptop (n = 8) when traveling, like now in NYC, and my tower computer (n = 36) when at home in Portland, OR.
My question is, how do I get the number of cores or threads from within a Python script?
but sysconf is not recognized.
print ‘count =’, multiprocessing.cpu_count()
but import does not find multiprocessing.
I know Holomark shows the number of threads in its summary, but I have not located its source code in order to discover how it obtains this information.
Thanks in advance for your help.