This forum has been archived. All content is frozen. Please use KDE Discuss instead.

__attribute__((aligned(16)) compile error on IBM xlC

Tags: None
(comma "," separated)
mezhaka
Registered Member
Posts
2
Karma
0
Hello,

I would like to know if I am able to compile Eigen on a platform that is not listed in the supported platforms list.

I am trying to compile a project, which includes Eigen on Power6 machine with AIX using IBM XL C/C++ compiler (xlC) and get the follwoing error:
Code: Select all
palabos-v0.7r2/externalLibraries/Eigen/src/Core/util/Macros.h", line 193.2: 1540-0859 (S) #error directive: Please tell me what is the equivalent of __attribute__((aligned(16))) for your compiler.


Here is the code that generates the error:
Code: Select all
#if !EIGEN_ALIGN
#define EIGEN_ALIGN_128
#elif (defined __GNUC__)
#define EIGEN_ALIGN_128 __attribute__((aligned(16)))
#elif (defined _MSC_VER)
#define EIGEN_ALIGN_128 __declspec(align(16))
#else
#error Please tell me what is the equivalent of __attribute__((aligned(16))) for your compiler
#endif


As I understand from the IBM docs http://publib.boulder.ibm.com/infocenter/comphelp/v111v131/index.jsp?topic=/com.ibm.xlc111.aix.doc/language_ref/variable_attrib.html The __attribute__ extension is supported by xlC and I just need to add something like
Code: Select all
#elif (defined _WHAT_GOES_HERE?)
#define EIGEN_ALIGN_128 __attribute__((aligned(16)))


So, what should I put instead of _WHAT_GOES_HERE? What would be the right spot in the code to do that and would it be the only place to put it or it would trigger the chain reaction of inconsistencies?

Any comments are appreciated.
User avatar
bjacob
Registered Member
Posts
658
Karma
3
Just put whatever preprocessor symbol is used to detect XLC. In other words, I don't hope that there is a universal preprocessor symbol identifying compilers that support __attribute__ so let's just special case each of them --- in your case, XLC.

If you're interested in XLC, you'll be interested to know that you're not the only one, another user (Aron) on the mailing list is too and is working with IBM on fixing XLC bugs preventing them to use it with Eigen, just mentioning so the eigen mailing list is a good place to discuss XLC-related issues.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
mezhaka
Registered Member
Posts
2
Karma
0
bjacob wrote:Just put whatever preprocessor symbol is used to detect XLC. In other words, I don't hope that there is a universal preprocessor symbol identifying compilers that support __attribute__ so let's just special case each of them --- in your case, XLC.


Thank you. It seems it works.
I've found this preprocessor symbol here http://publib.boulder.ibm.com/infocente ... acros.html and changed the code to include one more #ifdef:

Code: Select all
#if !EIGEN_ALIGN
#define EIGEN_ALIGN_128
#elif (defined __GNUC__)
#define EIGEN_ALIGN_128 __attribute__((aligned(16)))
#elif (defined _MSC_VER)
#define EIGEN_ALIGN_128 __declspec(align(16))
#elif (defined __IBMCPP__)
#define EIGEN_ALIGN_128 __attribute__((aligned(16)))
#else
#error Please tell me what is the equivalent of __attribute__((aligned(16))) for your compiler
#endif


This seem to fix this particular problem and now I am deciphering another bunch of errors, which I guess are not directly related to Eigen.
User avatar
bjacob
Registered Member
Posts
658
Karma
3
Yes, as I said, Aron has been working with IBM on this, it seems that a few XLC bugs need to be fixed before it can understand Eigen. It seems that the id of one of these is: PMR 02135,999,832 although I haven't tried to view it and don't even know if it's public.

You should contact Aron if you're interested in Eigen/XLC, I will PM you his email address.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
well at least it is harmless to add XLC in the list of compiler supporting the __attribute__ syntax, so I did so before we forget. (changeset 0e34b21b40a7)


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient