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

Unable to run/detect device due to missing environment variables.

ChoonHo
Beginner
3,370 Views

OS

Windows 10

IDE

Visual Studio 19

Compiler

Any compiler (tested with msvc, clang, or Intel(R) oneAPI DPC++ compiler)

Toolkit

oneAPI Base Toolkit version 2021.1-beta09

Problem

After building .exe or .dll that relies one oneAPI DPC++, execute the .exe or .dll without going through Visual Studio "Intel(R) oneAPI DPC++ Compiler" platform toolset, (e.g., cmd).

After taking a look, the said toolset adds these few lines to the debugging environment.

OCL_ICD_FILENAMES=C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\..\windows\lib\emu\intelocl64_emu.dll;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\..\windows\lib\x64\intelocl64.dll;

AOCL_BOARD_PACKAGE_ROOT=C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\lib\oclfpga\board\intel_a10gx_pac

INTELFPGAOCLSDKROOT=C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\lib\oclfpga

INTEL_TARGET_ARCH=intel64

INTEL_TARGET_PLATFORM=windows

CMPLR_ROOT=C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\..\

PATH=C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\lib\oclfpga\windows64\bin;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\bin;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\redist\intel64_win\compiler;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\lib\oclfpga\bin;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\lib\oclfpga\windows64\bin;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\lib\oclfpga\host\windows64\bin;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\lib\oclfpga\board\intel_a10gx_pac\windows64\bin;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\..\lib\oclgpu;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\..\windows\bin\intel64;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\..\windows\redist\intel64_win\compiler;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\..\windows\bin;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\..\windows\lib;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\..\windows\ioc\bin;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\..\windows\lib\ocloc;C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1-beta09\windows\..\..\..\tbb\latest\redist\intel64\vc_mt;%PATH%

The program will not run properly without those environment variables, either cannot find dll, cannot detect OpenCL devices, or some native error, etc.

Shouldn't this be done by the installer?

0 Kudos
1 Solution
GouthamK_Intel
Moderator
3,308 Views

Hi,

We can see that from screenshots you have provided, you are able to successfully initialize oneAI environment.

Could you please try running your application executable after initializing the oneAPI environment and let us know if you face any errors?

Example:

We have tried running the vector-add-usm code which is available as part of oneAPI samples.

 

GouthamK_Intel_0-1603272770849.png

GouthamK_Intel_4-1603272895031.png

 

After building the vector-add-usm solution. Try running the executable inside <visualstudio/repos/projectname/x64/Debug/>vector-add-usm.exe

GouthamK_Intel_5-1603272970227.png

 

Regarding "sys_check.bat errors": We will get back to you after discussing it with the concerned internal team.

 

Thanks & Regards

Goutham

 

View solution in original post

0 Kudos
5 Replies
GouthamK_Intel
Moderator
3,341 Views

Hi,

You need to set up the oneAPI environment in the command prompt before running any oneAPI application.

  1. Please run the setvars.bat (located at oneAPI Installed directory) in cmd prompt to initialize the oneAPI environment.
  2. Run the application .exe file after initializing the oneAPI environment.

Please let us know if you face any further challenges.


Thanks & Regards

Goutham


0 Kudos
ChoonHo
Beginner
3,334 Views

It seems DPC++ dlls directory still wasn't added to PATH.


Extended information that may help,

setvars.bat ran successfully as follows,

Capture1.PNG

sys_check.bat wasn't successful,

Capture.PNG

Just to point out, I do have python installed and added to system PATH.

0 Kudos
GouthamK_Intel
Moderator
3,309 Views

Hi,

We can see that from screenshots you have provided, you are able to successfully initialize oneAI environment.

Could you please try running your application executable after initializing the oneAPI environment and let us know if you face any errors?

Example:

We have tried running the vector-add-usm code which is available as part of oneAPI samples.

 

GouthamK_Intel_0-1603272770849.png

GouthamK_Intel_4-1603272895031.png

 

After building the vector-add-usm solution. Try running the executable inside <visualstudio/repos/projectname/x64/Debug/>vector-add-usm.exe

GouthamK_Intel_5-1603272970227.png

 

Regarding "sys_check.bat errors": We will get back to you after discussing it with the concerned internal team.

 

Thanks & Regards

Goutham

 

0 Kudos
ChoonHo
Beginner
3,297 Views

Hey Goutham,

It seems what you did works, screenshot for reference (also works on my own application (dll)).

Capture.PNG

However, is there any plans in the future (e.g., on a stable release) to permanently change the environment variable during installation (like setx instead of set), instead of having to run setvars.bat every time?

0 Kudos
GouthamK_Intel
Moderator
3,287 Views

Hi,

Glad to know that your issue has been resolved!


Regarding: "is there any plans in the future (e.g., on a stable release) to permanently change the environment variable during installation (like setx instead of set), instead of having to run setvars.bat every time?"

Thanks for your feedback, we will consider this, and we will forward your feedback to the concerned engineering team.


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