I am converting a series of low-level operations from matlab native code to high-speed C / mex code. (These low-level operations can be made vectorized in .m code, but I think I get memory images with big data.) I noticed that compiling mex code with various CFLAGS can lead to moderate improvements. For example, it CFLAGS = -O3 -ffast-mathreally gives some acceleration due to a moderate numerical error.
My question is: what are the “best” CFLAGS to use without causing too many other side effects? At least CFLAGS = -O3 -fno-math-errno -fno-unsafe-math-optimizations -fno-trapping-math -fno-signaling-nanseverything seems
to be in order. I'm not sure about -funroll-loops.
Also, how would you optimize the set of CFLAGS used, semi-automatically, without nuts?
source
share