Set maximum number of threads for kernel.