public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "baeuml at kit dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/43706] New: scheduling two threads on one core leads to starvation Date: Fri, 09 Apr 2010 16:22:00 -0000 [thread overview] Message-ID: <bug-43706-19017@http.gcc.gnu.org/bugzilla/> (raw) The following code results in starvation if at least two OpenMP threads are assigned to one core. #include <cstdio> int main() { while (true) { #pragma omp parallel for for (int ii = 0; ii < 1000; ++ii) { int s = ii; } printf("."); } return 0; } Compiled with > g++ -fopenmp -save-temps -o test test.cpp and ran with > GOMP_CPU_AFFINITY="0 1 2" ./test on a quad-core (Q9550) system results in veeery slow progress. However, > GOMP_CPU_AFFINITY="0 1 2 3" ./test runs as expected. This happens also, if cpu affinity is not explicitly given, but some of the cores are busy with other processes. In this case it also helps to explicitly assign each thread to one core with GOMP_CPU_AFFINITY="0 1 2 3". > gcc -v Using built-in specs. Target: x86_64-suse-linux Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.4 --enable-ssp --disable-libssp --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --program-suffix=-4.4 --enable-linux-futex --without-system-libunwind --with-arch-32=i586 --with-tune=generic --build=x86_64-suse-linux Thread model: posix gcc version 4.4.1 [gcc-4_4-branch revision 150839] (SUSE Linux) -- Summary: scheduling two threads on one core leads to starvation Product: gcc Version: 4.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: baeuml at kit dot edu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43706
next reply other threads:[~2010-04-09 16:22 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-04-09 16:22 baeuml at kit dot edu [this message] 2010-04-09 16:22 ` [Bug libgomp/43706] " baeuml at kit dot edu 2010-04-09 18:34 ` pinskia at gcc dot gnu dot org 2010-04-09 20:55 ` baeuml at kit dot edu 2010-04-09 22:11 ` mika dot fischer at kit dot edu 2010-04-20 10:23 ` jakub at gcc dot gnu dot org 2010-04-20 10:49 ` jakub at gcc dot gnu dot org 2010-04-20 12:23 ` mika dot fischer at kit dot edu 2010-04-20 15:38 ` jakub at gcc dot gnu dot org 2010-04-21 14:01 ` jakub at gcc dot gnu dot org 2010-04-21 14:01 ` jakub at gcc dot gnu dot org 2010-04-21 14:06 ` jakub at gcc dot gnu dot org 2010-04-21 14:07 ` jakub at gcc dot gnu dot org 2010-04-21 14:23 ` mika dot fischer at kit dot edu 2010-04-23 14:17 ` singler at kit dot edu 2010-04-30 8:53 ` jakub at gcc dot gnu dot org 2010-07-02 1:39 ` solar-gcc at openwall dot com 2010-07-30 14:00 ` johnfb at mail dot utexas dot edu 2010-08-13 15:48 ` singler at kit dot edu 2010-08-24 11:07 ` solar-gcc at openwall dot com 2010-08-24 11:41 ` jakub at gcc dot gnu dot org 2010-08-24 12:18 ` solar-gcc at openwall dot com 2010-08-30 8:41 ` singler at kit dot edu 2010-09-01 16:38 ` jakub at gcc dot gnu dot org 2010-09-05 11:37 ` solar-gcc at openwall dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-43706-19017@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).