Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*
605 Discussions

OneAPI Way to Check the Number of CPU cores/threads in use?

bxbxf
New Contributor I
1,199 Views

 I was wondering if there is a way, when I run a sycl program with a cpu_selector to get if I'm using it as single core or multi core ? 

 

Using sycl::info::device::max_compute_units. Here's a minimal example:

#include <CL/sycl.hpp>
#include <iostream>

int main(){
  sycl::device d = sycl::cpu_selector().select_device();
  std::cout << d.get_info<sycl::info::device::max_compute_units>() << std::endl;
}

On my machine (which has 8 physical cores & 16 hardware threads), this returns 16. Which as the function name suggests this is max value.

 

So how could I know if my application is running al those 16 threads or 4 threads ? Maybe 2 cores ? 

0 Kudos
3 Replies
VaishnaviV_Intel
Moderator
1,124 Views

Hi,


Thanks for posting on Intel communities.

You can use the Hotspots Views in Intel® VTune™ Profiler tool to gather information about the number of cores, number of threads, and determine whether your application is utilizing a single core or multiple cores.

Please refer to the below link for further details,

https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/2023-0/hotspots-view.html

If you still face any issues, please let us know.

 

Thanks & Regards,

Vankudothu Vaishnavi.


0 Kudos
VaishnaviV_Intel
Moderator
1,057 Views

Hi,


We have not heard back from you.

Has the information provided above helped? If yes, could you please confirm whether we can close this thread from our end?


Thanks & Regards,

Vankudothu Vaishnavi.


0 Kudos
VaishnaviV_Intel
Moderator
1,003 Views

Hi,


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 & Regards,

Vankudothu Vaishnavi.


0 Kudos
Reply