Skip to contentSkip to conversation

Question regarding pthread_cond_wait/pthread_cond_signal latencies

DISCUSSION Pedro Gonnet 2 participants 3 messages May 20, 2011 – May 22, 2011

lore
Share & tools
lore
#0 lore raw

Hi guys,

I'm currently working on a shared-memory parallel Molecular Dynamics simulation library (http://mdcore.sourceforge.net/) geared towards multi-core systems.

The library uses pthreads (plus some OpenMP for some simple loops) and uses pthread_cond_wait and pthread_cond_signal to coordinate a group of worker threads.

I've been profiling the library on different machines and kernels and have noticed that in many cases there are significant (several ms, measured with Intel's Vtune-thing) lags between calls to pthread_cond_signal and the waiting thread actually getting back to work.

I've tried the Ubuntu -rt and -preempt kernels, and the whole simulation runs twice as slowly, despite following the advice given here:

https://rt.wiki.kernel.org/index.php/HOWTO:_Build_an_RT-application

My question is the following: which kernel (or set of configuration options) will minimize these latencies? And if linux-rt is the answer, in what ways do I have to be careful when porting the simulation for this kernel?

Cheers and thanks,
Pedro

#1 lore raw
Quoted 10 lines · Pedro Gonnet

Hi guys,

I'm currently working on a shared-memory parallel Molecular Dynamics simulation library (http://mdcore.sourceforge.net/) geared towards multi-core systems.

The library uses pthreads (plus some OpenMP for some simple loops) and uses pthread_cond_wait and pthread_cond_signal to coordinate a group of worker threads.

Quoted 5 lines

I've been profiling the library on different machines and kernels and have noticed that in many cases there are significant (several ms, measured with Intel's Vtune-thing) lags between calls to pthread_cond_signal and the waiting thread actually getting back to work.

At what priority are the worker threads running ?

In order to schedule these threads by the real-time part of the CFS scheduler they should run at lest at a priority of 20 (rt_sched_class)

Regards

--Armin

Quoted 21 lines

I've tried the Ubuntu -rt and -preempt kernels, and the whole simulation runs twice as slowly, despite following the advice given here:

https://rt.wiki.kernel.org/index.php/HOWTO:_Build_an_RT-application

My question is the following: which kernel (or set of configuration options) will minimize these latencies? And if linux-rt is the answer, in what ways do I have to be careful when porting the simulation for this kernel?

Cheers and thanks,
Pedro

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 17 lines · Armin Steinhoff
Quoted 10 lines · Pedro Gonnet

Hi guys,

I'm currently working on a shared-memory parallel Molecular Dynamics simulation library (http://mdcore.sourceforge.net/) geared towards multi-core systems.

The library uses pthreads (plus some OpenMP for some simple loops) and uses pthread_cond_wait and pthread_cond_signal to coordinate a group of worker threads.

Quoted 5 lines

I've been profiling the library on different machines and kernels and have noticed that in many cases there are significant (several ms, measured with Intel's Vtune-thing) lags between calls to pthread_cond_signal and the waiting thread actually getting back to work.

Quoted 3 lines

At what priority are the worker threads running ?

In order to schedule these threads by the real-time part of the CFS scheduler they should run at lest at a priority of 20 (rt_sched_class)

... and you have to use SCHED_RR or SCHED_FIFO for the scheduling
method

--Armin

Quoted 34 lines

Regards

--Armin

Quoted 22 lines

I've tried the Ubuntu -rt and -preempt kernels, and the whole simulation runs twice as slowly, despite following the advice given here:

https://rt.wiki.kernel.org/index.php/HOWTO:_Build_an_RT-application

My question is the following: which kernel (or set of configuration options) will minimize these latencies? And if linux-rt is the answer, in what ways do I have to be careful when porting the simulation for this kernel?

Cheers and thanks,
Pedro

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html