-
Notifications
You must be signed in to change notification settings - Fork 988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
do not limit DTthreads to number of cores? #2914
Comments
Yes. The OS has thousands of threads doing this all the time. The downside to setting Apparently |
Any suggestion to achieve |
I'm not following this question: just call |
related to #3300 |
PR #3435 solved this. |
For maximum threads used in parallel OpenMP code we are using
getDTthreads
which usesomp_get_max_threads()
. That make sense.But today I read on http://pages.tacc.utexas.edu/~eijkhout/pcse/html/omp-basics.html#Aboutthreadsandcores
I checked my proc with dummy
sleep
call, and despite having 2 cores, setting more threads did actually more stuff in parallel then it "should".Below function write to integer array number of thread that is evaluating the loop, then it prints that array.
I have 2 cores, thus this is current default, works as expected, instead of 10s, it spent 5s, half of iterations were made with thread 0, another half with thread 1:
Now force to single thread, as expected took 10s, and all iterations were made by thread num 0:
And now the tricky one, more threads than cores. Why each iteration has own thread number I can image - more threads are there, they are just sequentially evaluated by 2 cores, retaining own numbers. But why total time is only 1s, as I would have 10 cores?
Maybe during
sleep
cores can switch to another thread? maybesleep
is just not good for this case. Don't know, thus question, what are drawbacks of setting more threads than cores? I assume they are queued on all available cores anyway, so doesn't looks it harms anyway. Why my 2 core cpu behaves like 10 core cpu in above case?My
lscpu
:gcc:
The text was updated successfully, but these errors were encountered: