<p>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.</p>

<pre><code>#include &lt;omp.h&gt;
#include &lt;stdio.h&gt;
#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&lt;Nu;j++){
for(i=0;i&lt;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;

}}

}
</code></pre>

Default stack size in OpenMP is 4-8 MB. There's an environment variable called STACKSIZE you can change (for example to 16384, which is 16 MB). See chapter 5-5 of
this PDF
.