Fix corner case involving threads and CUDA-aware support.