Use sage.parallel.ncpus.ncpus to detect the number of cpus.