Introspect core count in SpatialOps
Compile-time introspection:
CMake provides a way to determine processor counts. See also this blog post.
We could leverage this to help auto-populate the number of threads for SpatialOps. This could, in turn, be used in ExprLib.
Runtime introspection
Several approaches are given here.
Other considerations
Once the threadcommunicator branch is merged, we have a few things to note:
- The number of threads in ExprLib and SpatialOps are multiplicative, and should never exceed the physical core count on the machine.
- The core count per socket should be divisible by the SpatialOps thread count.
- Thread count should generally not exceed the number of cores per socket if ExprLib is built on top of SpatialOps.
Note also that execution will halt in the threadcommunicator branch if the number of threads exceeds the number of cores. This could be fixed if we can guarantee that the threadpool is not sized to exceed the physical core count.