- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm developping an algorithm that greatly benefits from the speed-up provided by the Intel compiler. However, x86 is not the only platform, so the code has to be quite portable, which creates some problems with ICL.
More precisely, I often use #pragma ivdep (on Win32 platform) to make sure that some loops vectorize. But because I also compile with other compilers, I put ivdep in a macro so that I dont get warnings with them:
#ifdef __INTEL_COMPILER
#define icc_ivdep ivdep
#else
#define icc_ivdep
#endif
This works prefectly fine in Windows. However, I now ported my algo to the Mac/x86, and when I compile with ICL for Mac, it does not quite work as expected. If I use "#pragma ivdep" directly in the code, its ok, but if I use the macro, then its not ok. It doesnt recognize the pragma ivdep if it is in the macro. The strange thing is that it is working fine on Windows with ICL for Win.
What is going on here? I thought it should show behave in the same way, since its the same compiler?! Any ideas?
A
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It might be better to find out whether a more specific directive, which will not be misinterpreted by other compilers, will do the job, such as compiler option -ansi-alias, C99 restrict qualifier, or #pragma vector always, to name some of the more common cases.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
THanks for the quick answer. __INTEL_COMPILER is not the problem. Actually, we can remove the #ifdef, just to have a "#define icc_ivdep ivdep" and no other lines, and it will still not work. It seems that macro substitutions do not happen if they are in a pragma on OS X (again its fine in Windows).
For the other keywords, I havent looked into that in a long time, but the combination of -ansi-alias and ivdep was necessary for my loops to vectorize. I'll try the restrict keyword. As for pragma vector always, it'll ahve the same problem (not recognized by other compilers, so warning, and cant disable it with a macro).
A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually this is not a bug.
Intel compiler are compatible with the native development tool of the platform. In this case, gcc for Mac OS X. The Intel compilerbehaviour is the same for gcc on Mac OS X platform. Note that gcc does not perform the macro substitution for pragma. You can see this by preprocessing the source and view the resulting output. What's worse is gcc does not tell you that it did not perform the substitution.
Intel compiler provides a warning. See below.
intels-mac-pro:~ ale$ cat t2.cpp
#ifdef _IVDEP
#define my_ivdep ivdep
#endif
int main (void)
{
#pragma my_ivdep
return 0;
}
intels-mac-pro:~ ale$ g++ -D_IVDEP -E t2.cpp
# 1 "t2.cpp"
# 1 "
# 1 "
# 1 "t2.cpp"
int main (void)
{
#pragma my_ivdep
return 0;
}
intels-mac-pro:~ ale$
intels-mac-pro:~ ale$
intels-mac-pro:~ ale$ icpc -D_IVDEP -E t2.cpp
# 1 "t2.cpp"
int main (void)
{
#pragma my_ivdep
return 0;
}
intels-mac-pro:~ ale$
intels-mac-pro:~ ale$
intels-mac-pro:~ ale$ icpc -D_IVDEP t2.cpp
t2.cpp(7): warning #161: unrecognized #pragma
#pragma my_ivdep
^
intels-mac-pro:~ ale$ g++ -D_IVDEP t2.cpp
intels-mac-pro:~ ale$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page