I've a problem with OpenMP. I'm trying to parallelize the first step of the Counting Sort algorithm: counting the frequencies of all the possibile values (in this case I'm counting the number of neighbors of all vertices of a graph). When I run this code on a small array (e.g. num_vertices = 100k) it works fine. Instead, when the row_ptr array is big (e.g. num_vertices = 1M) i get segmentation fault (or sometimes zsh: bus error).
PS: it works fine also with high number of iteration (e.g. num_edges = 50M) and size(e_list) = num_edges.
#pragma omp parallel for reduction(+: row_ptr[:num_vertices + 2])
for (uint64_t i = 0; i < num_edges; i++)
row_ptr[std::get<0>(e_list[i]) + 1]++;
The problem could be the available RAM of the machine or could be something else? Thank you