Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7933 Discussions

Does the -ipp compiler switch define something?

Andreas_Klaedtke
Beginner
460 Views
If I use the -ipp switch with the compiler (icpc), does it define something that I can use in an #ifdef statement?
0 Kudos
5 Replies
TimP
Black Belt
460 Views
You could set -# so as to see the list of pre-defined macros. If there's nothing there, you could check for the header redefinition of functions of interest to you.
0 Kudos
Dale_S_Intel
Employee
460 Views
icc -help says:
-ipp[=]
link some or all of the Intel Integrated Performance Primitives (Intel IPP) libraries and bring in the associated headers
common - link using the main libraries set. This is the default value when -ipp is specified
crypto - link using the main libraries set and the crypto library
Dale
0 Kudos
Brandon_H_Intel
Employee
460 Views
I think we could consider a feature request, but I'm not sure I really see any value since you can use your own defined macro.

icc -ipp -D USING_IPP

and then in your code

#ifdef USING_IPP
// IPP code
#endif
0 Kudos
Dale_S_Intel
Employee
460 Views
Can you say a little more about the problem you're trying to solve? E.g., do you want to conditionally include ipp.h or a different .h file depending on whether the switch is used? Or conditionally call one function or another depending on the presence or absence of ipp? This will help us understand if there's a better solution or make a case for adding something in the compiler to help you.
Thanks!
Dale
0 Kudos
Andreas_Klaedtke
Beginner
460 Views
Dale,

The reason is exactly as you say: "Conditionally call one function (or include a header file) or another depending on the presence or absence of ipp".
I am dealing with code that has to run on different architectures. On some of them, the IPP might not be available. So I have to have code that uses the IPP and code that can work around this (by using different libraries).

I agree that I can use a define that I create myself to select the code branches. I just wondered if there is already such a define which I could use.

So, I do not think that it is critical to me to have such a define. It would be nice though :-)
0 Kudos
Reply