Detect number of CPU cores