Now automatically find number of cores, for multithreaded operation.