Significantly slow code when compiling with g ++ instead of LLVM

I am experimenting with an algorithm that I programmed in C ++ using Xcode 7.0. When I compare the performance of the standard LLVM compiler in Xcode with the binary generated when compiling using g ++ (5.2.0), the binary created using LLVM is an order of magnitude (> 10x) faster than the code created using the g ++ compiler.

I use the -o3 code optimization flag for the g ++ compiler as follows:

/usr/local/Cellar/gcc/5.2.0/bin/g++-5 -o3 -fopenmp -DNDEBUG main.cpp \
PattersonInstance.cpp \
... \
-o RROTprog

Compiling g ++ is necessary because the algorithm must be compiled and run on a high-performance computer, where I cannot use the LLVM compiler. Plus, I would like to use Open MP to make the code faster.

All ideas for what causes these speed differences and how they can be resolved are more than welcome.

Thanks in advance for your help!

L

+4
source share
1 answer

I can bet that the following happens: you pass to the -o3compiler instead -o3(i.e. with CAPITAL O), and for this reason -o3simply instructs the compiler to output the executable to a file called "3". However, you use -o RROTproglater on the same command line, and the latter -ois the one that is considered by the compiler when outputting the executable file.

Pure effect: -o3no, therefore optimization is not performed.

+10

Source: https://habr.com/ru/post/1611677/


All Articles