Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6974 Discussions

Problems with environment variables and using code examples

Bulanchuk__Pavlo
Beginner
447 Views

I was following installation guide up to environmental variable step:  https://software.intel.com/en-us/mkl-windows-developer-guide-setting-environment-variables. 

I entered
mklvars intel64
in the command shell. The script got executed fine and when I checked PATH variable in the command shell, I could see the added path. But if I check System properties -> environment variables, the Path variable remained unchanged. Also, when I restarted the command shell Path variable was the same as before running the script.

Also if I try to run a sample code in VS2017, the line 

#include "mkl.h"

gets underscored with a message "cannot open source file mkl.h"

Installation of mkl went without errors and all files that are mentioned in https://software.intel.com/en-us/mkl-windows-developer-guide-checking-your-installation are on their place.

If I understand correctly, this error is due to the absence of mkl.h in the path. 

Am I missing something? How can I correct it?

Thanks.

0 Kudos
2 Replies
Gennady_F_Intel
Moderator
447 Views

This bat script will set the MKL environments into the local working session. If you manually add these environments to the system properties -> environment variables then you will resolve this issues. 

In the case of Visual Studio – please refer to this article to set MKL environments in VS.

0 Kudos
JHoff18
Beginner
447 Views

For others who run into this problem, the solution is to source the script rather than execute it.

Do:

source /opt/intel/bin/compilervars.sh <arch>

Don't:

./opt/intel/bin/compilervars.sh <arch>

Executing a shell script executes it in a new shell process. The environment settings are lost when that process terminates. Sourcing it executes it in the current process.

0 Kudos
Reply