Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and GDB*
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
443 Discussions

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

shenuo
Employee
541 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
505 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

 


shenuo
Employee
487 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;
}

HemanthCH_Intel
Moderator
453 Views

Hi


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


Thanks & Regards,

Hemanth


HemanthCH_Intel
Moderator
407 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

 

shenuo
Employee
397 Views

Hi,

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

      now, It works correct!

 

HemanthCH_Intel
Moderator
383 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.


Reply