This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/36729] New: the parallel version of std::random_shuffle does not shuffle for OMP_NUM_THREADS=1
- From: "vincenzo dot innocente at cern dot ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jul 2008 14:33:19 -0000
- Subject: [Bug libstdc++/36729] New: the parallel version of std::random_shuffle does not shuffle for OMP_NUM_THREADS=1
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
(sorry, I'm new new gcc bug reports so I have no clue which triplets shall I
report)
cat shuffe_bug.cpp
#include<vector>
#include<algorithm>
#include<numeric>
#include<iostream>
int main() {
std::vector<int> v(1000000,1);
std::partial_sum(v.begin(),v.end(),v.begin());
std::random_shuffle(v.begin(),v.end());
for (std::vector<int>::const_iterator p=v.begin();p!=v.begin()+10;p++)
std::cout << (*p) << " ";
std::cout << std::endl;
return 0;
}
uname -a
Linux lxbuild113.cern.ch 2.6.25.1-pfm080429 #1 SMP Tue May 6 17:53:24 CEST 2008
x86_64 x86_64 x86_64 GNU/Linux
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/bin/c++ -v -O2
-D_GLIBCXX_PARALLEL -fopenmp -pthread shuffe_bug.cpp
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /build/LCG/work/gcc-4.3.1/configure
--prefix=/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34
--with-mpfr=/afs/cern.ch/sw/lcg/contrib/mpfr/2.3.1/slc4_amd64_gcc34
--with-gmp=/afs/cern.ch/sw/lcg/contrib/gmp/4.2.2/slc4_amd64_gcc34
Thread model: posix
gcc version 4.3.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-O2' '-D_GLIBCXX_PARALLEL' '-fopenmp' '-pthread'
'-shared-libgcc' '-mtune=generic' '-pthread'
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/libexec/gcc/x86_64-unknown-linux-gnu/4.3.1/cc1plus
-quiet -v -D_GNU_SOURCE -D_REENTRANT -D_GLIBCXX_PARALLEL shuffe_bug.cpp -quiet
-dumpbase shuffe_bug.cpp -mtune=generic -auxbase shuffe_bug -O2 -version
-fopenmp -o /tmp/innocent/ccaeIswI.s
ignoring nonexistent directory
"/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../../include/c++/4.3.1
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../../include/c++/4.3.1/x86_64-unknown-linux-gnu
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../../include/c++/4.3.1/backward
/usr/local/include
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/include
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/include
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/include-fixed
/usr/include
End of search list.
GNU C++ (GCC) version 4.3.1 (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.3.1, GMP version 4.2.2, MPFR version 2.3.1.
warning: GMP header version 4.2.2 differs from library version 4.1.4.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 430f7ac2667711e9fed5f89e3e054e7c
COLLECT_GCC_OPTIONS='-v' '-O2' '-D_GLIBCXX_PARALLEL' '-fopenmp' '-pthread'
'-shared-libgcc' '-mtune=generic' '-pthread'
as -V -Qy -o /tmp/innocent/ccHt8TCj.o /tmp/innocent/ccaeIswI.s
GNU assembler version 2.15.92.0.2 (x86_64-redhat-linux) using BFD version
2.15.92.0.2 20040927
COMPILER_PATH=/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/libexec/gcc/x86_64-unknown-linux-gnu/4.3.1/:/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/libexec/gcc/x86_64-unknown-linux-gnu/4.3.1/:/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/libexec/gcc/x86_64-unknown-linux-gnu/:/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/:/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/
LIBRARY_PATH=/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/:/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../:/lib/:/usr/lib/
Reading specs from
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../libgomp.spec
COLLECT_GCC_OPTIONS='-v' '-O2' '-D_GLIBCXX_PARALLEL' '-fopenmp' '-pthread'
'-shared-libgcc' '-mtune=generic' '-pthread'
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/libexec/gcc/x86_64-unknown-linux-gnu/4.3.1/collect2
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2
/usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/crtbegin.o
-L/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1
-L/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/../../..
/tmp/innocent/ccHt8TCj.o -lstdc++ -lm -lgomp -lgcc_s -lgcc -lpthread -lc
-lgcc_s -lgcc
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.1/crtend.o
/usr/lib/../lib64/crtn.o
ldd a.out
libstdc++.so.6 =>
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib64/libstdc++.so.6
(0x00007f5a954d1000)
libm.so.6 => /lib64/tls/libm.so.6 (0x0000003a00d00000)
libgomp.so.1 =>
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib64/libgomp.so.1
(0x00007f5a953a3000)
libgcc_s.so.1 =>
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.1/slc4_amd64_gcc34/lib64/libgcc_s.so.1
(0x00007f5a9528d000)
libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x0000003a01700000)
libc.so.6 => /lib64/tls/libc.so.6 (0x0000003a00a00000)
librt.so.1 => /lib64/tls/librt.so.1 (0x0000003a06100000)
/lib64/ld-linux-x86-64.so.2 (0x0000003a00800000)
=================================================
unsetenv OMP_NUM_THREADS
./a.out
8063 522681 545115 829330 854254 199905 143161 41182 625621 683678
setenv OMP_NUM_THREADS 2
./a.out
141698 99042 418031 167073 981771 346367 857412 676616 162943 49175
setenv OMP_NUM_THREADS 1
./a.out
1 2 3 4 5 6 7 8 9 10
--
Summary: the parallel version of std::random_shuffle does not
shuffle for OMP_NUM_THREADS=1
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vincenzo dot innocente at cern dot ch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36729