New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 861 - _mm_malloc() and _mm_free() incorrectly selected when compiling with Portland Group compiler
_mm_malloc() and _mm_free() incorrectly selected when compiling with Portland...
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: General
3.2
x86 - 64-bit Linux
: Normal Compilation Problem
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-20 20:11 UTC by drnairb
Modified: 2014-08-26 13:03 UTC (History)
3 users (show)



Attachments
Enable posix_memalign with PGI (961 bytes, patch)
2014-08-22 09:00 UTC, Gael Guennebaud
no flags Details | Diff

Description drnairb 2014-08-20 20:11:07 UTC
When compiling with the Portland Group C++ compiler (v14.4, haven't tried anything older), the macro EIGEN_HAS_MM_MALLOC is activated, which sets the pointer function aligned_malloc() to use _mm_malloc(), and the pointer function aligned_free() to use _mm_free() in Eigen/src/Core/util/Memory.h. The Portland compiler does not implement either of these functions, causing an error during compilation.

The macro is activated because Eigen activates EIGEN_VECTORIZE_SSE in the file "Core". I think this macro in turn is activated through the definition of EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC.

I believe the correct function to use for Portland is posix_memalign() (see this thread: http://www.pgroup.com/userforum/viewtopic.php?t=3573&sid=4b01d3b80e36d77323fe55ec82f53854). This means that the macro EIGEN_HAS_POSIX_MEMALIGN should be defined instead of EIGEN_HAS_MM_MALLOC. I have forced this definition in Memory.h and Portland does indeed compile without error.
Comment 1 Gael Guennebaud 2014-08-22 09:00:52 UTC
Created attachment 487 [details]
Enable posix_memalign with PGI

Could you test the attached fix and confirm that it is doing the job. Thank you.
Comment 2 drnairb 2014-08-22 17:03:12 UTC
That patch does indeed fix the compilation error. The resulting code produces the correct results as well. Thanks for the quick response.

Note You need to log in before you can comment on or make changes to this bug.