intel / mpi-benchmarks

144 stars 63 forks source link

Compile with optimizations #56

Open Flamefire opened 5 days ago

Flamefire commented 5 days ago

Currently -O0 is forcefully added disabling any optimization the compiler might do.

This could influence the results by depending more on the CPU than the actual communication.

It looks like this flag was possibly introduced by accident in b06031cdf82f6051511bc967cd84dcbe4513801f by @avmedvedev

Is there any reason to it or can this be removed or replaced by -O3 as done at https://github.com/intel/mpi-benchmarks/blob/46250385f98b57d45228465b2f62cef638e8c7cf/src_c/P2P/Makefile#L36?

IMO it should be up to the invoker which optimization level to use, but -O3 is a better option than -O0

a-v-medvedev commented 5 days ago

@Flamefire -O0 was not introduced by accident. It was the result of aligning with the IMB build approach that was there in many previous versions of IMB. I suspect that original rationalization of this made by authors more than 20 years ago was to avoid possible over-optimizations that could be made by compilers, like removing some "useless" cycles or something like this, that could potentially break the benchmark scheme. Also, applying highest levels of optimization we potentially make it more difficult to compare the results from different systems: impact of the optimization "penetrates" and mixes in the final benchmarks output.

I think those considerations are in fact not very much applicable now. Out of my experience with MPI benchmarks, the compiler optimization don't really change the traditional MPI benchmark result, if it IS a traditional MPI micro-benchmark just calling MPI functions in a loop. It may however influence the algorithms of more complex benchmarks, for example those running a fake CPU load (i.e. similar to IMB-NBC) if the algorithm is sensitive to this.

So, changing of optimization level to -O1 or -O2 could be a reasonable step after some careful testing, making it -O3 is probably an overkill.

(That is just a side note, I do not insist on anything.)