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.
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.
That patch does indeed fix the compilation error. The resulting code produces the correct results as well. Thanks for the quick response.
-- GitLab Migration Automatic Message --
This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/861.