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*
585 Discussions

Unable to pass parameter from one SYCL_EXTERNAL function to another through function call

student4
Beginner
788 Views

Hi,

I am trying to pass a parameter for one SYCL_EXTERNAL function to another SYCL_EXTERNAL function. But when I build the program it throws link errors.

Please refer to the sample code below


#include "sample.h"

extern SYCL_EXTERNAL void func1(int Nr, float ap, float const* La, int v, int *m, int * n, float *C,const td::vector<std::vector<std::vector<std::complex<float>>>> U,const std::vector<std::complex<float>> shat)
{

// func1 implementation

}

extern SYCL_EXTERNAL float func2(const std::complex<float>* y, const int Nr, float const* ap, float const* La, int constraint_bit_pos, int constraint_bit_value,int Nw )
{


std::vector<std::vector<std::vector<std::complex<float>>>> U;
std::vector<std::vector<float>> L;
std::vector<std::complex<float>> shat;
std::vector<std::complex<float>> d;
std::vector<int> m;
std::vector<int> n;
std::vector<float> C;

// func 2 implementation

func1(Nr, ap[v - 1], &La[(v - 1) * bps], v,&m[v-1],&n[v-1],&C[v-1],U,shat); // No link errors if U and shat are removed
return La[0];

}

sample::sample()
{

}


sample::~sample()
{

}

void sample::func3(std::complex<float>* y, const int Nr, float const* ap, float const* La, const std::vector<int>& sym_indices, float* Lp)
{

sycl::buffer sym_indicesBuff(sym_indices);
sycl::buffer best_symsBuff(best_syms);
sycl::buffer LpBuff(Lptemp);
// device selection
cl::sycl::ext::intel::fpga_emulator_selector d_selector;
// queue declaration
cl::sycl::queue q(d_selector);
q.submit([&](sycl::handler& h)
{
sycl::accessor sym_indicesAccess(sym_indicesBuff, h, sycl::read_only);
sycl::accessor best_symsAccess(best_symsBuff, h, sycl::read_only);
sycl::accessor LpAccessor(LpBuff, h, sycl::read_write);

h.parallel_for(sycl::range<2>(sym_indicesAccess.size(), 2), [=](auto idx)
{
int v = idx[0];
int b = idx[1];

// kernel codes
// calling SYCL_EXTERNAL function
dcmap= func2(y, Nr, ap, La, constraint_bit_pos, constraint_bit_value,nw);
});
});

}

 

Appreciate your help.

Thank you

0 Kudos
3 Replies
DitiD_Intel
Moderator
735 Views

Hi,

 

Thank you for posting in Intel Communities.

 

>> But when I build the program it throws link errors.

 

Could you please provide us with a screenshot or the log file of the exact error that you are getting?

 

>> Please refer to the sample code below.

 

Could you please provide us with the complete sample reproducer along with the steps that you have followed so that we can investigate more on your issue?

 

And also, please share the platform details, operating system, Intel compiler and oneAPI toolkit version that you are using.

 

>> // func 2 implementation

 

func1(Nr, ap[v - 1], &La[(v - 1) * bps], v,&m[v-1],&n[v-1],&C[v-1],U,shat); // No link errors if U and shat are removed.

 

Lastly, could you please elaborate more on the comment that you have added here? Upon removal of U and shat, were you able to compile and run the code successfully?

 

Thanks and Regards,

Ditipriya.

 

 

0 Kudos
DitiD_Intel
Moderator
688 Views

Hi,


We've not heard back from you. Can you please provide an update?


Thanks and Regards,

Ditipriya.



0 Kudos
DitiD_Intel
Moderator
667 Views

Hi,


We have not heard back from you. This thread will no longer be monitored by Intel. If you need further assistance, please post a new question.


Thanks & Regards,

Ditipriya.



0 Kudos
Reply