I recently started learning openMP and I am trying to parallelize my code for convolution. Once I added #pragma to the for loop which is initializing the image array and there's no data dependency, the code broke and threw Segmentation fault (core dumped). I couldn't figure out what's wrong. Please help!
// map values from original image to padded image #pragma omp parallel for schedule(static) for (size_t j = 0; j < n * n; j++) { size_t row = (j / n) + padding; size_t col = (j % n) + padding; size_t pos = (n + (padding * 2)) * row + col; padded_image[pos] = image[j]; }
outputallocated / declared? Adding (or removing) code, and all of a sudden things break for no apparent reason, has all the earmarks of memory corruption.