allow ntasks to be 0 and determine whetheher to use threads based on nthreads rather...