Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.
1736 Discussions

How to pass nd_item<1> to h.single_task lambda function or any other methods?

Wei-Chih
Novice
477 Views

Hi support team

 

I am using oneapi devcloud fpga hardwares and other devices now.

 

In my code, if i want to modify lambda function from h.parallel_for to h.single_task beause i wanna run it on fpga hw.

If it can be modified to h.single_task, I need to use nd_item<1> class, but it seems h.single_task cannot pass parameter. So how can i modify it? i need to get the values of get_local_id(0), get_group(0) and  get_local_range(0)

 

fragments of my code:

 

h.parallel_for<class bude_kernel>(nd_range<1>(global, wgSize), [=](nd_item<1> item) {

const size_t lid = item.get_local_id(0);
const size_t gid = item.get_group(0);
const size_t lrange = item.get_local_range(0);

float etot[NUM_TD_PER_THREAD];
cl::sycl::float3 lpos[NUM_TD_PER_THREAD];
cl::sycl::float4 transform[NUM_TD_PER_THREAD][3];

size_t ix = gid * lrange * NUM_TD_PER_THREAD + lid;
ix = ix < nposes ? ix : nposes - NUM_TD_PER_THREAD;

.

.

.

.

0 Kudos
0 Replies
Reply