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.

7 <strong>Intel</strong>® M<strong>at</strong>h Kernel Library User’s GuideIn other cases where RTL dependencies might arise, the functions are delivered as sourcecode <strong>and</strong> it is the responsibility of the user to compile the code with wh<strong>at</strong>ever compileremployed.In particular, Fortran 90 modules result in the compiler-specific code gener<strong>at</strong>ion requiringRTL support, so, <strong>Intel</strong> MKL delivers these modules as source code.Mixed-language programming with <strong>Intel</strong>® MKLAppendix A lists the programming languages supported for each <strong>Intel</strong> MKL functiondomain. However, you can call <strong>Intel</strong> MKL routines from different language environments.This section explains how to do this using mixed-language programming.Calling LAPACK, BLAS, <strong>and</strong> CBLAS Routines from C LanguageEnvironmentsNot all <strong>Intel</strong> MKL function domains support both C <strong>and</strong> Fortran environments. To use <strong>Intel</strong>MKL Fortran-style functions in C/C++ environments, you should observe certainconventions, which are discussed for LAPACK <strong>and</strong> BLAS in the subsections below.LAPACKAs LAPACK routines are Fortran-style, when calling them from C-language programs, makesure th<strong>at</strong> you follow the Fortran-style calling conventions:• Pass variables by 'address' as opposed to pass by 'value'.Function calls is Example 7-1 <strong>and</strong> Example 7-2 illustr<strong>at</strong>e this.• Store your d<strong>at</strong>a Fortran-style, th<strong>at</strong> is, in column-major r<strong>at</strong>her than row-major order.With row-major order, adopted in C, the last array index changes most quickly <strong>and</strong> thefirst one changes most slowly when traversing the memory segment where the array isstored. With Fortran-style column-major order, the last index changes most slowlywhereas the first one changes most quickly (as illustr<strong>at</strong>ed by Figure 7-1 for a 2Darray).7-4

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

Saved successfully!

Ooh no, something went wrong!