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

how to set mkl's system variables in program?

Zhanghong_T_
Novice
724 Views

Hello all,

I am trying to use MKL's libraries which support 'openmp' technology. Now I can let the program make use of all cpus if I set the 'mkl_serial=no' from 'my computer->properities->advanced->environment variables->system variables->new->...'.

However, I wish this system variables can be changed/controlled by my program, so I use the following code:

err=system('set MKL_SERIAL=NO')

I found the return value err=0, but after the program runs, the actual cpu usage is not appears as what I expected, but act as what the variables set as the first method.

So, could any one tell me how should I do to achive what I expected?

Thanks,

Zhanghong Tang

0 Kudos
4 Replies
TimP
Honored Contributor III
724 Views
You would need to set OMP_NUM_THREADS, if you haven't done so.
0 Kudos
Zhanghong_T_
Novice
724 Views

Hi Tim,

Thank you very much for your help! Do you mean I should set it in the code? Could you tell me how to set it?

I have set the envrionment variable NUMBER_OF_PROCESSORS, should I set another envrionment variable OMP_NUM_THREADS?

Thanks,

Zhanghong Tang

0 Kudos
TimP
Honored Contributor III
724 Views
Certain versions of MKL did use NUMBER_OF_PROCESSORS, on Windows, in the absence of OMP_NUM_THREADS.
0 Kudos
Zhanghong_T_
Novice
724 Views

Hi all,

It seems that PARDISO also calls MKL's math library, it's parallel compution don't need to set mak's system variables, how could it realize this, or does it just call MKL's library in serial mode and then parallel in its code?

Thanks,

Zhanghong Tang

0 Kudos
Reply