pragma omp for/parallel not working?
<p>I have this code</p>

<pre><code>#define N 2048
int main(void)
{
    FILE *fp1;
    fp1=fopen("myfile.txt", "a");
    for(int i=0;i&lt;N;i++)
    {
        #pragma omp parallel
        {
            int *x=malloc(sizeof(int)*N);
            int *xtemp=malloc(sizeof(int)*N);
            int (*adj)[N];
            adj=malloc(sizeof *adj *N);
            ...//other declarations
            #pragma omp for
            for(int k=0;k&lt;100;k++)
            {
                /* do things involving x,xtemp, adj...*/
            }
            fprintf(fp1,"things \n");
            ... //free vectors part...
        }
    }
    fclose(fp1);
    return 0;
}
</code></pre>

<p>The code seems to run fine, but when I check with <code>htop</code> the usage of my cpu (i3 dual core with hyper-threading), I see that only one thread is working at 100%. </p>

<p>So I put some <code>printf</code> in my code to see how many times I would get the same writing on my terminal, like, after :</p>

<pre><code>#pragma omp parallel
 {
   printf("Hey, I'm inside the par zone!\n"); 
    .... 
 }
</code></pre>

<p>but it seems that I get only one <code>printf</code> per time, so I think that only one core is working. I tried the same thing after the <code>pragma omp for</code> part but still get the same issue. </p>

<p>Why it seems that <code>pragma omp parallel</code> is not parallelizing anything? I tried a simpler program  (a simple parallelized version of hello world!) and it works, I get as many stamps as my core numbers. </p>

<p>I tried to put all together in a <code>#pragma omp parallel for</code> loop but I get a segmentation fault - core dumped error...</p>

<p>...........................</p>

<p><a href="http://textuploader.com/d5lyi" rel="nofollow">Here</a> it is my MCVE code, it gives the same problem.  (Sorry for the indents, but the file uploader screwed up things).
The functions before main just make some calculations, using rand(), nothing special. </p>

<p>my compilation line is:<code>gcc -w -std=c99 MC.c -o try  -lm -fopenmp -lquadmath -O3
</code></p>