I have the c++ code written here below. My purpose is to set as private the two dimensional array indicated as A inside the OpenMP parallel region in particular inside the parallel for loop. However, when I run the code I get the following error: segmentation fault. (As compiler I'm using g++ in VSC).
Any suggestions?
#pragma omp parallel
{
//Allocation of A
double** A = new double*[3]
for(int i = 0; i<3; i++){
A[i]= new double[3];
}
#pragma omp for private(A)
for(int k = 0; k <N; k++)
{
//code
}
//Deallocation
for(int i=0;i<3;i++)
{
delete[] A[i];
}
delete[] A;
}