13.07.2015 Views

Intel(R) Math Kernel Library for Linux* OS User's Guide

Intel(R) Math Kernel Library for Linux* OS User's Guide

Intel(R) Math Kernel Library for Linux* OS User's Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6 <strong>Intel</strong>® <strong>Math</strong> <strong>Kernel</strong> <strong>Library</strong> User’s <strong>Guide</strong>Example 6-1Changing the Number of Threads (continued)CALL OMP_SET_NUM_THREADS(2);DO I=1,NDO J=1,NA(I,J) = I+JB(I,J) = I*jC(I,J) = 0.0END DOEND DOCALL DGEMM('N','N',N,N,N,ALPHA,A,N,B,N,BETA,C,N)print *,'Row A C'DO i=1,10write(*,'(I4,F20.8,F20.8)') I, A(1,I),C(1,I)END D<strong>OS</strong>TOPENDUsing Additional Threading Control<strong>Intel</strong> MKL provides optional threading controls, that is, the environment variables andservice functions that are independent of OpenMP. They behave similar to their OpenMPequivalents, but take precedence over them in the meaning that the MKL-specific threadingcontrols are inspected first. By using these controls along with OpenMP variables, you canthread the part of the application that does not call <strong>Intel</strong> MKL and the library independentlyfrom each other.These controls enable you to specify the number of threads <strong>for</strong> <strong>Intel</strong> MKL independently ofthe OpenMP settings. Although <strong>Intel</strong> MKL may actually use a different number of threadsfrom the number suggested, the controls will also enable you to instruct the library to tryusing the suggested number when the number used in the calling application isunavailable.NOTE. <strong>Intel</strong> MKL does not always have a choice on the number ofthreads <strong>for</strong> certain reasons, such as system resources.Use of the <strong>Intel</strong> MKL threading controls in your application is optional. If you do not usethem, the library will mainly behave the same way as <strong>Intel</strong> MKL 9.1 in what relates tothreading with the possible exception of a different default number of threads.6-8

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!