Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel ICX Compiler , Intel® DPC++ Compatibility Tool, and GDB*
581 Discussions

DPC++ static lib for another project still compiled by DPC++ compiler

shenuo
Employee
998 Views

Hi,

    I have 2 projects, both of them are compiled by DPC++ compiler, the first one contains a kernel function, and is compiled as a static lib(it is correct as when compiled as exe, it can run). the other only has a main function and  is compiled as a executable file which link the first one.(both of them use same main function)

    However, I got a runtime error when I run the second one. I find this error come from the submit function.

template <typename T> event submit(T CGF _CODELOCPARAM(&CodeLoc)) {
_CODELOCARG(&CodeLoc);

event Event;

.......//other no related code

{
Event = submit_impl(CGF, CodeLoc);
}

return Event;
}

where submit_impl return a runtime error at memory. 

My environment is DPC++ 2022 + vs2019 with  i7-10610U CPU and UHD 630 graphics.

so, could anyone tell me what I miss?

0 Kudos
6 Replies
HemanthCH_Intel
Moderator
962 Views

Hi,

 

Thank you for posting in Intel Communities.

 

Could you please share the sample reproducer code, so that we can reproduce the issue from our end?

 

Thanks & Regards,

Hemanth

 


0 Kudos
shenuo
Employee
944 Views

Hi,

   you can just use the default DPC++ project on visual studio (static lib) to replay the same result.

 

int main() {

IntArray Iarray1, Iarray2,Iarray3;
initialize_array(Iarray1);
vector_add(Iarray1,Iarray2,Iarray3);
return 0;
}

0 Kudos
HemanthCH_Intel
Moderator
910 Views

Hi


We have reported this issue to the concerned development team. They are looking into the issue.


Thanks & Regards,

Hemanth


0 Kudos
HemanthCH_Intel
Moderator
864 Views

Hi,

 

We can run the static library successfully by following the below steps:

 

1) Open Visual Studio and select the static DPC++ library project.

2) Create a dpcpp project as a static project.

3) Build the static project.

4) Create a new DPC++ project.

5) Create a new sample C++ file and copy the program2.cpp file as attached.

6) Open project properties>>Configuration properties>>VC++ Directories>> Library Directories(add the static library output path)

7) Open project properties>>configuration properties>>Linker>>General>>pass additional options to the device compiler>> (Add the static library output path)

 

please try using the above steps and let us know if you face any issues.

 

Thanks & Regards,

Hemanth

 

0 Kudos
shenuo
Employee
854 Views

Hi,

     Thanks, It seems the  DPC++ static lib configuration is not same as normal C++ static lib.

      now, It works correct!

 

0 Kudos
HemanthCH_Intel
Moderator
840 Views

Hi,


Glad to know 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,

Hemanth.


0 Kudos
Reply