Thank you very much for your reply.
1 . I'm curious, How do you know that the thread processing your loop is the one that uses 30% of a core?
I just shared my logical thought, which can be wrong. I said that cause if i create more tasks to do, that core will increase from 30 to 50 for instance and the other ones will keep running at 99%. And even worst, if i remove the parallel directive the value will be the same but splitted by the other threads.
2. Hmmm... I'm not sure what you are asking about... threads execute the code as defined in the program...
Sorry, if i'm not explaining it as i should.
I mean that, if you create a thread with a while(1); the thread will run the loop as much as it can, using 100% cpu, which is obvious.
In this case it seams that only one thread is performing something and the other ones are simply pushing cpu usage.
For instance, i created a parallel directive and get the id through omp_get_thread_num. I only do something if the thread number is 0 for instance, if(id == 0) then something. Shouldn't be the other threads "sleeping"? They still use 100% of my cpu. That is the weirdest thing.
3. Maybe you can experiment with the environment variable OMP_WAIT_POLICY set to passive. By the way: compiler? computer? OS?
That is a good thing that i didn't know. I tried to find something about this subject googling but nothing comes with OMP_WAIT_POLICY.
I'll try it and give you the feedback.
I'm using GNU compiler, a Dore 2Duo processor (which means that omp will use 4 threads) and Linux ( Gentoo distro ) OS.
If you see that it could be something else please share your thoughts cause they will be really apprecitated
Meanwhile, I'll give a try with the policy rule.