13.07.2015 Views

Intel(R) - Computational and Systems Biology at MIT

Intel(R) - Computational and Systems Biology at MIT

Intel(R) - Computational and Systems Biology at MIT

SHOW MORE
SHOW LESS

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

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

Managing Performance <strong>and</strong> Memory 6NOTE. The functions take precedence over the respective environmentvariables.In particular, if in your applic<strong>at</strong>ion, you want <strong>Intel</strong> MKL to use a givennumber of threads <strong>and</strong> do not want users of your applic<strong>at</strong>ion to changethis via environment variables, set this number of threads by a call tomkl_set_num_threads(), which will have full precedence over anyenvironment variables set.The example below illustr<strong>at</strong>es the use of the <strong>Intel</strong> MKL function mkl_set_num_threads()to mimic the <strong>Intel</strong> MKL 9.x default behavior, th<strong>at</strong> is, running on one thread.Example 6-2Setting the number of threads to one#include #include …mkl_set_num_threads ( 1 );The section further exp<strong>and</strong>s on the <strong>Intel</strong> MKL environment variables for threading control.See the <strong>Intel</strong> MKL Reference Manual for the detailed description of the threading controlfunctions, their parameters, calling syntax, <strong>and</strong> more code examples.MKL_DYNAMICThe value of MKL_DYNAMIC is by default set to TRUE, regardless of OMP_DYNAMIC, whosedefault value may be FALSE.MKL_DYNAMIC being TRUE means th<strong>at</strong> <strong>Intel</strong> MKL will always try to pick wh<strong>at</strong> it considers thebest number of threads, up to the maximum specified by the user. MKL_DYNAMIC beingFALSE means th<strong>at</strong> <strong>Intel</strong> MKL will not devi<strong>at</strong>e from the number of threads the userrequested, unless there are reasons why it has no choice.Notice th<strong>at</strong> setting MKL_DYNAMIC=FALSE does not ensure th<strong>at</strong> <strong>Intel</strong> MKL will use thenumber of threads th<strong>at</strong> you request. The library may examine the problem <strong>and</strong> pick adifferent number of threads than the value suggested. For example, if you <strong>at</strong>tempt to do asize 1 m<strong>at</strong>rix-m<strong>at</strong>rix multiply across 8 threads, the library may instead choose to use onlyone thread because it is impractical to use 8 threads in this event.6-9

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

Saved successfully!

Ooh no, something went wrong!