Statistics for CUDA and Applications to Task-based Programming