Hi, all! Typing from Italy This little piece of code works if the matrix size is less then 800 and fails with a segmentation fault for higher sizes.... I have tried it with gcc 4.3.2 compiler in linux and macosx and VisualStudio compiler in windows. Seemsthe problem is in the stack size..... how can I increase it ? How can I solve the problem for bigger matrix sizes ? The code works fine in serial put fails in parallel execution. Thanks.
#include <omp.h>
#include <stdio.h>
#define Nu 4000
int main() {
float A[Nu][Nu],B[Nu][Nu],C[Nu][Nu];
int i,j;
#pragma omp parallel
printf("Hello from thread %d, nthreads %d\n", omp_get_thread_num(), omp_get_num_threads());
#pragma omp parallel for private(j,i) shared(A,B,C) schedule(static)
for(j=0;j<Nu;j++){
for(i=0;i<Nu;i++){
//printf("Hello from thread %d, i,j %d %d\n", omp_get_thread_num(),i,j );
A[i][j]=0;
B[i][j]=0;
C[i][j]=0;
}}
}