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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Coding Tips 8This is another chapter whose contents discusses programming with <strong>Intel</strong>® M<strong>at</strong>h KernelLibrary (<strong>Intel</strong>® MKL). Whereas chapter 7 focuses on general language-specificprogramming options, this one presents coding tips th<strong>at</strong> may be helpful to meet certainspecific needs. Currently the only tip advising how to achieve numerical stability is given.You can find other coding tips, relevant to performance <strong>and</strong> memory management, inchapter 6.Aligning D<strong>at</strong>a for Numerical StabilityIf linear algebra routines (LAPACK, BLAS) are applied to inputs th<strong>at</strong> are bit-for-bit identicalbut the arrays are differently aligned or the comput<strong>at</strong>ions are performed either on differentpl<strong>at</strong>forms or with different numbers of threads, the outputs may not be bit-for-bit identical,though they will devi<strong>at</strong>e within the appropri<strong>at</strong>e error bounds. The <strong>Intel</strong> MKL version mayalso affect numerical stability of the output, as the routines may be implementeddifferently in different versions. With a given <strong>Intel</strong> MKL version, the outputs will bebit-for-bit identical provided all the following conditions are met:• the outputs are obtained on the same pl<strong>at</strong>form;• the inputs are bit-for-bit identical;• the input arrays are aligned identically <strong>at</strong> 16-byte boundaries.Unlike the first two conditions, which are under users' control, the alignment of arrays, bydefault, is not. For instance, arrays dynamically alloc<strong>at</strong>ed using malloc are aligned <strong>at</strong>8-byte boundaries, but not <strong>at</strong> 16-byte. If you need the numerically stable output, useMKL_malloc() to get the properly aligned workspace:8-1

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

Saved successfully!

Ooh no, something went wrong!