K-means for parallel architectures using all-prefix