Intel® oneAPI Base Toolkit
Support for core tools and libraries to build and deploy high-performance data-centric applications
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
244 Discussions

Unrecognized option foffload-static-lib in Dpcpp

Tse__Amon
Beginner
352 Views

Hello Support Team,

I am trying OneAPI 2021.1 and trying putting device code into a static lib. I am on Win10 platform.

Intel(R) oneAPI DPC++ Compiler 2021.1 (2020.10.0.1113)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\PROGRA~2\Intel\oneAPI\compiler\latest\windows\bin

 

From the documentation, the switch I should use is foffload-static-lib. Below is the command line and output. However it failed saying the switch foffload-static-lib is not recognized and hence the static lib containing device code is not linked; then the whole linking process is failed because of the unresolved symbol.

 

prompt>dpcpp.exe /Fe"..\Debug\CMakeDpcpp.exe" CMakeDpcpp.dir\Debug\main.obj /Zi /WX- /MDd /nologo /link /machine:x64 ..\Debug\sequential.lib -foffload-static-lib=..\Debug\parallel.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib
LINK : warning LNK4044: unrecognized option '/foffload-static-lib=..\Debug\parallel.lib'; ignored
main-593307.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl mylib::IotaParallel::run(class std::array<int,10000> &,int)" (?run@IotaParallel@mylib@@UEAAXAEAV?$array@H$0CHBA@@std@@H@Z) referenced in function main
..\Debug\CMakeDpcpp.exe : fatal error LNK1120: 1 unresolved externals
dpcpp: error: linker command failed with exit code 1120 (use -v to see invocation)

 

Is there anything wrong?

Best Regards,

Amon

0 Kudos
4 Replies
Tse__Amon
Beginner
336 Views

I move the same source codes to Ubuntu Linux 18.04. dpcpp returns warning saying the switch foffload-static-lib is deprecated!

Then on Ubuntu, I directly the link static lib containing device code; the link process is completed successfully and the executable runs and executes successfully.

Then I switch back to Windows and try to link the static lib containing device code directly, the link process is completed successfully. However, the executable fails to run and returns runtime error. Below is the exception message captured from the thrown exception by the running executable:

prompt>.\CMakeDpcpp.exe
Running on device: Intel(R) Graphics Gen9
An exception is caught while computing on device: Native API failed. Native API returns: -30 (CL_INVALID_VALUE) -30 (CL_INVALID_VALUE)

Moreover, the executable on Windows is much smaller than the size of the static lib containing the device code.  I wonder the device code in the static lib is not moved into the output executable during linking. 

I believe the documentation (Developer Guide and Programming Guide are not consistent to the released software, and the behavior on Windows is weird. 

May Intel engineer make an investigation? Thanks.

GouthamK_Intel
Moderator
308 Views

Hi,

Could you please provide the source code and steps to reproduce the issue you are facing. So that it will help us investigate your issue.


Thanks

Goutham


GouthamK_Intel
Moderator
295 Views

Hi,

Reminder: Could you please provide the details as requested in the previous post?


Regards

Goutham


GouthamK_Intel
Moderator
259 Views

Hi,

As we have not heard back from you, we are considering that your issue has been resolved and we have answered all your queries. So we will no longer respond to this thread.

If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only 

Have a Good day!


Thanks & Regards

Goutham


Reply