Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

CMake configuration for static dispatching?

wombat
Beginner
4,676 Views

I am linking statically IPP to my project using CMake. I basically do:

// CMakeLists.txt
...
set(IPP_SHARED OFF)
find_package(IPP REQUIRED)
target_link_libraries(myapp PRIVATE ${IPP_LIBRARIES})
...

and then

// myapp.c
#include <ipp.h>
...

And this is fine.

However, I want to use static dispatching as I have the luxury to know the target hardware:

// myapp.c
#include <ipp_e9.h>
...

This doesn't work as `ipp_e9.h` is not in the include paths returned by the `IPP` package. What configuration should I use to enable it?

0 Kudos
1 Solution
ShanmukhS_Intel
Moderator
4,094 Views

 

Hi,

 

Thanks for your patience. This is to kindly inform you that currently, we don't provide paths to static dispatcher header files as part of cmake configuration files.

As a workaround, instead of using the full path, one could use ${IPP_ROOT_REL_PATH}/opt/ipp/tools/intel64/staticlib for IPP2021.10 and $ENV{IPPROOT}/tools/intel64/staticlib for previous releases.

 

Could you please check and let us know the updates?

 

Best Regards,
Shanmukh.SS

View solution in original post

0 Kudos
13 Replies
ShanmukhS_Intel
Moderator
4,638 Views

Hi Pascal,


Thanks for posting in Intel Communities.


Could you please get back to us with the OS details and IPP version being used by you? Could you please get back to us with a sample reproducer? It helps us reproduce the issue at our end and guide you in resolving the same.


Best Regards,

Shanmukh.SS


0 Kudos
wombat
Beginner
4,620 Views

OS is Windows 10.

IPP version is 2021.9.0.

A sample would look like below.

 

// main.cpp
#include <ipp_e9.h> // fails here; OK if commented
#include <ipp.h>

int main() { return 0; }
// CMakeLists.txt
cmake_minimum_required(VERSION 3.21)
project(foo)
add_executable(foo main.cpp)
set(IPP_SHARED OFF)
find_package(IPP REQUIRED)
target_link_libraries(foo PRIVATE ${IPP_LIBRARIES})

 

0 Kudos
ShanmukhS_Intel
Moderator
4,575 Views

Hi,


Thanks for sharing the details.


We are looking into your issue internally. We will get back to you soon with an update.


Best Regards,

Shanmukh.SS


0 Kudos
ShanmukhS_Intel
Moderator
4,547 Views

Hi Pascal,


Could you please try adding the line to your CMakeLists.txt as mentioned below and run make and let us know if the issue persists?


include_directories(<add the include directory which contains the requires header file>)


For Ex: include_directories(/opt/intel/oneapi/ipp/2021.9.0/tools/intel64/staticlib)


Best Regards,

Shanmukh.SS



0 Kudos
wombat
Beginner
4,458 Views

I could, however how do I find the correct path from within CMake, so that the solution is portable?

0 Kudos
ShanmukhS_Intel
Moderator
4,503 Views

Hi Pascal,


A gentle reminder:

Has the information provided helped? Could you please let us know if the issue persists?


Best Regards,

Shanmukh.SS


0 Kudos
ShanmukhS_Intel
Moderator
4,419 Views

Hi Pascal,


In your CMakeLists.txt file, use find_package() to locate Intel IPP. You are expected to specify the desired IPP version and component(s) you want to use or you could use find_library() to locate the static library: After finding IPP, you can use find_library() to locate the static library you want to link.


Could you please try these and let us know if you need any help?


Best regards,

Shanmukh.SS


0 Kudos
wombat
Beginner
4,387 Views

I don't understand, the static library is already found by `find_package`.

 

Can you provide a working example based on the code you asked me?

0 Kudos
ShanmukhS_Intel
Moderator
4,290 Views

Hi Pascal,

 

Could you please elaborate on your issue? In your CMakeLists.txt file, you could use find_package() to locate Intel IPP. 

 

A Sample CMake:

cmake_minimum_required(VERSION 3.16.3)
include_directories(/opt/intel/oneapi/ipp/2021.9.0/tools/intel64/staticlib)
project(foo)
add_executable(foo main.cpp)
set(IPP_SHARED OFF)
find_package(IPP REQUIRED)
target_link_libraries(foo PRIVATE ${IPP_LIBRARIES})

 

Intel® Integrated Performance Primitives (Intel® IPP) installs in the subdirectory referred to as <ipp directory> inside <install_dir>. By default, the <install_dir> is: 

  • admin:/opt/intel/oneapi
  • user:~/intel/oneapi

 

You could refer to the Linux OS section under the below link to find Intel IPP and more details on your system.

 

https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-oneapi/2022-2/finding-intel-ipp-on-your-system.html#LINUX

 

find_package(Package Name)

Package Name: Here you need to input the name of the package you want to find. Make sure it corresponds to a CMake module or script that provides the package's configuration information.

 

 

Best Regards,

Shanmukh.SS

 

0 Kudos
wombat
Beginner
4,208 Views

Hello,

 

You already proposed to hardcode the path to the library (here), but as I answered (here), I am looking for a portable solution, so that anybody could configure and compile the project without having to know where IPP is installed on their system.

 

Is there a way to achieve that? Or are portable CMake projects using IPP restricted to dynamic dispatching? It seems to me, seeing you struggling with this as I am, that this possibility has not been taken into account by the maintainers of IPP's CMake configuration scripts.

0 Kudos
ShanmukhS_Intel
Moderator
4,095 Views

 

Hi,

 

Thanks for your patience. This is to kindly inform you that currently, we don't provide paths to static dispatcher header files as part of cmake configuration files.

As a workaround, instead of using the full path, one could use ${IPP_ROOT_REL_PATH}/opt/ipp/tools/intel64/staticlib for IPP2021.10 and $ENV{IPPROOT}/tools/intel64/staticlib for previous releases.

 

Could you please check and let us know the updates?

 

Best Regards,
Shanmukh.SS

0 Kudos
ShanmukhS_Intel
Moderator
3,991 Views

Hi,


A gentle reminder:

Has the information provided helped? Could you please let us know if you need any other information?


Best Regards,

Shanmukh.SS


0 Kudos
ShanmukhS_Intel
Moderator
3,950 Views

Hi,


Thanks for accepting our solution. If you have any other queries, please feel free to raise a new thread.


Best Regards,

Shanmukh.SS


0 Kudos
Reply