Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Compilation problem with ftree-parallelize-loops

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
Elv13
Guru
Guru
User avatar
Posts: 388
Joined: Sun Nov 13, 2005 8:42 pm
Location: Socialist land of North America

Compilation problem with ftree-parallelize-loops

  • Quote

Post by Elv13 » Sat Jun 12, 2010 9:16 pm

Hi,

After sawing more and more use of loop parallisation on gentoo user make.conf, I tried too. But it does not work fine here, most package using it compile, but packages linking to those packages have errors like:

Code: Select all

crc32.o: In function `get_crc_table._loopfn.0':
crc32.c:(.text+0x25a): undefined reference to `omp_get_num_threads'
crc32.c:(.text+0x261): undefined reference to `omp_get_thread_num'
inflatef.o: In function `inflate_dynamic':
inflate.c:(.text+0x118a): undefined reference to `GOMP_parallel_start'
inflate.c:(.text+0x1197): undefined reference to `GOMP_parallel_end'
inflatef.o: In function `inflate_fixed':
inflate.c:(.text+0x18de): undefined reference to `GOMP_parallel_start'
inflate.c:(.text+0x18eb): undefined reference to `GOMP_parallel_end'
inflate.c:(.text+0x19de): undefined reference to `GOMP_parallel_start'
inflate.c:(.text+0x19eb): undefined reference to `GOMP_parallel_end'
inflate.c:(.text+0x1ade): undefined reference to `GOMP_parallel_start'
inflate.c:(.text+0x1aeb): undefined reference to `GOMP_parallel_end'
inflate.c:(.text+0x1c5e): undefined reference to `GOMP_parallel_start'
inflate.c:(.text+0x1c6b): undefined reference to `GOMP_parallel_end'
inflatef.o: In function `inflate_fixed._loopfn.7':
inflate.c:(.text+0x22e5): undefined reference to `omp_get_num_threads'
inflate.c:(.text+0x22ed): undefined reference to `omp_get_thread_num'
inflatef.o: In function `inflate_fixed._loopfn.6':
inflate.c:(.text+0x2365): undefined reference to `omp_get_num_threads'
inflate.c:(.text+0x236d): undefined reference to `omp_get_thread_num'
inflatef.o: In function `inflate_fixed._loopfn.5':
inflate.c:(.text+0x23e5): undefined reference to `omp_get_num_threads'
inflate.c:(.text+0x23ed): undefined reference to `omp_get_thread_num'
inflatef.o: In function `inflate_fixed._loopfn.4':
inflate.c:(.text+0x2465): undefined reference to `omp_get_num_threads'
inflate.c:(.text+0x246d): undefined reference to `omp_get_thread_num'
inflatef.o: In function `inflate_dynamic._loopfn.3':
inflate.c:(.text+0x24e7): undefined reference to `omp_get_num_threads'
inflate.c:(.text+0x24ef): undefined reference to `omp_get_thread_num'
inflatef.o: In function `inflate_dynamic._loopfn.2':
inflate.c:(.text+0x2575): undefined reference to `omp_get_num_threads'
inflate.c:(.text+0x257d): undefined reference to `omp_get_thread_num'
inflatef.o: In function `inflate_dynamic._loopfn.1':
inflate.c:(.text+0x25f6): undefined reference to `omp_get_num_threads'
I added -fopenmp, but it does not work. I tried disabling every options down to -O0. -O0 work fine, but anything more than that produce the error. Adding -fno-guess-branch-probability make -O1 work, but some package still fail with -O2. I wont post my make.conf or emerge --info, as it is the one I used to do my tests (I used an empty make.conf with only ftree-parallelize-loops and -O2). Any idea how to solve the problem?
Top
Elv13
Guru
Guru
User avatar
Posts: 388
Joined: Sun Nov 13, 2005 8:42 pm
Location: Socialist land of North America

  • Quote

Post by Elv13 » Wed Jun 16, 2010 9:12 pm

up
Top
Elv13
Guru
Guru
User avatar
Posts: 388
Joined: Sun Nov 13, 2005 8:42 pm
Location: Socialist land of North America

  • Quote

Post by Elv13 » Tue Jun 29, 2010 3:13 am

look like this does not help: (compiling glibc)

Code: Select all

r/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf:/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/dlfcn:/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/nss:/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/nis:/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/rt:/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/resolv:/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/crypt:/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/nptl -o /var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc.so -T /var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/shlib.lds /var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/csu/abi-note.o /var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf/soinit.os /var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os /var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf/sofini.os /var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf/interp.os /var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/elf/ld.so -lgcc
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `initialize_env':
unwind-pe.c:(.text+0xf3776): undefined reference to `pthread_attr_setstacksize'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `gomp_new_icv':
(.text+0xf7fd0): undefined reference to `pthread_setspecific'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `team_destructor':
unwind-pe.c:(.text+0xf800e): undefined reference to `pthread_key_delete'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `initialize_team':
unwind-pe.c:(.text+0xf8046): undefined reference to `pthread_key_create'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `gomp_team_start':
(.text+0xf85ae): undefined reference to `pthread_create'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `gomp_team_start':
(.text+0xf8818): undefined reference to `pthread_attr_getstacksize'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `gomp_team_start':
(.text+0xf8835): undefined reference to `pthread_attr_setstacksize'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `gomp_team_start':
(.text+0xf88ab): undefined reference to `pthread_setspecific'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `get_num_procs':
unwind-pe.c:(.text+0xf9193): undefined reference to `pthread_getaffinity_np'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `gomp_init_num_threads':
(.text+0xf9215): undefined reference to `pthread_getaffinity_np'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `gomp_ialias_omp_get_wtick':
(.text+0xf9aa6): undefined reference to `clock_getres'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `gomp_ialias_omp_get_wtick':
(.text+0xf9ad4): undefined reference to `clock_getres'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `gomp_ialias_omp_get_wtime':
(.text+0xf9b06): undefined reference to `clock_gettime'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `gomp_ialias_omp_get_wtime':
(.text+0xf9b34): undefined reference to `clock_gettime'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `gomp_init_thread_affinity':
(.text+0xf9ff4): undefined reference to `pthread_attr_setaffinity_np'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `gomp_init_affinity':
(.text+0xfa055): undefined reference to `pthread_getaffinity_np'
/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc_pic.os: In function `gomp_init_affinity':
(.text+0xfa1dc): undefined reference to `pthread_setaffinity_np'
collect2: ld returned 1 exit status
make[1]: *** [/var/tmp/portage/sys-libs/glibc-2.11.2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc.so] Error 1
make[1]: Leaving directory `/var/tmp/portage/sys-libs/glibc-2.11.2/work/glibc-2.11.2'
make: *** [all] Error 2
 * ERROR: sys-libs/glibc-2.11.2 failed:
 *   make for x86 failed
 * 
 * Call stack:
 *           ebuild.sh, line   54:  Called src_compile
 *         environment, line 3892:  Called eblit-run 'src_compile'
I tried adding -pthread to my cflags, but no luck.

I installed a new Gentoo on my laptop using the same make.conf (with loop parallelization) and it work without issue, so there is something wrong here, but what
Top
EndrjuX
Tux's lil' helper
Tux's lil' helper
Posts: 75
Joined: Sun Apr 17, 2005 7:45 pm
Location: Poland
Contact:
Contact EndrjuX
Website

  • Quote

Post by EndrjuX » Fri Jul 02, 2010 2:59 pm

Same problem here.

Some other apps that die with similar errors:
dev-lang/perl
media-plugins/live
sys-boot/grub
media-libs/freetype
media-gfx/splashutils
dev-java/icedtea
dev-python/PyQt4
app-office/openoffice

From emerge --info:

Code: Select all

System uname: Linux-2.6.34-gentoo-x86_64-AMD_Phenom-tm-_II_X4_955_Processor-with-gentoo-2.0.1
sys-devel/gcc:       4.5.0
CFLAGS="-O2 -march=native -pipe -floop-interchange -floop-strip-mine -floop-block -ftree-vectorize -ftree-loop-distribution -floop-parallelize-all -ftree-parallelize-loops=4"
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -fopenmp -lgomp"
As you can see I'm using graphite things, vectorization and parallelization of loops. And only parallelization is problematic. (Elv13 is using parallelization only, so it's not combination of those features) Adding "-lpthread" doesn't change anything for glibc, but some other apps die without "-fopenmp -lgomp". (Apps listed above die anyway)

I'm wondering if that whole loop parallelization thing really improves apps performance so much...
Yes. No. Dunno.
Top
Elv13
Guru
Guru
User avatar
Posts: 388
Joined: Sun Nov 13, 2005 8:42 pm
Location: Socialist land of North America

  • Quote

Post by Elv13 » Sat Jul 03, 2010 8:05 pm

-floop-parallelize-all will probably make things worst, spliting a int i =0; i < 3 loop in 4 will be about 20x slower than just running it, if not more. Let the compiler decide if it is good or not. -lgomp is useless by the way, it will not improve things and if it override --as-needed, it will make things slower. I am also not sure about -ftree-loop-distribution, it may make things slower too. Loops have to be very complex for this to have any value, I am not sure when GCC decide to split loop, but if it is not very careful, when taking the choice, performances will degrade badly and eat CPU cycle for nothing.

I see "simple" parallelization of big loop as a free gain when the thread init time is smaller than the number of instances it will have to run, but for all other, deeper, loop optimization, I don't think it worth compiling all packages with them turned on.
Top
EndrjuX
Tux's lil' helper
Tux's lil' helper
Posts: 75
Joined: Sun Apr 17, 2005 7:45 pm
Location: Poland
Contact:
Contact EndrjuX
Website

  • Quote

Post by EndrjuX » Sat Jul 03, 2010 8:52 pm

Have a look at http://gcc.gnu.org/wiki/Graphite/Parallelization
You can trigger it by 2 flags -floop-parallelize-all -ftree-parallelize-loops=4. Both of them is needed
Are you sure that -lgomp is useless? As I said some packages don't compile without those two in LDFLAGS, certainly one of them is required.

And after your post and some more reading in gcc manual i think i'll drop ftree-loop-distribution, thanks. ;-)
Yes. No. Dunno.
Top
Elv13
Guru
Guru
User avatar
Posts: 388
Joined: Sun Nov 13, 2005 8:42 pm
Location: Socialist land of North America

  • Quote

Post by Elv13 » Tue Jul 06, 2010 5:08 pm

-lgomp is part of -fopenmp (at least, gcc should detect it need to be, ass gomp stand for Gnu/GCC OpenMP)

and read this page http://gcc.gnu.org/onlinedocs/gcc-4.5.0 ... tions.html
not the other one, it clearly say that -floop-parallelize-all does not check if it is profitable, and in most case, it is not.
Top
Neskweek
n00b
n00b
User avatar
Posts: 35
Joined: Sun Jun 20, 2004 1:30 pm
Location: Nantes - France

  • Quote

Post by Neskweek » Tue Jul 20, 2010 2:11 pm

You can trigger it by 2 flags -floop-parallelize-all -ftree-parallelize-loops=4. Both of them is needed
Indeed

But since :
Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Starting parallel fetch

>>> Emerging (1 of 1171) sys-libs/zlib-1.2.5-r2
* zlib-1.2.5.tar.bz2 RMD160 SHA1 SHA256 size ;-) ... [ ok ]
* checking ebuild checksums ;-) ... [ ok ]
* checking auxfile checksums ;-) ... [ ok ]
* checking miscfile checksums ;-) ... [ ok ]
* Filtering out invalid CFLAG "-floop-parallelize-all"
* Filtering out invalid CXXFLAG "-floop-parallelize-all"

this instructions can't work properly

I tried with gcc (Gentoo 4.4.4-r1 p1.0, pie-0.4.5) 4.4.4
and this CFLAG :
-march=k8-sse3 -O2 -pipe -ftree-loop-linear -floop-block -floop-interchange -floop-strip-mine -fgraphite-identity -finline-functions -fira-algorithm=CB -fira-region=mixed -ftree-loop-distribution -floop-parallelize-all -ftree-parallelize-loops=4
Top
Post Reply

8 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic