Fixes #684
Work on hwloc thread pinning

Fixing affinity masks. This is related to #473, #526 and #529
More hwloc thread pinning fixes

This fixes issues #473, #526 and #529
Fixing problem when a thread should be bound to multiple Cores