1

What are the trade-offs/concerns for using gcc 3.4 vs 4.4 for compiling modern Matlab MEX files?

I need to compile some off-the-shelf C++ code (kdtree) as a MEX file for use with MATLAB (R2012a) under Fedora v16. I have run into symbol problems using the latest GCC complier (4.6.x) that is the cluster default. And the system administrator is very resistant to making gcc 4.4.x, the officially supported compiler by Matlab available. (not sure why) So, instead he is proposing using the legacy (circa 2006) gcc 3.4.6 compiler. So my question is what if any trade-offs or issues are there with using the older gcc compiler? Performance? 64-bit support? Thread safety (or really multiple parallel calls)? etc?

Bryan P
  • 5,900
  • 5
  • 34
  • 49

1 Answers1

2

You're mostly missing out on the preliminary implementation of c++11 features (including standardized threads, variadic templates, etc http://wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport). As long as both compilers produce binaries that are ABI compatible with MATLAB/Octave, there arent really any version-specific safety concerns. No c compiler can solve shared-state problems for you. Performance will be slightly different, but not significant. In either compiler version I'm sure theres a more optimial implementation of your code anyway. gcc 3.4 has 64bit support.

totowtwo
  • 2,101
  • 1
  • 14
  • 21
  • What are c++0x features? Can you point me to a more optimal implementation of the code that is mex ready? – Bryan P Jun 04 '12 at 16:53
  • C++0x features are certain features that eventually became part of last year's newly updated C++11 standard. At the time GCC 4.4 was issued, C++11 still lay in the future, but C++11 was taking shape and the compiler already implemented some of it. It was called by the curious name of C++0x because it was assumed at the time that it would be completed in 2006, 2007, 2008, 2009, or.... In the event, it was completed in 2011. So, in a word, C++0x indicates a preliminary implementation of C++11, which is exactly what GCC 4.4 brings. – thb Jun 04 '12 at 17:04
  • (If appropriate, would the answerer consider appending my previous comment to his answer? The comment doesn't really stand as an answer on its own, but it gives additional information some readers might appreciate.) – thb Jun 04 '12 at 17:06
  • @BryanP I haven't looked at that kdtree code and I'd assume its optimal at a Big-O notation level. The only performance difference _might_ see between compilers are at the assembly level. They should be for the most part the same. – totowtwo Jun 04 '12 at 18:38
  • @totowtwo Makes sense that the main difference would come from customized optimization at the assembly level. I was just confused by the comment "I'm sure theres a more optimial implementation..." – Bryan P Jun 04 '12 at 21:04