Intel® oneAPI Base Toolkit
Support for the core tools and libraries within the base toolkit that are used to build and deploy high-performance data-centric applications.
419 Discussions

vector-add example throws exception: Native API failed. Native API returns: -15 (CL_COMPILE_PROGRAM_

Nagy-Egri__Mate_Fere
New Contributor I
2,781 Views

I'm using Windows 10 2004 (64-bit) with MSVC (19.27.29111 for x64) alongside dpcpp (2021.1 (2020.8.0.0827)) trying to compile the vector-add sample to run on the CPU device of the Intel OpenCL CPU runtime (18.1.016). I got only the Visual C++ Build Tools installed, not the IDE.

My problem is, that:

1. docs say that "Open a command window." and invoke setvars.bat. Having done that, it fails to find the Visual C++ Build Tools, it doesn't matter if I set VS2019INSTALLDIR to either C:\Kellekek\Microsoft\VisualStudio or C:\Kellekek\Microsoft\VisualStudio\2019\BuildTools (the latter is where it's actually installed). Invoking the script from a prompt already having invoked vcvarsall.bat works fine.

2. Moving along, I got oneapi-cli.exe to create the vector-add sample folder where I could build using the NMake makefiles if I added the path to all the libs needed as LDFLAGS = /link /LIBPATH:C:\Kellekek\Intel\oneAPI\compiler\2021.1-beta09\windows\lib /LIBPATH:C:\Kellekek\Intel\oneAPI\compiler\2021.1-beta09\windows\compiler\lib\intel64_win. I also had to add C:\Kellekek\Intel\oneAPI\compiler\2021.1-beta09\windows\redist\intel64_win\compiler and C:\Kellekek\Intel\oneAPI\compiler\2021.1-beta09\windows\bin to the PATH so the resulting executable finds sycl.dll and all the other DLLs it needed. (The MSBuild project compiled without hiccups.)

3. Having compiled the example, I tried running it, but it returns the same error:

An exception is caught for vector add.
Native API failed. Native API returns: -15 (CL_COMPILE_PROGRAM_FAILURE) -15 (CL_COMPILE_PROGRAM_FAILURE)

The latter part only gets printed because I added std::cerr << e.what() << std::endl; to the catch block after the kernel invocation before std::terminate(); This happens both when I change the device selector to cpu_selector and host_selector too. I have used the CPU device before with ComputeCpp many times before and it worked, but it seems to fail driving the sample code from the oneAPI SDK.

Am I missing something?

0 Kudos
1 Solution
Nagy-Egri__Mate_Fere
New Contributor I
2,666 Views

Thank you @GouthamK_Intel for the reply (and apologies for delay on my end). setvars.bat is installed elsewhere on my system.

 

C:\Users\mnagy>dir "C:\Program Files (x86)\Intel\oneAPI"
Volume in drive C has no label.
Volume Serial Number is C047-66C7

Directory of C:\Program Files (x86)\Intel\oneAPI

2020. 10. 01. 17:31 <DIR> .
2020. 10. 01. 17:31 <DIR> ..
2020. 10. 01. 17:31 <DIR> Installer
0 File(s) 0 bytes
3 Dir(s) 9 685 856 256 bytes free

 

Aside from that, if I tried invoking the setvars script the way you mentioned, it failed.

 

C:\Users\mnagy>C:\Kellekek\Intel\oneAPI\setvars.bat vs2019 intel64
::  initializing oneAPI environment  ::
:  compiler -- latest
The syntax of the command is incorrect.

 

 Having looked inside the batch file it seems to look for VS2017/VS2019 installs based on env vars which are set in my system, but do note that it's only the Build Tools that got installed (I'm using VS Code) and not the full blown IDE.

 

C:\Kellekek\Intel\oneAPI\compiler\latest\env>dir C:\Kellekek\Microsoft\VisualStudio\2019\BuildTools
 Volume in drive C has no label.
 Volume Serial Number is C047-66C7

 Directory of C:\Kellekek\Microsoft\VisualStudio\2019\BuildTools

2020. 10. 06.  09:49    <DIR>          .
2020. 10. 06.  09:49    <DIR>          ..
2020. 10. 06.  09:49               526 asan_blacklist.txt
2020. 10. 06.  09:49           452 488 clang_rt.asan_dynamic-i386.dll
2020. 09. 21.  16:15    <DIR>          Common7
2020. 10. 06.  09:49    <DIR>          CoreCon
2020. 09. 21.  16:08    <DIR>          DIA SDK
2020. 10. 06.  09:49    <DIR>          ImportProjects
2020. 10. 06.  09:49    <DIR>          Licenses
2020. 06. 09.  18:54    <DIR>          MSBuild
2020. 10. 06.  09:49    <DIR>          SDK
2020. 10. 06.  09:49    <DIR>          Team Tools
2020. 09. 21.  16:16    <DIR>          VB
2020. 10. 06.  09:49    <DIR>          VC
2020. 10. 06.  09:49    <DIR>          VC#
2020. 10. 06.  09:49    <DIR>          Xml
               2 File(s)        453 014 bytes
              14 Dir(s)   9 687 486 464 bytes free

 

 I did note however that setvars.bat is sensitive to being invoked in VS dev prompts and takes shortcuts in those cases. I tried that and indeed it did the trick.

 

C:\Users\mnagy\Source\vector-add>C:\Kellekek\Microsoft\VisualStudio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.7.5
** Copyright (c) 2020 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

C:\Users\mnagy\Source\vector-add>C:\Kellekek\Intel\oneAPI\setvars.bat vs2019
::  initializing oneAPI environment  ::
:  compiler -- latest
:  dev-utilities -- latest
:  tbb -- latest
::  oneAPI environment initialized  ::

C:\Users\mnagy\Source\vector-add>.\vector-add-buffers.exe
Running on device: AMD Ryzen 7 1700 Eight-Core Processor
Vector size: 10000
[0]: 0 + 0 = 0
[1]: 1 + 1 = 2
[2]: 2 + 2 = 4
...
[9999]: 9999 + 9999 = 19998
Vector add successfully completed on device.

 

 These may be useful for people favoring bare minimum installs (and CI images) that wish to leverage oneAPI.

View solution in original post

0 Kudos
6 Replies
GouthamK_Intel
Moderator
2,753 Views

Hi,

Thanks for reaching out to us!

As per the DPC++ system requirements, you need to have Microsoft Visual Studio with "Desktop development with C++" workload installed"


Please find the below link for more details about DPC++ system requirements.

https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements-beta.html


However, we will get back to you with more information.


Have a Good day!


Thanks & Regards

Goutham


0 Kudos
GouthamK_Intel
Moderator
2,723 Views

Hi,

Could you please try the following steps and let us know the outcome of it. So that we can get more details about the issue which you are facing.

1.     Try C++ HelloWorld program to make sure the necessary C++ headers/runtimes are there in your system environment.

2.     Create an intel64 environment and try to run the dpcpp vector-add application again:

  • Start > search for "Intel oneAPI command prompt for Microsoft Visual Studio 2019"

GouthamK_Intel_6-1602245724744.png

  • Right-click on the application > Open File Location
 

GouthamK_Intel_11-1602246059337.png

 

  • Right-click on the application > Properties > Shortcut > Add intel64 at the end of the target field.

GouthamK_Intel_13-1602246161438.png

  • example: C:\Windows\System32\cmd.exe /E:ON /K ""C:\Program Files (x86)\Intel\oneAPI\setvars.bat" vs2019 intel64"
  • Run the vector-add sample application.

Please provide the screenshots/error logs if applicable.

 

Thanks & Regards

Goutham

Nagy-Egri__Mate_Fere
New Contributor I
2,667 Views

Thank you @GouthamK_Intel for the reply (and apologies for delay on my end). setvars.bat is installed elsewhere on my system.

 

C:\Users\mnagy>dir "C:\Program Files (x86)\Intel\oneAPI"
Volume in drive C has no label.
Volume Serial Number is C047-66C7

Directory of C:\Program Files (x86)\Intel\oneAPI

2020. 10. 01. 17:31 <DIR> .
2020. 10. 01. 17:31 <DIR> ..
2020. 10. 01. 17:31 <DIR> Installer
0 File(s) 0 bytes
3 Dir(s) 9 685 856 256 bytes free

 

Aside from that, if I tried invoking the setvars script the way you mentioned, it failed.

 

C:\Users\mnagy>C:\Kellekek\Intel\oneAPI\setvars.bat vs2019 intel64
::  initializing oneAPI environment  ::
:  compiler -- latest
The syntax of the command is incorrect.

 

 Having looked inside the batch file it seems to look for VS2017/VS2019 installs based on env vars which are set in my system, but do note that it's only the Build Tools that got installed (I'm using VS Code) and not the full blown IDE.

 

C:\Kellekek\Intel\oneAPI\compiler\latest\env>dir C:\Kellekek\Microsoft\VisualStudio\2019\BuildTools
 Volume in drive C has no label.
 Volume Serial Number is C047-66C7

 Directory of C:\Kellekek\Microsoft\VisualStudio\2019\BuildTools

2020. 10. 06.  09:49    <DIR>          .
2020. 10. 06.  09:49    <DIR>          ..
2020. 10. 06.  09:49               526 asan_blacklist.txt
2020. 10. 06.  09:49           452 488 clang_rt.asan_dynamic-i386.dll
2020. 09. 21.  16:15    <DIR>          Common7
2020. 10. 06.  09:49    <DIR>          CoreCon
2020. 09. 21.  16:08    <DIR>          DIA SDK
2020. 10. 06.  09:49    <DIR>          ImportProjects
2020. 10. 06.  09:49    <DIR>          Licenses
2020. 06. 09.  18:54    <DIR>          MSBuild
2020. 10. 06.  09:49    <DIR>          SDK
2020. 10. 06.  09:49    <DIR>          Team Tools
2020. 09. 21.  16:16    <DIR>          VB
2020. 10. 06.  09:49    <DIR>          VC
2020. 10. 06.  09:49    <DIR>          VC#
2020. 10. 06.  09:49    <DIR>          Xml
               2 File(s)        453 014 bytes
              14 Dir(s)   9 687 486 464 bytes free

 

 I did note however that setvars.bat is sensitive to being invoked in VS dev prompts and takes shortcuts in those cases. I tried that and indeed it did the trick.

 

C:\Users\mnagy\Source\vector-add>C:\Kellekek\Microsoft\VisualStudio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.7.5
** Copyright (c) 2020 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

C:\Users\mnagy\Source\vector-add>C:\Kellekek\Intel\oneAPI\setvars.bat vs2019
::  initializing oneAPI environment  ::
:  compiler -- latest
:  dev-utilities -- latest
:  tbb -- latest
::  oneAPI environment initialized  ::

C:\Users\mnagy\Source\vector-add>.\vector-add-buffers.exe
Running on device: AMD Ryzen 7 1700 Eight-Core Processor
Vector size: 10000
[0]: 0 + 0 = 0
[1]: 1 + 1 = 2
[2]: 2 + 2 = 4
...
[9999]: 9999 + 9999 = 19998
Vector add successfully completed on device.

 

 These may be useful for people favoring bare minimum installs (and CI images) that wish to leverage oneAPI.

0 Kudos
GouthamK_Intel
Moderator
2,700 Views

Hi,

Could you please let us know the status of your issue?

If your issue persists, please provide the outputs for the steps as mentioned earlier.


Thanks & Regards

Goutham


0 Kudos
GouthamK_Intel
Moderator
2,673 Views

Hi,

Could you please let us know the status of your issue?

If your issue persists, please provide the outputs for the steps as mentioned earlier.

If resolved, let us know if we can close the thread.


Thanks & Regards

Goutham


0 Kudos
GouthamK_Intel
Moderator
2,657 Views

Hi,

Glad to know that your issue is resolved!

As this issue has been resolved, we will no longer respond to this thread. 

If you require any 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


0 Kudos
Reply