Number one complaint from ASP users, make it faster. Number two complaint, is what is the LE90 of their DEM. I’m only going to take a stab at answering the first one in this post. However we’ll look at it from the lazy perspective of just changing the compiler and not implementing any new crazy algorithms, because algorithms are hard.
When we build ASP’s binaries, we use an Apple variant of GCC-4.2 on OSX. When we build our Linux binaries, we use GCC 4.4.6 from RHEL6. Those compilers are relatively old, the newest GCC 4.4.6, was compiled back in 2010. Since then, new versions of GCC have been released. Clang++ has also been maturing. There have even been new processor instruction sets that have been released, like the 256 bit wide AVX.
The first test I performed was simply recording the run time for our unit tests on the Bayes EM subpixel refinement algorithm. I tested on both an OSX 10.7.5 system with a Core i7-2675QM and then an Ubuntu 12.04 system with an AMD FX 8120. Both systems support the AVX instruction set. I was able to get newer compilers on the OSX system by using MacPorts. For the Ubuntu box, I installed almost everything through Aptitude. However, I got the Clang-3.1 binaries directly from the LLVM website.
|Compiler||-O3 -mno-avx||-O3 -mavx||-O3 -mavx -funsafe||-0fast -mavx -funsafe|
|Sum Px Error||Avg Time||Std Dev||Sum Px Error||Avg Time||Std Dev||Sum Px Error||Avg Time||Std Dev||Sum Px Error||Avg Time||Std Dev|
|Sum Px Error||Avg Time||Std Dev||Sum Px Error||Avg Time||Std Dev||Sum Px Error||Avg Time||Std Dev|
I tested Clang-2.9 on Ubuntu. Unfortunately every compile operation resulted in an internal seg-fault. Clang-3.0 worked most of the time, until I manually turned on ‘-mavx’. This caused no improvement in BayesEM performance, however it did cause the test code to return bad results. Overall, GCC 4.7 and Clang 3.1 showed about 20% improvement in speed over GCC 4.4.
I also tested the performance of our integer correlator under different compilers.
|Compiler||-O3 -mno-avx||-O3 -mavx||-O3 -mavx -funsafe||-Ofast -mavx -funsafe|
|Avg Time||Std Dev||Avg Time||Std Dev||Avg Time||Std Dev||Avg Time||Std Dev|
|Avg Time||Std Dev||Avg Time||Std Dev||Avg Time||Std Dev|
Here, the newer compilers showed significant performance gains. GCC 4.7 and Clang 3.1 both showed a 100% speed improvement over GCC 4.4. Clang also managed to compile the code correctly every time unlike in the Bayes EM tests. However I would still recommend sticking with the safe and stable GCC. Their 4.7 release was able to get just as much or better performance than the Clang compilers. GCC just provides the comfort of mind knowing that it has always been able to compile VW correctly. Clang still has me on edge since it burned me so many times because it produced segfaulting assembly instructions since it is so aggressive with SIMD.