Use number of CPUs in tests and examples