Possible duplicate:
Unable to compile using OpenMP on Mac OS X Lion (memcpy and SSE functions)
I decided to convert my pthreaded code to OpenMP.
Prior to this, I performed many synchronizations using the atomic Intel / GCC embedded processors ( __sync_fetch_and_add ).
As expected, they will compile in lock xadd with both GCC and ICC on x64.
But when compiling on GCC using -fopenmp I start receiving calls in these places. callq ___sync_fetch_and_add_8 and the family. ICC still generates correctly optimized code.
Edit: Component refuses to bind this GCC code:
$ gcc -O3 -Wall *.o -lpthread -ldl -lgomp Undefined symbols for architecture x86_64: "___sync_fetch_and_add_8"
Edit2: This is similar to Apple GCC. I do not get this phenomenon on Red Hat gcc 4.4.6
How can I get GCC to create the same optimized embedded asm as it is without -fopenmp ?
$ gcc -v Using built-in specs. Target: i686-apple-darwin11 Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) $ icc --version icc (ICC) 12.0.2 20110112 Copyright (C) 1985-2011 Intel Corporation. All rights reserved.
Compilation with
icc -O3 -Wall -std=gnu99 -ipo -xSSE4.1 -axAVX -O3 -Wall -openmp gcc -O3 -Wall -std=gnu99 -finline-functions -funroll-loops -O3 -Wall -fopenmp
Sergey L.
source share