I am trying to do core isolation and core pinning using the following code on a Linux (ubuntu system)
When I compile the above program using icx , I am getting the following error. Not sure what to include for this compiler.
icx -g -fast test2.c
test2.c:16:5: error: call to undeclared function 'CPU_ZERO'; ISO C99 and later do not support implicit functio
n declarations [-Wimplicit-function-declaration]
test2.c:17:5: error: call to undeclared function 'CPU_SET'; ISO C99 and later do not support implicit function
CPU_SET(6, &mask); // core number can be according to your priority
test2.c:18:18: error: call to undeclared function 'sched_setaffinity'; ISO C99 and later do not support implic
it function declarations [-Wimplicit-function-declaration]
int result = sched_setaffinity(0, sizeof(mask), &mask);
test2.c:22:23: error: call to undeclared function 'CPU_ISSET'; ISO C99 and later do not support implicit funct
ion declarations [-Wimplicit-function-declaration]
printf("%d ", CPU_ISSET(i, &mask));
Thanks for posting in the Intel forums.
Could you please let us know the Intel oneAPI version you have been using?
Could you please try with the icpx compiler and let us know if you further have any issues?
For more details please refer the below link
Thanks And Regards,
Intel API version is
Intel(R) oneAPI DPC++/C++ Compiler 2022.2.1 (2022.2.1.20221020)
Thread model: posix
Configuration file: /opt/intel/oneapi/compiler/2022.2.1/linux/bin/icx.cfg
I have other problems if I use CPP compiler.
I was anyway able to get over the issue by using the additional flags: -Wall -D_GNU_SOURCE
I am not sure if this is the correct way of doing things.
_GNU_SOURCE needs to be defined before including header files like,
In the above code you mentioned _GNU_SOURCE is defined after including header files,
so kindly check by defining at the top to ressolve the issue
Or other way to enable _GNU_SOURCE is by using -D_GNU_SOURCE flag
Thanks And regards
We assume that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.
Thanks and Regards,