<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.sharcnet.ca/help/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nickc</id>
		<title>Documentation - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://www.sharcnet.ca/help/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nickc"/>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php/Special:Contributions/Nickc"/>
		<updated>2026-05-23T19:45:50Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.25.2</generator>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6615</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6615"/>
				<updated>2013-05-28T22:04:15Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* Linking to MKL on Centos5 Clusters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
  &lt;br /&gt;
  !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
  !    This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
   &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
  &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
  &lt;br /&gt;
        subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
        implicit none&lt;br /&gt;
        integer            :: i, j, nRows, nCols&lt;br /&gt;
        double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
  &lt;br /&gt;
        do i=1,nRows&lt;br /&gt;
          do j=1,nCols&lt;br /&gt;
            print *,i,j,pMatrix(i,j)&lt;br /&gt;
          enddo&lt;br /&gt;
        enddo&lt;br /&gt;
  &lt;br /&gt;
        print *,&amp;quot; &amp;quot;&lt;br /&gt;
        return&lt;br /&gt;
        end&lt;br /&gt;
 &lt;br /&gt;
==== fortran zdotc  example====&lt;br /&gt;
Use following command to compile:&lt;br /&gt;
 $FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
where &lt;br /&gt;
 ! file name = fortran_zdotc.f90&lt;br /&gt;
 &lt;br /&gt;
       program fortran_zdotc&lt;br /&gt;
       implicit none&lt;br /&gt;
 &lt;br /&gt;
       integer, parameter :: NN=5&lt;br /&gt;
       integer :: n, inca, incb&lt;br /&gt;
       integer :: i&lt;br /&gt;
 &lt;br /&gt;
       DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC&lt;br /&gt;
       REAL*8 :: Di, Dn&lt;br /&gt;
 &lt;br /&gt;
       inca = 1&lt;br /&gt;
       incb = 1&lt;br /&gt;
 &lt;br /&gt;
       n  = NN&lt;br /&gt;
       Dn = DBLE(n)&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       DO i=0,n-1&lt;br /&gt;
         Di = i&lt;br /&gt;
         ZX(i) = CMPLX(Di,2.0D0*Di)&lt;br /&gt;
         ZY(i) = CMPLX(Dn-Di,2.0D0*Di)&lt;br /&gt;
         write(6,1001) ZX(i),ZY(i)&lt;br /&gt;
  1001   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)    (&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       END DO&lt;br /&gt;
 &lt;br /&gt;
       ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)&lt;br /&gt;
       ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)&lt;br /&gt;
 &lt;br /&gt;
  1002   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZX,ZY&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPXY&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZY,ZX&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPYX&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;Job completed successfully&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       end program fortran_zdotc&lt;br /&gt;
&lt;br /&gt;
==== c zdotc  example====&lt;br /&gt;
Use following command to compile: &lt;br /&gt;
  $CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
 /* file name = main_zdotc.c */&lt;br /&gt;
  &lt;br /&gt;
  /* The following example illustrates a call from a C program to the &lt;br /&gt;
   * complex BLAS Level 1 function zdotc(). This function computes &lt;br /&gt;
   * the dot product of two double-precision complex vectors.        &lt;br /&gt;
  &lt;br /&gt;
     DOT_PRODUCT = &amp;lt;ZX,ZY&amp;gt; = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }&lt;br /&gt;
                                    ------------- * ----&lt;br /&gt;
     Note that &amp;lt;ZX,ZY&amp;gt; = DCONJG(&amp;lt;ZY,ZX&amp;gt;)&lt;br /&gt;
    &lt;br /&gt;
     See: http://www2.math.umd.edu/~hking/Hermitian.pdf&lt;br /&gt;
  &lt;br /&gt;
   * In this example, the complex dot product is returned in the structure c. &lt;br /&gt;
   */&lt;br /&gt;
  &lt;br /&gt;
  #include &amp;quot;mkl.h&amp;quot;&lt;br /&gt;
  #define N 5 &lt;br /&gt;
  &lt;br /&gt;
  void zdotc();&lt;br /&gt;
  &lt;br /&gt;
  int main() {&lt;br /&gt;
    int n, inca = 1, incb = 1, i;&lt;br /&gt;
  &lt;br /&gt;
    int DEBUG=1;&lt;br /&gt;
  &lt;br /&gt;
  /*  typedef struct {...} MKL_Complex16;   defined in &amp;quot;mkl.h&amp;quot;    */&lt;br /&gt;
  &lt;br /&gt;
    MKL_Complex16 a[N], b[N], c, d;&lt;br /&gt;
    n = N;&lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
    for ( i = 0; i &amp;lt; n; i++ ){&lt;br /&gt;
      a[i].real = (double)i;&lt;br /&gt;
      a[i].imag = (double)i * 2.0;&lt;br /&gt;
  &lt;br /&gt;
      b[i].real = (double)(n - i);&lt;br /&gt;
      b[i].imag = (double)i * 3.0;&lt;br /&gt;
  &lt;br /&gt;
      printf(&amp;quot; ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n&amp;quot;,a[i].real,a[i].imag,b[i].real,b[i].imag);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    zdotc( &amp;amp;c, &amp;amp;n, a, &amp;amp;inca, b, &amp;amp;incb );&lt;br /&gt;
    zdotc( &amp;amp;d, &amp;amp;n, b, &amp;amp;incb, a, &amp;amp;inca ); &lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;The complex dot product a|b is: ( %6.2f, %6.2f) \n&amp;quot;, c.real, c.imag );&lt;br /&gt;
    printf(&amp;quot;The complex dot product b|a is: ( %6.2f, %6.2f) \n&amp;quot;, d.real, d.imag );&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;Job completed successfully\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General Notes===&lt;br /&gt;
====Linking to MKL on Centos5 Clusters====&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====COMPILING WITH MKL - USING ONLINE LINK ADVISOR====&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using The ILP64 Vs LP64 Variants Of MKL====&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
====Support for Third-Party Interfaces====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
==== FFTW Interface Support====&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Introduction to Using the MKL FFT====&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Intel MKL Examples====&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6614</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6614"/>
				<updated>2013-05-28T21:58:15Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* General Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
  &lt;br /&gt;
  !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
  !    This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
   &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
  &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
  &lt;br /&gt;
        subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
        implicit none&lt;br /&gt;
        integer            :: i, j, nRows, nCols&lt;br /&gt;
        double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
  &lt;br /&gt;
        do i=1,nRows&lt;br /&gt;
          do j=1,nCols&lt;br /&gt;
            print *,i,j,pMatrix(i,j)&lt;br /&gt;
          enddo&lt;br /&gt;
        enddo&lt;br /&gt;
  &lt;br /&gt;
        print *,&amp;quot; &amp;quot;&lt;br /&gt;
        return&lt;br /&gt;
        end&lt;br /&gt;
 &lt;br /&gt;
==== fortran zdotc  example====&lt;br /&gt;
Use following command to compile:&lt;br /&gt;
 $FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
where &lt;br /&gt;
 ! file name = fortran_zdotc.f90&lt;br /&gt;
 &lt;br /&gt;
       program fortran_zdotc&lt;br /&gt;
       implicit none&lt;br /&gt;
 &lt;br /&gt;
       integer, parameter :: NN=5&lt;br /&gt;
       integer :: n, inca, incb&lt;br /&gt;
       integer :: i&lt;br /&gt;
 &lt;br /&gt;
       DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC&lt;br /&gt;
       REAL*8 :: Di, Dn&lt;br /&gt;
 &lt;br /&gt;
       inca = 1&lt;br /&gt;
       incb = 1&lt;br /&gt;
 &lt;br /&gt;
       n  = NN&lt;br /&gt;
       Dn = DBLE(n)&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       DO i=0,n-1&lt;br /&gt;
         Di = i&lt;br /&gt;
         ZX(i) = CMPLX(Di,2.0D0*Di)&lt;br /&gt;
         ZY(i) = CMPLX(Dn-Di,2.0D0*Di)&lt;br /&gt;
         write(6,1001) ZX(i),ZY(i)&lt;br /&gt;
  1001   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)    (&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       END DO&lt;br /&gt;
 &lt;br /&gt;
       ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)&lt;br /&gt;
       ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)&lt;br /&gt;
 &lt;br /&gt;
  1002   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZX,ZY&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPXY&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZY,ZX&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPYX&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;Job completed successfully&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       end program fortran_zdotc&lt;br /&gt;
&lt;br /&gt;
==== c zdotc  example====&lt;br /&gt;
Use following command to compile: &lt;br /&gt;
  $CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
 /* file name = main_zdotc.c */&lt;br /&gt;
  &lt;br /&gt;
  /* The following example illustrates a call from a C program to the &lt;br /&gt;
   * complex BLAS Level 1 function zdotc(). This function computes &lt;br /&gt;
   * the dot product of two double-precision complex vectors.        &lt;br /&gt;
  &lt;br /&gt;
     DOT_PRODUCT = &amp;lt;ZX,ZY&amp;gt; = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }&lt;br /&gt;
                                    ------------- * ----&lt;br /&gt;
     Note that &amp;lt;ZX,ZY&amp;gt; = DCONJG(&amp;lt;ZY,ZX&amp;gt;)&lt;br /&gt;
    &lt;br /&gt;
     See: http://www2.math.umd.edu/~hking/Hermitian.pdf&lt;br /&gt;
  &lt;br /&gt;
   * In this example, the complex dot product is returned in the structure c. &lt;br /&gt;
   */&lt;br /&gt;
  &lt;br /&gt;
  #include &amp;quot;mkl.h&amp;quot;&lt;br /&gt;
  #define N 5 &lt;br /&gt;
  &lt;br /&gt;
  void zdotc();&lt;br /&gt;
  &lt;br /&gt;
  int main() {&lt;br /&gt;
    int n, inca = 1, incb = 1, i;&lt;br /&gt;
  &lt;br /&gt;
    int DEBUG=1;&lt;br /&gt;
  &lt;br /&gt;
  /*  typedef struct {...} MKL_Complex16;   defined in &amp;quot;mkl.h&amp;quot;    */&lt;br /&gt;
  &lt;br /&gt;
    MKL_Complex16 a[N], b[N], c, d;&lt;br /&gt;
    n = N;&lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
    for ( i = 0; i &amp;lt; n; i++ ){&lt;br /&gt;
      a[i].real = (double)i;&lt;br /&gt;
      a[i].imag = (double)i * 2.0;&lt;br /&gt;
  &lt;br /&gt;
      b[i].real = (double)(n - i);&lt;br /&gt;
      b[i].imag = (double)i * 3.0;&lt;br /&gt;
  &lt;br /&gt;
      printf(&amp;quot; ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n&amp;quot;,a[i].real,a[i].imag,b[i].real,b[i].imag);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    zdotc( &amp;amp;c, &amp;amp;n, a, &amp;amp;inca, b, &amp;amp;incb );&lt;br /&gt;
    zdotc( &amp;amp;d, &amp;amp;n, b, &amp;amp;incb, a, &amp;amp;inca ); &lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;The complex dot product a|b is: ( %6.2f, %6.2f) \n&amp;quot;, c.real, c.imag );&lt;br /&gt;
    printf(&amp;quot;The complex dot product b|a is: ( %6.2f, %6.2f) \n&amp;quot;, d.real, d.imag );&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;Job completed successfully\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General Notes===&lt;br /&gt;
====Linking to MKL on Centos5 Clusters====&lt;br /&gt;
text&lt;br /&gt;
====COMPILING WITH MKL - USING ONLINE LINK ADVISOR====&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using The ILP64 Vs LP64 Variants Of MKL====&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
====Support for Third-Party Interfaces====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
==== FFTW Interface Support====&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Introduction to Using the MKL FFT====&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Intel MKL Examples====&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6613</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6613"/>
				<updated>2013-05-28T21:53:06Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* SUMMARY EXAMPLE PROGRAMS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
  &lt;br /&gt;
  !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
  !    This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
   &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
  &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
  &lt;br /&gt;
        subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
        implicit none&lt;br /&gt;
        integer            :: i, j, nRows, nCols&lt;br /&gt;
        double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
  &lt;br /&gt;
        do i=1,nRows&lt;br /&gt;
          do j=1,nCols&lt;br /&gt;
            print *,i,j,pMatrix(i,j)&lt;br /&gt;
          enddo&lt;br /&gt;
        enddo&lt;br /&gt;
  &lt;br /&gt;
        print *,&amp;quot; &amp;quot;&lt;br /&gt;
        return&lt;br /&gt;
        end&lt;br /&gt;
 &lt;br /&gt;
==== fortran zdotc  example====&lt;br /&gt;
Use following command to compile:&lt;br /&gt;
 $FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
where &lt;br /&gt;
 ! file name = fortran_zdotc.f90&lt;br /&gt;
 &lt;br /&gt;
       program fortran_zdotc&lt;br /&gt;
       implicit none&lt;br /&gt;
 &lt;br /&gt;
       integer, parameter :: NN=5&lt;br /&gt;
       integer :: n, inca, incb&lt;br /&gt;
       integer :: i&lt;br /&gt;
 &lt;br /&gt;
       DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC&lt;br /&gt;
       REAL*8 :: Di, Dn&lt;br /&gt;
 &lt;br /&gt;
       inca = 1&lt;br /&gt;
       incb = 1&lt;br /&gt;
 &lt;br /&gt;
       n  = NN&lt;br /&gt;
       Dn = DBLE(n)&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       DO i=0,n-1&lt;br /&gt;
         Di = i&lt;br /&gt;
         ZX(i) = CMPLX(Di,2.0D0*Di)&lt;br /&gt;
         ZY(i) = CMPLX(Dn-Di,2.0D0*Di)&lt;br /&gt;
         write(6,1001) ZX(i),ZY(i)&lt;br /&gt;
  1001   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)    (&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       END DO&lt;br /&gt;
 &lt;br /&gt;
       ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)&lt;br /&gt;
       ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)&lt;br /&gt;
 &lt;br /&gt;
  1002   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZX,ZY&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPXY&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZY,ZX&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPYX&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;Job completed successfully&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       end program fortran_zdotc&lt;br /&gt;
&lt;br /&gt;
==== c zdotc  example====&lt;br /&gt;
Use following command to compile: &lt;br /&gt;
  $CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
 /* file name = main_zdotc.c */&lt;br /&gt;
  &lt;br /&gt;
  /* The following example illustrates a call from a C program to the &lt;br /&gt;
   * complex BLAS Level 1 function zdotc(). This function computes &lt;br /&gt;
   * the dot product of two double-precision complex vectors.        &lt;br /&gt;
  &lt;br /&gt;
     DOT_PRODUCT = &amp;lt;ZX,ZY&amp;gt; = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }&lt;br /&gt;
                                    ------------- * ----&lt;br /&gt;
     Note that &amp;lt;ZX,ZY&amp;gt; = DCONJG(&amp;lt;ZY,ZX&amp;gt;)&lt;br /&gt;
    &lt;br /&gt;
     See: http://www2.math.umd.edu/~hking/Hermitian.pdf&lt;br /&gt;
  &lt;br /&gt;
   * In this example, the complex dot product is returned in the structure c. &lt;br /&gt;
   */&lt;br /&gt;
  &lt;br /&gt;
  #include &amp;quot;mkl.h&amp;quot;&lt;br /&gt;
  #define N 5 &lt;br /&gt;
  &lt;br /&gt;
  void zdotc();&lt;br /&gt;
  &lt;br /&gt;
  int main() {&lt;br /&gt;
    int n, inca = 1, incb = 1, i;&lt;br /&gt;
  &lt;br /&gt;
    int DEBUG=1;&lt;br /&gt;
  &lt;br /&gt;
  /*  typedef struct {...} MKL_Complex16;   defined in &amp;quot;mkl.h&amp;quot;    */&lt;br /&gt;
  &lt;br /&gt;
    MKL_Complex16 a[N], b[N], c, d;&lt;br /&gt;
    n = N;&lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
    for ( i = 0; i &amp;lt; n; i++ ){&lt;br /&gt;
      a[i].real = (double)i;&lt;br /&gt;
      a[i].imag = (double)i * 2.0;&lt;br /&gt;
  &lt;br /&gt;
      b[i].real = (double)(n - i);&lt;br /&gt;
      b[i].imag = (double)i * 3.0;&lt;br /&gt;
  &lt;br /&gt;
      printf(&amp;quot; ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n&amp;quot;,a[i].real,a[i].imag,b[i].real,b[i].imag);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    zdotc( &amp;amp;c, &amp;amp;n, a, &amp;amp;inca, b, &amp;amp;incb );&lt;br /&gt;
    zdotc( &amp;amp;d, &amp;amp;n, b, &amp;amp;incb, a, &amp;amp;inca ); &lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;The complex dot product a|b is: ( %6.2f, %6.2f) \n&amp;quot;, c.real, c.imag );&lt;br /&gt;
    printf(&amp;quot;The complex dot product b|a is: ( %6.2f, %6.2f) \n&amp;quot;, d.real, d.imag );&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;Job completed successfully\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General Notes===&lt;br /&gt;
====COMPILING WITH MKL - USING ONLINE LINK ADVISOR====&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using The ILP64 Vs LP64 Variants Of MKL====&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
====Support for Third-Party Interfaces====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
==== FFTW Interface Support====&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Introduction to Using the MKL FFT====&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Intel MKL Examples====&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6612</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6612"/>
				<updated>2013-05-28T21:51:36Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* Introduction to Using the MKL FFT */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
  &lt;br /&gt;
  !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
  !    This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
   &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
  &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
  &lt;br /&gt;
        subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
        implicit none&lt;br /&gt;
        integer            :: i, j, nRows, nCols&lt;br /&gt;
        double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
  &lt;br /&gt;
        do i=1,nRows&lt;br /&gt;
          do j=1,nCols&lt;br /&gt;
            print *,i,j,pMatrix(i,j)&lt;br /&gt;
          enddo&lt;br /&gt;
        enddo&lt;br /&gt;
  &lt;br /&gt;
        print *,&amp;quot; &amp;quot;&lt;br /&gt;
        return&lt;br /&gt;
        end&lt;br /&gt;
 &lt;br /&gt;
==== fortran zdotc  example====&lt;br /&gt;
Use following command to compile:&lt;br /&gt;
 $FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
where &lt;br /&gt;
 ! file name = fortran_zdotc.f90&lt;br /&gt;
 &lt;br /&gt;
       program fortran_zdotc&lt;br /&gt;
       implicit none&lt;br /&gt;
 &lt;br /&gt;
       integer, parameter :: NN=5&lt;br /&gt;
       integer :: n, inca, incb&lt;br /&gt;
       integer :: i&lt;br /&gt;
 &lt;br /&gt;
       DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC&lt;br /&gt;
       REAL*8 :: Di, Dn&lt;br /&gt;
 &lt;br /&gt;
       inca = 1&lt;br /&gt;
       incb = 1&lt;br /&gt;
 &lt;br /&gt;
       n  = NN&lt;br /&gt;
       Dn = DBLE(n)&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       DO i=0,n-1&lt;br /&gt;
         Di = i&lt;br /&gt;
         ZX(i) = CMPLX(Di,2.0D0*Di)&lt;br /&gt;
         ZY(i) = CMPLX(Dn-Di,2.0D0*Di)&lt;br /&gt;
         write(6,1001) ZX(i),ZY(i)&lt;br /&gt;
  1001   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)    (&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       END DO&lt;br /&gt;
 &lt;br /&gt;
       ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)&lt;br /&gt;
       ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)&lt;br /&gt;
 &lt;br /&gt;
  1002   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZX,ZY&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPXY&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZY,ZX&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPYX&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;Job completed successfully&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       end program fortran_zdotc&lt;br /&gt;
&lt;br /&gt;
==== c zdotc  example====&lt;br /&gt;
Use following command to compile: &lt;br /&gt;
  $CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
 /* file name = main_zdotc.c */&lt;br /&gt;
  &lt;br /&gt;
  /* The following example illustrates a call from a C program to the &lt;br /&gt;
   * complex BLAS Level 1 function zdotc(). This function computes &lt;br /&gt;
   * the dot product of two double-precision complex vectors.        &lt;br /&gt;
  &lt;br /&gt;
     DOT_PRODUCT = &amp;lt;ZX,ZY&amp;gt; = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }&lt;br /&gt;
                                    ------------- * ----&lt;br /&gt;
     Note that &amp;lt;ZX,ZY&amp;gt; = DCONJG(&amp;lt;ZY,ZX&amp;gt;)&lt;br /&gt;
    &lt;br /&gt;
     See: http://www2.math.umd.edu/~hking/Hermitian.pdf&lt;br /&gt;
  &lt;br /&gt;
   * In this example, the complex dot product is returned in the structure c. &lt;br /&gt;
   */&lt;br /&gt;
  &lt;br /&gt;
  #include &amp;quot;mkl.h&amp;quot;&lt;br /&gt;
  #define N 5 &lt;br /&gt;
  &lt;br /&gt;
  void zdotc();&lt;br /&gt;
  &lt;br /&gt;
  int main() {&lt;br /&gt;
    int n, inca = 1, incb = 1, i;&lt;br /&gt;
  &lt;br /&gt;
    int DEBUG=1;&lt;br /&gt;
  &lt;br /&gt;
  /*  typedef struct {...} MKL_Complex16;   defined in &amp;quot;mkl.h&amp;quot;    */&lt;br /&gt;
  &lt;br /&gt;
    MKL_Complex16 a[N], b[N], c, d;&lt;br /&gt;
    n = N;&lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
    for ( i = 0; i &amp;lt; n; i++ ){&lt;br /&gt;
      a[i].real = (double)i;&lt;br /&gt;
      a[i].imag = (double)i * 2.0;&lt;br /&gt;
  &lt;br /&gt;
      b[i].real = (double)(n - i);&lt;br /&gt;
      b[i].imag = (double)i * 3.0;&lt;br /&gt;
  &lt;br /&gt;
      printf(&amp;quot; ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n&amp;quot;,a[i].real,a[i].imag,b[i].real,b[i].imag);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    zdotc( &amp;amp;c, &amp;amp;n, a, &amp;amp;inca, b, &amp;amp;incb );&lt;br /&gt;
    zdotc( &amp;amp;d, &amp;amp;n, b, &amp;amp;incb, a, &amp;amp;inca ); &lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;The complex dot product a|b is: ( %6.2f, %6.2f) \n&amp;quot;, c.real, c.imag );&lt;br /&gt;
    printf(&amp;quot;The complex dot product b|a is: ( %6.2f, %6.2f) \n&amp;quot;, d.real, d.imag );&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;Job completed successfully\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General Notes===&lt;br /&gt;
====COMPILING WITH MKL - USING ONLINE LINK ADVISOR====&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using The ILP64 Vs LP64 Variants Of MKL====&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
====Support for Third-Party Interfaces====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
==== FFTW Interface Support====&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Introduction to Using the MKL FFT====&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SUMMARY EXAMPLE PROGRAMS===&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6611</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6611"/>
				<updated>2013-05-28T21:51:07Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* FFTW Interface Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
  &lt;br /&gt;
  !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
  !    This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
   &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
  &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
  &lt;br /&gt;
        subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
        implicit none&lt;br /&gt;
        integer            :: i, j, nRows, nCols&lt;br /&gt;
        double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
  &lt;br /&gt;
        do i=1,nRows&lt;br /&gt;
          do j=1,nCols&lt;br /&gt;
            print *,i,j,pMatrix(i,j)&lt;br /&gt;
          enddo&lt;br /&gt;
        enddo&lt;br /&gt;
  &lt;br /&gt;
        print *,&amp;quot; &amp;quot;&lt;br /&gt;
        return&lt;br /&gt;
        end&lt;br /&gt;
 &lt;br /&gt;
==== fortran zdotc  example====&lt;br /&gt;
Use following command to compile:&lt;br /&gt;
 $FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
where &lt;br /&gt;
 ! file name = fortran_zdotc.f90&lt;br /&gt;
 &lt;br /&gt;
       program fortran_zdotc&lt;br /&gt;
       implicit none&lt;br /&gt;
 &lt;br /&gt;
       integer, parameter :: NN=5&lt;br /&gt;
       integer :: n, inca, incb&lt;br /&gt;
       integer :: i&lt;br /&gt;
 &lt;br /&gt;
       DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC&lt;br /&gt;
       REAL*8 :: Di, Dn&lt;br /&gt;
 &lt;br /&gt;
       inca = 1&lt;br /&gt;
       incb = 1&lt;br /&gt;
 &lt;br /&gt;
       n  = NN&lt;br /&gt;
       Dn = DBLE(n)&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       DO i=0,n-1&lt;br /&gt;
         Di = i&lt;br /&gt;
         ZX(i) = CMPLX(Di,2.0D0*Di)&lt;br /&gt;
         ZY(i) = CMPLX(Dn-Di,2.0D0*Di)&lt;br /&gt;
         write(6,1001) ZX(i),ZY(i)&lt;br /&gt;
  1001   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)    (&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       END DO&lt;br /&gt;
 &lt;br /&gt;
       ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)&lt;br /&gt;
       ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)&lt;br /&gt;
 &lt;br /&gt;
  1002   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZX,ZY&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPXY&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZY,ZX&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPYX&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;Job completed successfully&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       end program fortran_zdotc&lt;br /&gt;
&lt;br /&gt;
==== c zdotc  example====&lt;br /&gt;
Use following command to compile: &lt;br /&gt;
  $CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
 /* file name = main_zdotc.c */&lt;br /&gt;
  &lt;br /&gt;
  /* The following example illustrates a call from a C program to the &lt;br /&gt;
   * complex BLAS Level 1 function zdotc(). This function computes &lt;br /&gt;
   * the dot product of two double-precision complex vectors.        &lt;br /&gt;
  &lt;br /&gt;
     DOT_PRODUCT = &amp;lt;ZX,ZY&amp;gt; = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }&lt;br /&gt;
                                    ------------- * ----&lt;br /&gt;
     Note that &amp;lt;ZX,ZY&amp;gt; = DCONJG(&amp;lt;ZY,ZX&amp;gt;)&lt;br /&gt;
    &lt;br /&gt;
     See: http://www2.math.umd.edu/~hking/Hermitian.pdf&lt;br /&gt;
  &lt;br /&gt;
   * In this example, the complex dot product is returned in the structure c. &lt;br /&gt;
   */&lt;br /&gt;
  &lt;br /&gt;
  #include &amp;quot;mkl.h&amp;quot;&lt;br /&gt;
  #define N 5 &lt;br /&gt;
  &lt;br /&gt;
  void zdotc();&lt;br /&gt;
  &lt;br /&gt;
  int main() {&lt;br /&gt;
    int n, inca = 1, incb = 1, i;&lt;br /&gt;
  &lt;br /&gt;
    int DEBUG=1;&lt;br /&gt;
  &lt;br /&gt;
  /*  typedef struct {...} MKL_Complex16;   defined in &amp;quot;mkl.h&amp;quot;    */&lt;br /&gt;
  &lt;br /&gt;
    MKL_Complex16 a[N], b[N], c, d;&lt;br /&gt;
    n = N;&lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
    for ( i = 0; i &amp;lt; n; i++ ){&lt;br /&gt;
      a[i].real = (double)i;&lt;br /&gt;
      a[i].imag = (double)i * 2.0;&lt;br /&gt;
  &lt;br /&gt;
      b[i].real = (double)(n - i);&lt;br /&gt;
      b[i].imag = (double)i * 3.0;&lt;br /&gt;
  &lt;br /&gt;
      printf(&amp;quot; ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n&amp;quot;,a[i].real,a[i].imag,b[i].real,b[i].imag);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    zdotc( &amp;amp;c, &amp;amp;n, a, &amp;amp;inca, b, &amp;amp;incb );&lt;br /&gt;
    zdotc( &amp;amp;d, &amp;amp;n, b, &amp;amp;incb, a, &amp;amp;inca ); &lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;The complex dot product a|b is: ( %6.2f, %6.2f) \n&amp;quot;, c.real, c.imag );&lt;br /&gt;
    printf(&amp;quot;The complex dot product b|a is: ( %6.2f, %6.2f) \n&amp;quot;, d.real, d.imag );&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;Job completed successfully\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General Notes===&lt;br /&gt;
====COMPILING WITH MKL - USING ONLINE LINK ADVISOR====&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using The ILP64 Vs LP64 Variants Of MKL====&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
====Support for Third-Party Interfaces====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
==== FFTW Interface Support====&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Introduction to Using the MKL FFT===&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===SUMMARY EXAMPLE PROGRAMS===&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6610</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6610"/>
				<updated>2013-05-28T21:50:51Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* =Support for Third-Party Interfaces */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
  &lt;br /&gt;
  !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
  !    This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
   &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
  &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
  &lt;br /&gt;
        subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
        implicit none&lt;br /&gt;
        integer            :: i, j, nRows, nCols&lt;br /&gt;
        double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
  &lt;br /&gt;
        do i=1,nRows&lt;br /&gt;
          do j=1,nCols&lt;br /&gt;
            print *,i,j,pMatrix(i,j)&lt;br /&gt;
          enddo&lt;br /&gt;
        enddo&lt;br /&gt;
  &lt;br /&gt;
        print *,&amp;quot; &amp;quot;&lt;br /&gt;
        return&lt;br /&gt;
        end&lt;br /&gt;
 &lt;br /&gt;
==== fortran zdotc  example====&lt;br /&gt;
Use following command to compile:&lt;br /&gt;
 $FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
where &lt;br /&gt;
 ! file name = fortran_zdotc.f90&lt;br /&gt;
 &lt;br /&gt;
       program fortran_zdotc&lt;br /&gt;
       implicit none&lt;br /&gt;
 &lt;br /&gt;
       integer, parameter :: NN=5&lt;br /&gt;
       integer :: n, inca, incb&lt;br /&gt;
       integer :: i&lt;br /&gt;
 &lt;br /&gt;
       DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC&lt;br /&gt;
       REAL*8 :: Di, Dn&lt;br /&gt;
 &lt;br /&gt;
       inca = 1&lt;br /&gt;
       incb = 1&lt;br /&gt;
 &lt;br /&gt;
       n  = NN&lt;br /&gt;
       Dn = DBLE(n)&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       DO i=0,n-1&lt;br /&gt;
         Di = i&lt;br /&gt;
         ZX(i) = CMPLX(Di,2.0D0*Di)&lt;br /&gt;
         ZY(i) = CMPLX(Dn-Di,2.0D0*Di)&lt;br /&gt;
         write(6,1001) ZX(i),ZY(i)&lt;br /&gt;
  1001   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)    (&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       END DO&lt;br /&gt;
 &lt;br /&gt;
       ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)&lt;br /&gt;
       ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)&lt;br /&gt;
 &lt;br /&gt;
  1002   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZX,ZY&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPXY&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZY,ZX&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPYX&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;Job completed successfully&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       end program fortran_zdotc&lt;br /&gt;
&lt;br /&gt;
==== c zdotc  example====&lt;br /&gt;
Use following command to compile: &lt;br /&gt;
  $CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
 /* file name = main_zdotc.c */&lt;br /&gt;
  &lt;br /&gt;
  /* The following example illustrates a call from a C program to the &lt;br /&gt;
   * complex BLAS Level 1 function zdotc(). This function computes &lt;br /&gt;
   * the dot product of two double-precision complex vectors.        &lt;br /&gt;
  &lt;br /&gt;
     DOT_PRODUCT = &amp;lt;ZX,ZY&amp;gt; = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }&lt;br /&gt;
                                    ------------- * ----&lt;br /&gt;
     Note that &amp;lt;ZX,ZY&amp;gt; = DCONJG(&amp;lt;ZY,ZX&amp;gt;)&lt;br /&gt;
    &lt;br /&gt;
     See: http://www2.math.umd.edu/~hking/Hermitian.pdf&lt;br /&gt;
  &lt;br /&gt;
   * In this example, the complex dot product is returned in the structure c. &lt;br /&gt;
   */&lt;br /&gt;
  &lt;br /&gt;
  #include &amp;quot;mkl.h&amp;quot;&lt;br /&gt;
  #define N 5 &lt;br /&gt;
  &lt;br /&gt;
  void zdotc();&lt;br /&gt;
  &lt;br /&gt;
  int main() {&lt;br /&gt;
    int n, inca = 1, incb = 1, i;&lt;br /&gt;
  &lt;br /&gt;
    int DEBUG=1;&lt;br /&gt;
  &lt;br /&gt;
  /*  typedef struct {...} MKL_Complex16;   defined in &amp;quot;mkl.h&amp;quot;    */&lt;br /&gt;
  &lt;br /&gt;
    MKL_Complex16 a[N], b[N], c, d;&lt;br /&gt;
    n = N;&lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
    for ( i = 0; i &amp;lt; n; i++ ){&lt;br /&gt;
      a[i].real = (double)i;&lt;br /&gt;
      a[i].imag = (double)i * 2.0;&lt;br /&gt;
  &lt;br /&gt;
      b[i].real = (double)(n - i);&lt;br /&gt;
      b[i].imag = (double)i * 3.0;&lt;br /&gt;
  &lt;br /&gt;
      printf(&amp;quot; ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n&amp;quot;,a[i].real,a[i].imag,b[i].real,b[i].imag);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    zdotc( &amp;amp;c, &amp;amp;n, a, &amp;amp;inca, b, &amp;amp;incb );&lt;br /&gt;
    zdotc( &amp;amp;d, &amp;amp;n, b, &amp;amp;incb, a, &amp;amp;inca ); &lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;The complex dot product a|b is: ( %6.2f, %6.2f) \n&amp;quot;, c.real, c.imag );&lt;br /&gt;
    printf(&amp;quot;The complex dot product b|a is: ( %6.2f, %6.2f) \n&amp;quot;, d.real, d.imag );&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;Job completed successfully\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General Notes===&lt;br /&gt;
====COMPILING WITH MKL - USING ONLINE LINK ADVISOR====&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using The ILP64 Vs LP64 Variants Of MKL====&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
====Support for Third-Party Interfaces====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
=== FFTW Interface Support===&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Introduction to Using the MKL FFT===&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===SUMMARY EXAMPLE PROGRAMS===&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6609</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6609"/>
				<updated>2013-05-28T21:50:22Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* Support for Third-Party Interfaces */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
  &lt;br /&gt;
  !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
  !    This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
   &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
  &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
  &lt;br /&gt;
        subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
        implicit none&lt;br /&gt;
        integer            :: i, j, nRows, nCols&lt;br /&gt;
        double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
  &lt;br /&gt;
        do i=1,nRows&lt;br /&gt;
          do j=1,nCols&lt;br /&gt;
            print *,i,j,pMatrix(i,j)&lt;br /&gt;
          enddo&lt;br /&gt;
        enddo&lt;br /&gt;
  &lt;br /&gt;
        print *,&amp;quot; &amp;quot;&lt;br /&gt;
        return&lt;br /&gt;
        end&lt;br /&gt;
 &lt;br /&gt;
==== fortran zdotc  example====&lt;br /&gt;
Use following command to compile:&lt;br /&gt;
 $FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
where &lt;br /&gt;
 ! file name = fortran_zdotc.f90&lt;br /&gt;
 &lt;br /&gt;
       program fortran_zdotc&lt;br /&gt;
       implicit none&lt;br /&gt;
 &lt;br /&gt;
       integer, parameter :: NN=5&lt;br /&gt;
       integer :: n, inca, incb&lt;br /&gt;
       integer :: i&lt;br /&gt;
 &lt;br /&gt;
       DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC&lt;br /&gt;
       REAL*8 :: Di, Dn&lt;br /&gt;
 &lt;br /&gt;
       inca = 1&lt;br /&gt;
       incb = 1&lt;br /&gt;
 &lt;br /&gt;
       n  = NN&lt;br /&gt;
       Dn = DBLE(n)&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       DO i=0,n-1&lt;br /&gt;
         Di = i&lt;br /&gt;
         ZX(i) = CMPLX(Di,2.0D0*Di)&lt;br /&gt;
         ZY(i) = CMPLX(Dn-Di,2.0D0*Di)&lt;br /&gt;
         write(6,1001) ZX(i),ZY(i)&lt;br /&gt;
  1001   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)    (&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       END DO&lt;br /&gt;
 &lt;br /&gt;
       ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)&lt;br /&gt;
       ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)&lt;br /&gt;
 &lt;br /&gt;
  1002   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZX,ZY&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPXY&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZY,ZX&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPYX&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;Job completed successfully&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       end program fortran_zdotc&lt;br /&gt;
&lt;br /&gt;
==== c zdotc  example====&lt;br /&gt;
Use following command to compile: &lt;br /&gt;
  $CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
 /* file name = main_zdotc.c */&lt;br /&gt;
  &lt;br /&gt;
  /* The following example illustrates a call from a C program to the &lt;br /&gt;
   * complex BLAS Level 1 function zdotc(). This function computes &lt;br /&gt;
   * the dot product of two double-precision complex vectors.        &lt;br /&gt;
  &lt;br /&gt;
     DOT_PRODUCT = &amp;lt;ZX,ZY&amp;gt; = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }&lt;br /&gt;
                                    ------------- * ----&lt;br /&gt;
     Note that &amp;lt;ZX,ZY&amp;gt; = DCONJG(&amp;lt;ZY,ZX&amp;gt;)&lt;br /&gt;
    &lt;br /&gt;
     See: http://www2.math.umd.edu/~hking/Hermitian.pdf&lt;br /&gt;
  &lt;br /&gt;
   * In this example, the complex dot product is returned in the structure c. &lt;br /&gt;
   */&lt;br /&gt;
  &lt;br /&gt;
  #include &amp;quot;mkl.h&amp;quot;&lt;br /&gt;
  #define N 5 &lt;br /&gt;
  &lt;br /&gt;
  void zdotc();&lt;br /&gt;
  &lt;br /&gt;
  int main() {&lt;br /&gt;
    int n, inca = 1, incb = 1, i;&lt;br /&gt;
  &lt;br /&gt;
    int DEBUG=1;&lt;br /&gt;
  &lt;br /&gt;
  /*  typedef struct {...} MKL_Complex16;   defined in &amp;quot;mkl.h&amp;quot;    */&lt;br /&gt;
  &lt;br /&gt;
    MKL_Complex16 a[N], b[N], c, d;&lt;br /&gt;
    n = N;&lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
    for ( i = 0; i &amp;lt; n; i++ ){&lt;br /&gt;
      a[i].real = (double)i;&lt;br /&gt;
      a[i].imag = (double)i * 2.0;&lt;br /&gt;
  &lt;br /&gt;
      b[i].real = (double)(n - i);&lt;br /&gt;
      b[i].imag = (double)i * 3.0;&lt;br /&gt;
  &lt;br /&gt;
      printf(&amp;quot; ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n&amp;quot;,a[i].real,a[i].imag,b[i].real,b[i].imag);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    zdotc( &amp;amp;c, &amp;amp;n, a, &amp;amp;inca, b, &amp;amp;incb );&lt;br /&gt;
    zdotc( &amp;amp;d, &amp;amp;n, b, &amp;amp;incb, a, &amp;amp;inca ); &lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;The complex dot product a|b is: ( %6.2f, %6.2f) \n&amp;quot;, c.real, c.imag );&lt;br /&gt;
    printf(&amp;quot;The complex dot product b|a is: ( %6.2f, %6.2f) \n&amp;quot;, d.real, d.imag );&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;Job completed successfully\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General Notes===&lt;br /&gt;
====COMPILING WITH MKL - USING ONLINE LINK ADVISOR====&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using The ILP64 Vs LP64 Variants Of MKL====&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
====Support for Third-Party Interfaces===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
=== FFTW Interface Support===&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Introduction to Using the MKL FFT===&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===SUMMARY EXAMPLE PROGRAMS===&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6608</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6608"/>
				<updated>2013-05-28T21:49:56Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* Note About Using The ILP64 Vs LP64 Variants Of MKL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
  &lt;br /&gt;
  !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
  !    This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
   &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
  &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
  &lt;br /&gt;
        subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
        implicit none&lt;br /&gt;
        integer            :: i, j, nRows, nCols&lt;br /&gt;
        double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
  &lt;br /&gt;
        do i=1,nRows&lt;br /&gt;
          do j=1,nCols&lt;br /&gt;
            print *,i,j,pMatrix(i,j)&lt;br /&gt;
          enddo&lt;br /&gt;
        enddo&lt;br /&gt;
  &lt;br /&gt;
        print *,&amp;quot; &amp;quot;&lt;br /&gt;
        return&lt;br /&gt;
        end&lt;br /&gt;
 &lt;br /&gt;
==== fortran zdotc  example====&lt;br /&gt;
Use following command to compile:&lt;br /&gt;
 $FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
where &lt;br /&gt;
 ! file name = fortran_zdotc.f90&lt;br /&gt;
 &lt;br /&gt;
       program fortran_zdotc&lt;br /&gt;
       implicit none&lt;br /&gt;
 &lt;br /&gt;
       integer, parameter :: NN=5&lt;br /&gt;
       integer :: n, inca, incb&lt;br /&gt;
       integer :: i&lt;br /&gt;
 &lt;br /&gt;
       DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC&lt;br /&gt;
       REAL*8 :: Di, Dn&lt;br /&gt;
 &lt;br /&gt;
       inca = 1&lt;br /&gt;
       incb = 1&lt;br /&gt;
 &lt;br /&gt;
       n  = NN&lt;br /&gt;
       Dn = DBLE(n)&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       DO i=0,n-1&lt;br /&gt;
         Di = i&lt;br /&gt;
         ZX(i) = CMPLX(Di,2.0D0*Di)&lt;br /&gt;
         ZY(i) = CMPLX(Dn-Di,2.0D0*Di)&lt;br /&gt;
         write(6,1001) ZX(i),ZY(i)&lt;br /&gt;
  1001   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)    (&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       END DO&lt;br /&gt;
 &lt;br /&gt;
       ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)&lt;br /&gt;
       ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)&lt;br /&gt;
 &lt;br /&gt;
  1002   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZX,ZY&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPXY&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZY,ZX&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPYX&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;Job completed successfully&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       end program fortran_zdotc&lt;br /&gt;
&lt;br /&gt;
==== c zdotc  example====&lt;br /&gt;
Use following command to compile: &lt;br /&gt;
  $CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
 /* file name = main_zdotc.c */&lt;br /&gt;
  &lt;br /&gt;
  /* The following example illustrates a call from a C program to the &lt;br /&gt;
   * complex BLAS Level 1 function zdotc(). This function computes &lt;br /&gt;
   * the dot product of two double-precision complex vectors.        &lt;br /&gt;
  &lt;br /&gt;
     DOT_PRODUCT = &amp;lt;ZX,ZY&amp;gt; = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }&lt;br /&gt;
                                    ------------- * ----&lt;br /&gt;
     Note that &amp;lt;ZX,ZY&amp;gt; = DCONJG(&amp;lt;ZY,ZX&amp;gt;)&lt;br /&gt;
    &lt;br /&gt;
     See: http://www2.math.umd.edu/~hking/Hermitian.pdf&lt;br /&gt;
  &lt;br /&gt;
   * In this example, the complex dot product is returned in the structure c. &lt;br /&gt;
   */&lt;br /&gt;
  &lt;br /&gt;
  #include &amp;quot;mkl.h&amp;quot;&lt;br /&gt;
  #define N 5 &lt;br /&gt;
  &lt;br /&gt;
  void zdotc();&lt;br /&gt;
  &lt;br /&gt;
  int main() {&lt;br /&gt;
    int n, inca = 1, incb = 1, i;&lt;br /&gt;
  &lt;br /&gt;
    int DEBUG=1;&lt;br /&gt;
  &lt;br /&gt;
  /*  typedef struct {...} MKL_Complex16;   defined in &amp;quot;mkl.h&amp;quot;    */&lt;br /&gt;
  &lt;br /&gt;
    MKL_Complex16 a[N], b[N], c, d;&lt;br /&gt;
    n = N;&lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
    for ( i = 0; i &amp;lt; n; i++ ){&lt;br /&gt;
      a[i].real = (double)i;&lt;br /&gt;
      a[i].imag = (double)i * 2.0;&lt;br /&gt;
  &lt;br /&gt;
      b[i].real = (double)(n - i);&lt;br /&gt;
      b[i].imag = (double)i * 3.0;&lt;br /&gt;
  &lt;br /&gt;
      printf(&amp;quot; ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n&amp;quot;,a[i].real,a[i].imag,b[i].real,b[i].imag);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    zdotc( &amp;amp;c, &amp;amp;n, a, &amp;amp;inca, b, &amp;amp;incb );&lt;br /&gt;
    zdotc( &amp;amp;d, &amp;amp;n, b, &amp;amp;incb, a, &amp;amp;inca ); &lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;The complex dot product a|b is: ( %6.2f, %6.2f) \n&amp;quot;, c.real, c.imag );&lt;br /&gt;
    printf(&amp;quot;The complex dot product b|a is: ( %6.2f, %6.2f) \n&amp;quot;, d.real, d.imag );&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;Job completed successfully\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General Notes===&lt;br /&gt;
====COMPILING WITH MKL - USING ONLINE LINK ADVISOR====&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using The ILP64 Vs LP64 Variants Of MKL====&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
===Support for Third-Party Interfaces===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
=== FFTW Interface Support===&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Introduction to Using the MKL FFT===&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===SUMMARY EXAMPLE PROGRAMS===&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6607</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6607"/>
				<updated>2013-05-28T21:49:04Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* COMPILING WITH MKL - USING ONLINE LINK ADVISOR */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
  &lt;br /&gt;
  !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
  !    This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
   &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
  &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
  &lt;br /&gt;
        subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
        implicit none&lt;br /&gt;
        integer            :: i, j, nRows, nCols&lt;br /&gt;
        double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
  &lt;br /&gt;
        do i=1,nRows&lt;br /&gt;
          do j=1,nCols&lt;br /&gt;
            print *,i,j,pMatrix(i,j)&lt;br /&gt;
          enddo&lt;br /&gt;
        enddo&lt;br /&gt;
  &lt;br /&gt;
        print *,&amp;quot; &amp;quot;&lt;br /&gt;
        return&lt;br /&gt;
        end&lt;br /&gt;
 &lt;br /&gt;
==== fortran zdotc  example====&lt;br /&gt;
Use following command to compile:&lt;br /&gt;
 $FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
where &lt;br /&gt;
 ! file name = fortran_zdotc.f90&lt;br /&gt;
 &lt;br /&gt;
       program fortran_zdotc&lt;br /&gt;
       implicit none&lt;br /&gt;
 &lt;br /&gt;
       integer, parameter :: NN=5&lt;br /&gt;
       integer :: n, inca, incb&lt;br /&gt;
       integer :: i&lt;br /&gt;
 &lt;br /&gt;
       DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC&lt;br /&gt;
       REAL*8 :: Di, Dn&lt;br /&gt;
 &lt;br /&gt;
       inca = 1&lt;br /&gt;
       incb = 1&lt;br /&gt;
 &lt;br /&gt;
       n  = NN&lt;br /&gt;
       Dn = DBLE(n)&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       DO i=0,n-1&lt;br /&gt;
         Di = i&lt;br /&gt;
         ZX(i) = CMPLX(Di,2.0D0*Di)&lt;br /&gt;
         ZY(i) = CMPLX(Dn-Di,2.0D0*Di)&lt;br /&gt;
         write(6,1001) ZX(i),ZY(i)&lt;br /&gt;
  1001   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)    (&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       END DO&lt;br /&gt;
 &lt;br /&gt;
       ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)&lt;br /&gt;
       ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)&lt;br /&gt;
 &lt;br /&gt;
  1002   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZX,ZY&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPXY&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZY,ZX&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPYX&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;Job completed successfully&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       end program fortran_zdotc&lt;br /&gt;
&lt;br /&gt;
==== c zdotc  example====&lt;br /&gt;
Use following command to compile: &lt;br /&gt;
  $CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
 /* file name = main_zdotc.c */&lt;br /&gt;
  &lt;br /&gt;
  /* The following example illustrates a call from a C program to the &lt;br /&gt;
   * complex BLAS Level 1 function zdotc(). This function computes &lt;br /&gt;
   * the dot product of two double-precision complex vectors.        &lt;br /&gt;
  &lt;br /&gt;
     DOT_PRODUCT = &amp;lt;ZX,ZY&amp;gt; = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }&lt;br /&gt;
                                    ------------- * ----&lt;br /&gt;
     Note that &amp;lt;ZX,ZY&amp;gt; = DCONJG(&amp;lt;ZY,ZX&amp;gt;)&lt;br /&gt;
    &lt;br /&gt;
     See: http://www2.math.umd.edu/~hking/Hermitian.pdf&lt;br /&gt;
  &lt;br /&gt;
   * In this example, the complex dot product is returned in the structure c. &lt;br /&gt;
   */&lt;br /&gt;
  &lt;br /&gt;
  #include &amp;quot;mkl.h&amp;quot;&lt;br /&gt;
  #define N 5 &lt;br /&gt;
  &lt;br /&gt;
  void zdotc();&lt;br /&gt;
  &lt;br /&gt;
  int main() {&lt;br /&gt;
    int n, inca = 1, incb = 1, i;&lt;br /&gt;
  &lt;br /&gt;
    int DEBUG=1;&lt;br /&gt;
  &lt;br /&gt;
  /*  typedef struct {...} MKL_Complex16;   defined in &amp;quot;mkl.h&amp;quot;    */&lt;br /&gt;
  &lt;br /&gt;
    MKL_Complex16 a[N], b[N], c, d;&lt;br /&gt;
    n = N;&lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
    for ( i = 0; i &amp;lt; n; i++ ){&lt;br /&gt;
      a[i].real = (double)i;&lt;br /&gt;
      a[i].imag = (double)i * 2.0;&lt;br /&gt;
  &lt;br /&gt;
      b[i].real = (double)(n - i);&lt;br /&gt;
      b[i].imag = (double)i * 3.0;&lt;br /&gt;
  &lt;br /&gt;
      printf(&amp;quot; ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n&amp;quot;,a[i].real,a[i].imag,b[i].real,b[i].imag);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    zdotc( &amp;amp;c, &amp;amp;n, a, &amp;amp;inca, b, &amp;amp;incb );&lt;br /&gt;
    zdotc( &amp;amp;d, &amp;amp;n, b, &amp;amp;incb, a, &amp;amp;inca ); &lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;The complex dot product a|b is: ( %6.2f, %6.2f) \n&amp;quot;, c.real, c.imag );&lt;br /&gt;
    printf(&amp;quot;The complex dot product b|a is: ( %6.2f, %6.2f) \n&amp;quot;, d.real, d.imag );&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;Job completed successfully\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General Notes===&lt;br /&gt;
====COMPILING WITH MKL - USING ONLINE LINK ADVISOR====&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Note About Using The ILP64 Vs LP64 Variants Of MKL===&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
===Support for Third-Party Interfaces===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
=== FFTW Interface Support===&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Introduction to Using the MKL FFT===&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===SUMMARY EXAMPLE PROGRAMS===&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6606</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6606"/>
				<updated>2013-05-28T18:57:20Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* c zdotc  example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
  &lt;br /&gt;
  !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
  !    This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
   &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
  &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
  &lt;br /&gt;
        subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
        implicit none&lt;br /&gt;
        integer            :: i, j, nRows, nCols&lt;br /&gt;
        double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
  &lt;br /&gt;
        do i=1,nRows&lt;br /&gt;
          do j=1,nCols&lt;br /&gt;
            print *,i,j,pMatrix(i,j)&lt;br /&gt;
          enddo&lt;br /&gt;
        enddo&lt;br /&gt;
  &lt;br /&gt;
        print *,&amp;quot; &amp;quot;&lt;br /&gt;
        return&lt;br /&gt;
        end&lt;br /&gt;
 &lt;br /&gt;
==== fortran zdotc  example====&lt;br /&gt;
Use following command to compile:&lt;br /&gt;
 $FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
where &lt;br /&gt;
 ! file name = fortran_zdotc.f90&lt;br /&gt;
 &lt;br /&gt;
       program fortran_zdotc&lt;br /&gt;
       implicit none&lt;br /&gt;
 &lt;br /&gt;
       integer, parameter :: NN=5&lt;br /&gt;
       integer :: n, inca, incb&lt;br /&gt;
       integer :: i&lt;br /&gt;
 &lt;br /&gt;
       DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC&lt;br /&gt;
       REAL*8 :: Di, Dn&lt;br /&gt;
 &lt;br /&gt;
       inca = 1&lt;br /&gt;
       incb = 1&lt;br /&gt;
 &lt;br /&gt;
       n  = NN&lt;br /&gt;
       Dn = DBLE(n)&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       DO i=0,n-1&lt;br /&gt;
         Di = i&lt;br /&gt;
         ZX(i) = CMPLX(Di,2.0D0*Di)&lt;br /&gt;
         ZY(i) = CMPLX(Dn-Di,2.0D0*Di)&lt;br /&gt;
         write(6,1001) ZX(i),ZY(i)&lt;br /&gt;
  1001   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)    (&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       END DO&lt;br /&gt;
 &lt;br /&gt;
       ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)&lt;br /&gt;
       ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)&lt;br /&gt;
 &lt;br /&gt;
  1002   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZX,ZY&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPXY&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZY,ZX&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPYX&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;Job completed successfully&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       end program fortran_zdotc&lt;br /&gt;
&lt;br /&gt;
==== c zdotc  example====&lt;br /&gt;
Use following command to compile: &lt;br /&gt;
  $CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
 /* file name = main_zdotc.c */&lt;br /&gt;
  &lt;br /&gt;
  /* The following example illustrates a call from a C program to the &lt;br /&gt;
   * complex BLAS Level 1 function zdotc(). This function computes &lt;br /&gt;
   * the dot product of two double-precision complex vectors.        &lt;br /&gt;
  &lt;br /&gt;
     DOT_PRODUCT = &amp;lt;ZX,ZY&amp;gt; = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }&lt;br /&gt;
                                    ------------- * ----&lt;br /&gt;
     Note that &amp;lt;ZX,ZY&amp;gt; = DCONJG(&amp;lt;ZY,ZX&amp;gt;)&lt;br /&gt;
    &lt;br /&gt;
     See: http://www2.math.umd.edu/~hking/Hermitian.pdf&lt;br /&gt;
  &lt;br /&gt;
   * In this example, the complex dot product is returned in the structure c. &lt;br /&gt;
   */&lt;br /&gt;
  &lt;br /&gt;
  #include &amp;quot;mkl.h&amp;quot;&lt;br /&gt;
  #define N 5 &lt;br /&gt;
  &lt;br /&gt;
  void zdotc();&lt;br /&gt;
  &lt;br /&gt;
  int main() {&lt;br /&gt;
    int n, inca = 1, incb = 1, i;&lt;br /&gt;
  &lt;br /&gt;
    int DEBUG=1;&lt;br /&gt;
  &lt;br /&gt;
  /*  typedef struct {...} MKL_Complex16;   defined in &amp;quot;mkl.h&amp;quot;    */&lt;br /&gt;
  &lt;br /&gt;
    MKL_Complex16 a[N], b[N], c, d;&lt;br /&gt;
    n = N;&lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
    for ( i = 0; i &amp;lt; n; i++ ){&lt;br /&gt;
      a[i].real = (double)i;&lt;br /&gt;
      a[i].imag = (double)i * 2.0;&lt;br /&gt;
  &lt;br /&gt;
      b[i].real = (double)(n - i);&lt;br /&gt;
      b[i].imag = (double)i * 3.0;&lt;br /&gt;
  &lt;br /&gt;
      printf(&amp;quot; ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n&amp;quot;,a[i].real,a[i].imag,b[i].real,b[i].imag);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    zdotc( &amp;amp;c, &amp;amp;n, a, &amp;amp;inca, b, &amp;amp;incb );&lt;br /&gt;
    zdotc( &amp;amp;d, &amp;amp;n, b, &amp;amp;incb, a, &amp;amp;inca ); &lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;The complex dot product a|b is: ( %6.2f, %6.2f) \n&amp;quot;, c.real, c.imag );&lt;br /&gt;
    printf(&amp;quot;The complex dot product b|a is: ( %6.2f, %6.2f) \n&amp;quot;, d.real, d.imag );&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;Job completed successfully\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===COMPILING WITH MKL - USING ONLINE LINK ADVISOR===&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Note About Using The ILP64 Vs LP64 Variants Of MKL===&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
===Support for Third-Party Interfaces===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
=== FFTW Interface Support===&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Introduction to Using the MKL FFT===&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===SUMMARY EXAMPLE PROGRAMS===&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6605</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6605"/>
				<updated>2013-05-28T18:54:39Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* c zdotc  example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
  &lt;br /&gt;
  !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
  !    This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
   &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
  &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
  &lt;br /&gt;
        subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
        implicit none&lt;br /&gt;
        integer            :: i, j, nRows, nCols&lt;br /&gt;
        double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
  &lt;br /&gt;
        do i=1,nRows&lt;br /&gt;
          do j=1,nCols&lt;br /&gt;
            print *,i,j,pMatrix(i,j)&lt;br /&gt;
          enddo&lt;br /&gt;
        enddo&lt;br /&gt;
  &lt;br /&gt;
        print *,&amp;quot; &amp;quot;&lt;br /&gt;
        return&lt;br /&gt;
        end&lt;br /&gt;
 &lt;br /&gt;
==== fortran zdotc  example====&lt;br /&gt;
Use following command to compile:&lt;br /&gt;
 $FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
where &lt;br /&gt;
 ! file name = fortran_zdotc.f90&lt;br /&gt;
 &lt;br /&gt;
       program fortran_zdotc&lt;br /&gt;
       implicit none&lt;br /&gt;
 &lt;br /&gt;
       integer, parameter :: NN=5&lt;br /&gt;
       integer :: n, inca, incb&lt;br /&gt;
       integer :: i&lt;br /&gt;
 &lt;br /&gt;
       DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC&lt;br /&gt;
       REAL*8 :: Di, Dn&lt;br /&gt;
 &lt;br /&gt;
       inca = 1&lt;br /&gt;
       incb = 1&lt;br /&gt;
 &lt;br /&gt;
       n  = NN&lt;br /&gt;
       Dn = DBLE(n)&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       DO i=0,n-1&lt;br /&gt;
         Di = i&lt;br /&gt;
         ZX(i) = CMPLX(Di,2.0D0*Di)&lt;br /&gt;
         ZY(i) = CMPLX(Dn-Di,2.0D0*Di)&lt;br /&gt;
         write(6,1001) ZX(i),ZY(i)&lt;br /&gt;
  1001   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)    (&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       END DO&lt;br /&gt;
 &lt;br /&gt;
       ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)&lt;br /&gt;
       ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)&lt;br /&gt;
 &lt;br /&gt;
  1002   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZX,ZY&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPXY&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZY,ZX&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPYX&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;Job completed successfully&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       end program fortran_zdotc&lt;br /&gt;
&lt;br /&gt;
==== c zdotc  example====&lt;br /&gt;
Use following command to compile: &lt;br /&gt;
  $CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
 /* file name = main_zdotc.c */&lt;br /&gt;
  &lt;br /&gt;
  /* The following example illustrates a call from a C program to the &lt;br /&gt;
   * complex BLAS Level 1 function zdotc(). This function computes &lt;br /&gt;
   * the dot product of two double-precision complex vectors.        &lt;br /&gt;
  &lt;br /&gt;
     DOT_PRODUCT = &amp;lt;ZX,ZY&amp;gt; = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }&lt;br /&gt;
                                    ------------- * ----&lt;br /&gt;
     Note that &amp;lt;ZX,ZY&amp;gt; = DCONJG(&amp;lt;ZY,ZX&amp;gt;)&lt;br /&gt;
    &lt;br /&gt;
     See: http://www2.math.umd.edu/~hking/Hermitian.pdf&lt;br /&gt;
  &lt;br /&gt;
   * In this example, the complex dot product is returned in the structure c. &lt;br /&gt;
   */&lt;br /&gt;
  &lt;br /&gt;
  #include &amp;quot;mkl.h&amp;quot;&lt;br /&gt;
  #define N 5 &lt;br /&gt;
  &lt;br /&gt;
  void zdotc();&lt;br /&gt;
  &lt;br /&gt;
  int main() {&lt;br /&gt;
    int n, inca = 1, incb = 1, i;&lt;br /&gt;
  &lt;br /&gt;
    int DEBUG=1;&lt;br /&gt;
  &lt;br /&gt;
  /*  typedef struct {...} MKL_Complex16;   defined in &amp;quot;mkl.h&amp;quot;    */&lt;br /&gt;
  &lt;br /&gt;
    MKL_Complex16 a[N], b[N], c, d;&lt;br /&gt;
    n = N;&lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
    for ( i = 0; i &amp;lt; n; i++ ){&lt;br /&gt;
      a[i].real = (double)i;&lt;br /&gt;
      a[i].imag = (double)i * 2.0;&lt;br /&gt;
  &lt;br /&gt;
      b[i].real = (double)(n - i);&lt;br /&gt;
      b[i].imag = (double)i * 3.0;&lt;br /&gt;
  &lt;br /&gt;
      printf(&amp;quot; ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n&amp;quot;,a[i].real,a[i].imag,b[i].real,b[i].imag);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    zdotc( &amp;amp;c, &amp;amp;n, a, &amp;amp;inca, b, &amp;amp;incb );&lt;br /&gt;
    zdotc( &amp;amp;d, &amp;amp;n, b, &amp;amp;incb, a, &amp;amp;inca ); &lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;The complex dot product '&amp;lt;a|b&amp;gt;' is: ( %6.2f, %6.2f) \n&amp;quot;, c.real, c.imag );&lt;br /&gt;
    printf(&amp;quot;The complex dot product '&amp;lt;b|a&amp;gt;' is: ( %6.2f, %6.2f) \n&amp;quot;, d.real, d.imag );&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;Job completed successfully\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===COMPILING WITH MKL - USING ONLINE LINK ADVISOR===&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Note About Using The ILP64 Vs LP64 Variants Of MKL===&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
===Support for Third-Party Interfaces===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
=== FFTW Interface Support===&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Introduction to Using the MKL FFT===&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===SUMMARY EXAMPLE PROGRAMS===&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6583</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6583"/>
				<updated>2013-05-24T23:38:37Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* fortran dgemm example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
  &lt;br /&gt;
  !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
  !    This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
   &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
  &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
  &lt;br /&gt;
        subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
        implicit none&lt;br /&gt;
        integer            :: i, j, nRows, nCols&lt;br /&gt;
        double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
  &lt;br /&gt;
        do i=1,nRows&lt;br /&gt;
          do j=1,nCols&lt;br /&gt;
            print *,i,j,pMatrix(i,j)&lt;br /&gt;
          enddo&lt;br /&gt;
        enddo&lt;br /&gt;
  &lt;br /&gt;
        print *,&amp;quot; &amp;quot;&lt;br /&gt;
        return&lt;br /&gt;
        end&lt;br /&gt;
 &lt;br /&gt;
==== fortran zdotc  example====&lt;br /&gt;
Use following command to compile:&lt;br /&gt;
 $FC fortran_zdotc.f90 -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
where &lt;br /&gt;
 ! file name = fortran_zdotc.f90&lt;br /&gt;
 &lt;br /&gt;
       program fortran_zdotc&lt;br /&gt;
       implicit none&lt;br /&gt;
 &lt;br /&gt;
       integer, parameter :: NN=5&lt;br /&gt;
       integer :: n, inca, incb&lt;br /&gt;
       integer :: i&lt;br /&gt;
 &lt;br /&gt;
       DOUBLE COMPLEX :: ZX(0:NN-1),ZY(0:NN-1),ZDPXY,ZDPYX,ZDOTC&lt;br /&gt;
       REAL*8 :: Di, Dn&lt;br /&gt;
 &lt;br /&gt;
       inca = 1&lt;br /&gt;
       incb = 1&lt;br /&gt;
 &lt;br /&gt;
       n  = NN&lt;br /&gt;
       Dn = DBLE(n)&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       DO i=0,n-1&lt;br /&gt;
         Di = i&lt;br /&gt;
         ZX(i) = CMPLX(Di,2.0D0*Di)&lt;br /&gt;
         ZY(i) = CMPLX(Dn-Di,2.0D0*Di)&lt;br /&gt;
         write(6,1001) ZX(i),ZY(i)&lt;br /&gt;
  1001   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)    (&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       END DO&lt;br /&gt;
 &lt;br /&gt;
       ZDPXY = ZDOTC(n,ZX,inca,ZY,incb)&lt;br /&gt;
       ZDPYX = ZDOTC(n,ZY,incb,ZX,inca)&lt;br /&gt;
 &lt;br /&gt;
  1002   format(&amp;quot;(&amp;quot;,f6.2,&amp;quot;,&amp;quot;,f6.2,&amp;quot;)&amp;quot;)&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZX,ZY&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPXY&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;lt;ZY,ZX&amp;gt;&amp;quot;&lt;br /&gt;
       write(6,1002) ZDPYX&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot;Job completed successfully&amp;quot;&lt;br /&gt;
       print *,&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
       end program fortran_zdotc&lt;br /&gt;
&lt;br /&gt;
==== c zdotc  example====&lt;br /&gt;
Use following command to compile: &lt;br /&gt;
  $CC main_zdotc.c -L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -openmp -lpthread&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
 /* file name = main_zdotc.c */&lt;br /&gt;
  &lt;br /&gt;
  /* The following example illustrates a call from a C program to the &lt;br /&gt;
   * complex BLAS Level 1 function zdotc(). This function computes &lt;br /&gt;
   * the dot product of two double-precision complex vectors.        &lt;br /&gt;
  &lt;br /&gt;
     DOT_PRODUCT = &amp;lt;ZX,ZY&amp;gt; = SUM[i=0,i=n-1] { DCONJG(ZX(I)) * ZY(I) }&lt;br /&gt;
                                    ------------- * ----&lt;br /&gt;
     Note that &amp;lt;ZX,ZY&amp;gt; = DCONJG(&amp;lt;ZY,ZX&amp;gt;)&lt;br /&gt;
    &lt;br /&gt;
     See: http://www2.math.umd.edu/~hking/Hermitian.pdf&lt;br /&gt;
  &lt;br /&gt;
   * In this example, the complex dot product is returned in the structure c. &lt;br /&gt;
   */&lt;br /&gt;
  &lt;br /&gt;
  #include &amp;quot;mkl.h&amp;quot;&lt;br /&gt;
  #define N 5 &lt;br /&gt;
  &lt;br /&gt;
  void zdotc();&lt;br /&gt;
  &lt;br /&gt;
  int main() {&lt;br /&gt;
    int n, inca = 1, incb = 1, i;&lt;br /&gt;
  &lt;br /&gt;
    int DEBUG=1;&lt;br /&gt;
  &lt;br /&gt;
  /*  typedef struct {...} MKL_Complex16;   defined in &amp;quot;mkl.h&amp;quot;    */&lt;br /&gt;
  &lt;br /&gt;
    MKL_Complex16 a[N], b[N], c, d;&lt;br /&gt;
    n = N;&lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
    for ( i = 0; i &amp;lt; n; i++ ){&lt;br /&gt;
      a[i].real = (double)i;&lt;br /&gt;
      a[i].imag = (double)i * 2.0;&lt;br /&gt;
  &lt;br /&gt;
      b[i].real = (double)(n - i);&lt;br /&gt;
      b[i].imag = (double)i * 3.0;&lt;br /&gt;
  &lt;br /&gt;
      printf(&amp;quot; ( %6.2f, %6.2f) ( %6.2f, %6.2f) \n&amp;quot;,a[i].real,a[i].imag,b[i].real,b[i].imag);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    zdotc( &amp;amp;c, &amp;amp;n, a, &amp;amp;inca, b, &amp;amp;incb );&lt;br /&gt;
    zdotc( &amp;amp;d, &amp;amp;n, b, &amp;amp;incb, a, &amp;amp;inca ); &lt;br /&gt;
  &lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;The complex dot product &amp;lt;a|b&amp;gt; is: ( %6.2f, %6.2f) \n&amp;quot;, c.real, c.imag );&lt;br /&gt;
    printf(&amp;quot;The complex dot product &amp;lt;b|a&amp;gt; is: ( %6.2f, %6.2f) \n&amp;quot;, d.real, d.imag );&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;Job completed successfully\n&amp;quot;);&lt;br /&gt;
    printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===COMPILING WITH MKL - USING ONLINE LINK ADVISOR===&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Note About Using The ILP64 Vs LP64 Variants Of MKL===&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
===Support for Third-Party Interfaces===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
=== FFTW Interface Support===&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Introduction to Using the MKL FFT===&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===SUMMARY EXAMPLE PROGRAMS===&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6582</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6582"/>
				<updated>2013-05-24T23:22:11Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* Support for Third-Party Interfaces */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
 &lt;br /&gt;
 !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
 !   This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
  &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
 &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
 &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
 &lt;br /&gt;
       subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer            :: i, j, nRows, nCols&lt;br /&gt;
       double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
 &lt;br /&gt;
       do i=1,nRows&lt;br /&gt;
         do j=1,nCols&lt;br /&gt;
           print *,i,j,pMatrix(i,j)&lt;br /&gt;
         enddo&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot; &amp;quot;&lt;br /&gt;
       return&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===COMPILING WITH MKL - USING ONLINE LINK ADVISOR===&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Note About Using The ILP64 Vs LP64 Variants Of MKL===&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
===Support for Third-Party Interfaces===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
=== FFTW Interface Support===&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Introduction to Using the MKL FFT===&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===SUMMARY EXAMPLE PROGRAMS===&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6581</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6581"/>
				<updated>2013-05-24T23:18:38Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* fortran dgemm example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
 &lt;br /&gt;
 !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
 !   This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
  &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
 &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
 &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
 &lt;br /&gt;
       subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer            :: i, j, nRows, nCols&lt;br /&gt;
       double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
 &lt;br /&gt;
       do i=1,nRows&lt;br /&gt;
         do j=1,nCols&lt;br /&gt;
           print *,i,j,pMatrix(i,j)&lt;br /&gt;
         enddo&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot; &amp;quot;&lt;br /&gt;
       return&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===COMPILING WITH MKL - USING ONLINE LINK ADVISOR===&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Note About Using The ILP64 Vs LP64 Variants Of MKL===&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
===Support for Third-Party Interfaces===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o FFTW Interface Support&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;Introduction to Using the MKL FFT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;SUMMARY EXAMPLE PROGRAMS&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6580</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6580"/>
				<updated>2013-05-24T23:15:40Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* fortran dgemm example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
 &lt;br /&gt;
 !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
 !   This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
  &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
 &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
 &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
 &lt;br /&gt;
       subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer            :: i, j, nRows, nCols&lt;br /&gt;
       double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
 &lt;br /&gt;
       do i=1,nRows&lt;br /&gt;
         do j=1,nCols&lt;br /&gt;
           print *,i,j,pMatrix(i,j)&lt;br /&gt;
         enddo&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot; &amp;quot;&lt;br /&gt;
       return&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;COMPILING WITH MKL - USING ONLINE LINK ADVISOR&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;Note About Using The ILP64 Vs LP64 Variants Of MKL&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;Support for Third-Party Interfaces&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o FFTW Interface Support&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;Introduction to Using the MKL FFT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;SUMMARY EXAMPLE PROGRAMS&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6579</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6579"/>
				<updated>2013-05-24T23:05:03Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3), LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
===Version Selection===&lt;br /&gt;
&lt;br /&gt;
Presently there is only one version of MKL (mkl/10.3.9) and it is loaded automatically when you login.&lt;br /&gt;
&lt;br /&gt;
More details about module usage can be found here:&lt;br /&gt;
https://www.sharcnet.ca/help/index.php/Configuring_your_software_environment_with_Modules&lt;br /&gt;
&lt;br /&gt;
===Job Submission ===&lt;br /&gt;
Jobs requiring MKL should have a flag in the compiling command indicating the required libraries.&lt;br /&gt;
See the next section which illustrates this procedure.&lt;br /&gt;
&lt;br /&gt;
===Examples of Job Compilation===&lt;br /&gt;
We are assuming that the following modules are currently loaded:  mkl/10.3.9  intel/12.1.3&lt;br /&gt;
==== fortran dgemm example====&lt;br /&gt;
Use following command to compile file test_dgemm.f90:&lt;br /&gt;
 $FC test_dgemm.f90 -llapack&lt;br /&gt;
where&lt;br /&gt;
 ! file name = test_dgemm.f90&lt;br /&gt;
 &lt;br /&gt;
       program mainp1&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer, parameter :: HEIGHT=4&lt;br /&gt;
       integer, parameter :: WIDTH=3&lt;br /&gt;
       integer, parameter :: K=1&lt;br /&gt;
       integer            :: i, j&lt;br /&gt;
       double precision   :: ColumnVector(HEIGHT,K)&lt;br /&gt;
       double precision   :: RowVector(K,WIDTH)&lt;br /&gt;
       double precision   :: Result(HEIGHT,WIDTH)&lt;br /&gt;
       double precision   :: ALPHA, BETA&lt;br /&gt;
       character*1        :: NoTrans&lt;br /&gt;
 &lt;br /&gt;
       ALPHA = 1.0e0&lt;br /&gt;
       BETA  = 0.0e0&lt;br /&gt;
 &lt;br /&gt;
       do i=1,HEIGHT&lt;br /&gt;
         ColumnVector(i,K) = i&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       do j=1,WIDTH&lt;br /&gt;
         RowVector(K,j) = j&lt;br /&gt;
       enddo&lt;br /&gt;
  &lt;br /&gt;
       call PrintMatrix(ColumnVector, HEIGHT,K)&lt;br /&gt;
       call PrintMatrix(RowVector, K, WIDTH)&lt;br /&gt;
 &lt;br /&gt;
 !    To do the calculation, we will use the BLAS function dgemm. &lt;br /&gt;
 !   This function calculates:  C = ALPHA*A*B + BETA*C &lt;br /&gt;
  &lt;br /&gt;
       NoTrans  =  'N'&lt;br /&gt;
 &lt;br /&gt;
       call dgemm(NoTrans,NoTrans,HEIGHT,WIDTH,1,ALPHA,        &amp;amp;&lt;br /&gt;
      &amp;amp;     ColumnVector,HEIGHT,RowVector,1,BETA,Result,HEIGHT)&lt;br /&gt;
 &lt;br /&gt;
       call PrintMatrix(Result, HEIGHT, WIDTH)&lt;br /&gt;
       stop&lt;br /&gt;
       end&lt;br /&gt;
 &lt;br /&gt;
       subroutine PrintMatrix(pMatrix,nRows,nCols)&lt;br /&gt;
       implicit none&lt;br /&gt;
       integer            :: i, j, nRows, nCols&lt;br /&gt;
       double precision   :: pMatrix(nRows,nCols)&lt;br /&gt;
 &lt;br /&gt;
       do i=1,nRows&lt;br /&gt;
         do j=1,nCols&lt;br /&gt;
           print *,i,j,pMatrix(i,j)&lt;br /&gt;
         enddo&lt;br /&gt;
       enddo&lt;br /&gt;
 &lt;br /&gt;
       print *,&amp;quot; &amp;quot;&lt;br /&gt;
       return&lt;br /&gt;
       end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;COMPILING WITH MKL - USING ONLINE LINK ADVISOR&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;Note About Using The ILP64 Vs LP64 Variants Of MKL&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;Support for Third-Party Interfaces&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o FFTW Interface Support&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;Introduction to Using the MKL FFT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;SUMMARY EXAMPLE PROGRAMS&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6578</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6578"/>
				<updated>2013-05-24T22:42:51Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3) and LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;COMPILING WITH MKL - USING ONLINE LINK ADVISOR&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;Note About Using The ILP64 Vs LP64 Variants Of MKL&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;Support for Third-Party Interfaces&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o FFTW Interface Support&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;Introduction to Using the MKL FFT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;SUMMARY EXAMPLE PROGRAMS&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6576</id>
		<title>MKL</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=MKL&amp;diff=6576"/>
				<updated>2013-05-24T16:04:51Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=MKL&lt;br /&gt;
|package_description=Intel Math Kernel Library&lt;br /&gt;
|package_idnumber=89&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
 MKL (Intel's Math Kernel Library) is a computing math library of highly optimized, extensively threaded&lt;br /&gt;
routines for applications that require maximum performance. Intel MKL provides comprehensive functionality&lt;br /&gt;
support in these major areas of computation: BLAS (level 1, 2, and 3) and LAPACK linear algebra routines,&lt;br /&gt;
ScaLAPACK,  BLACS,  PBLAS, FFT.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;COMPILING WITH MKL - USING LEGACY COMPILE SCRIPT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the remaining centos5 clusters (see https://www.sharcnet.ca/my/software/show/129) the compile script can be used for codes needing to link with the MKL blas and lapack libraries (where the program extension &amp;lt;b&amp;gt;xyz&amp;lt;/b&amp;gt; can be any of c/cc, cxx/CC/c++ or f77/f90/f95) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;compile program.xyz -llapack&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate this approach, consider the following example where the result from a.out can be compared with the expect vendor provided solution:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh kraken.sharcnet.ca&lt;br /&gt;
ln -s /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.f&lt;br /&gt;
compile dgetrf_example.f -llapack&lt;br /&gt;
./a.out&lt;br /&gt;
cat /opt/sharcnet/acml/4.3.0/ifort-64bit/ifort64/examples/dgetrf_example.expected &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;COMPILING WITH MKL - USING ONLINE LINK ADVISOR&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More generally (on any sharcnet cluster) the &amp;lt;i&amp;gt;Intel Math Kernel Library Link Line Advisor&amp;lt;/i&amp;gt; http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ can be used to generate linker options for more complex linking situations with MKL than the compile script supports.  For instance, to determine the link arguments for the Linux Operating System, IA64 Itanium Processor, Intel Compiler, Dynamic Linking, 64 bit Integers, Multi-threaded Version of MKL, Intel OpenMP Library (libiomp5) plus the Scalapack Library, the MKL Link Line Advisor would (at the time of this writing) return the following recomendation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$MKLPATH/libmkl_scalapack_lp64.a $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a $MKLPATH/libmkl_blacs_sgimpt_lp64.a -Wl,--end-group -openmp -lpthread&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MKLPATH should be set accordingly to which version of the intel compiler module is loaded as well as the type of operating system.  For instance:&lt;br /&gt;
&lt;br /&gt;
o Centos5 With Default 11.0.083 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/em64t&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
o Centos6 With Default 12.1.3 Compiler Use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MKLPATH=/opt/sharcnet/mkl/10.3.9/mkl/lib/intel64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;Note About Using The ILP64 Vs LP64 Variants Of MKL&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should use Intel MKL ilp64 in following cases.&amp;lt;br&amp;gt;&lt;br /&gt;
1. If you are using huge data arrays (indexing exceeds 2^32-1)&amp;lt;br&amp;gt;&lt;br /&gt;
2. If you enable FORTRAN code with the /4I8 compiler option&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ilp64 version of the MKL libraries defines integers as 64 bit. This implies codes should be compiled with -i8 OR internally be modfied to use the integer*8 type.  Otherwise the standard lp64 version of MKL should be used which assumes integers are standard 32 bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;Support for Third-Party Interfaces&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o GMP Functions&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The Intel MKL implementation of GMP arithmetic functions includes arbitrary precision arithmetic operations on integer numbers. The interfaces of such functions fully match the GNU Multiple Precision (GMP) Arithmetic Library. For specifications of these functions, please see this &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/gnump/WebHelp/'&amp;gt;link&amp;lt;/a&amp;gt;.  If you currently use the GMP  library, you need to modify INCLUDE statements in your programs to mkl_gmp.h.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;o FFTW Interface Support&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Intel MKL provides interface wrappers for the 2.x and 3.x FFTW (www.fftw.org) superstructure are located in the same directory on all clusters.  Using hound and version 11.0.083 of the intel compiler as an example, the wrappers and corresponding fftw wrapper header files are located in the following locations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/interfaces] ls&lt;br /&gt;
blas95  fftw2xc  fftw2x_cdft  fftw2xf  fftw3xc  fftw3xf  lapack95&lt;br /&gt;
&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/ifc/mkl/include/fftw] ls&lt;br /&gt;
fftw3.f  fftw_f77.i  fftw_mpi.h      rfftw.h      rfftw_threads.h&lt;br /&gt;
fftw3.h  fftw.h      fftw_threads.h  rfftw_mpi.h&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The wrappers can be used for calling the Intel ~&amp;lt;i&amp;gt;equivilent&amp;lt;/i&amp;gt;~ MKL Fourier transform functions instead of FFTW for programs that currently use FFTW without changing the program source code. Referring to the online document &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/fftw_mkl_user_notes_2.htm'&amp;gt;FFTW to Intel® Math Kernel Library Wrappers Technical User Notes&amp;lt;/a&amp;gt; its mentions that &amp;quot;FFTW2MKL wrappers are delivered as the source code that must be compiled by the user to build the wrapper library.&amp;quot;  By popular demand these wrapper have been precompiled for immediate use and located in two directories for each intel module (at present 11.0.083 and 11.1.069) as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd50:/opt/sharcnet/intel/11.0.083/mkl/lib/em64t/interfaces] tree&lt;br /&gt;
.&lt;br /&gt;
|-- ilp64&lt;br /&gt;
|   |-- libfftw2xc_intel.a&lt;br /&gt;
|   |-- libfftw2xf_intel.a&lt;br /&gt;
|   |-- libfftw3xc_intel.a&lt;br /&gt;
|   |-- libfftw3xf_intel.a&lt;br /&gt;
|   |-- libmkl_blas95.a&lt;br /&gt;
|   |-- libmkl_lapack95.a&lt;br /&gt;
|   |-- mkl77_lapack.mod&lt;br /&gt;
|   |-- mkl77_lapack1.mod&lt;br /&gt;
|   |-- mkl95_blas.mod&lt;br /&gt;
|   |-- mkl95_lapack.mod&lt;br /&gt;
|   `-- mkl95_precision.mod&lt;br /&gt;
`-- lp64&lt;br /&gt;
    |-- libfftw2xc_intel.a&lt;br /&gt;
    |-- libfftw2xf_intel.a&lt;br /&gt;
    |-- libfftw3xc_intel.a&lt;br /&gt;
    |-- libfftw3xf_intel.a&lt;br /&gt;
    |-- libmkl_blas95.a&lt;br /&gt;
    |-- libmkl_lapack95.a&lt;br /&gt;
    |-- mkl77_lapack.mod&lt;br /&gt;
    |-- mkl77_lapack1.mod&lt;br /&gt;
    |-- mkl95_blas.mod&lt;br /&gt;
    |-- mkl95_lapack.mod&lt;br /&gt;
    `-- mkl95_precision.mod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;Introduction to Using the MKL FFT&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Intel markets two implementations of the FFT.  The first being from &amp;lt;a href='http://software.intel.com/en-us/intel-mkl/'&amp;gt;MKL&amp;lt;/a&amp;gt; and the other from &amp;lt;a href='http://software.intel.com/en-us/intel-ipp/'&amp;gt;IPP&amp;lt;/a&amp;gt; whose differences are described &amp;lt;a href='http://software.intel.com/en-us/articles/mkl-ipp-choosing-an-fft/'&amp;gt;here&amp;lt;/a&amp;gt;. Only the MKL version is installed on SHARCNET.&lt;br /&gt;
&lt;br /&gt;
The main FFT Computation Functions provided with MKL are DftiComputeForward and DftiComputeForward which compute the forward and backward FFT respectively.  These functions along with Descriptor Manipulation Functions, Descriptor Configuration Functions and Status Checking Functions are provided in the &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/fft/fft_DFTF.html'&amp;gt;Table “FFT Functions in Intel MKL”&amp;lt;/a&amp;gt;.  Intel describes howto use these functions in their &amp;lt;a href='http://www.intel.com/software/products/mkl/docs/webhelp/appendices/mkl_appC_FFT.html'&amp;gt;Fourier Transform Functions Code Examples&amp;lt;/a&amp;gt; document which also covers multi-threading aspects.&lt;br /&gt;
&lt;br /&gt;
The simplest way to explain howto MKL FFT is by compiling and running a example problem of which there are several located under &amp;lt;i&amp;gt;/opt/sharcnet/intel/11.0.083/ifc/mkl/examples&amp;lt;/i&amp;gt; where the fortran samples are contained in the &amp;lt;i&amp;gt;dftf&amp;lt;/i&amp;gt; sub-directory while the c program samples are contained in the &amp;lt;i&amp;gt;dftc&amp;lt;/i&amp;gt; sub-directory.  The problem demonstrated here is from the source &amp;lt;i&amp;gt;complex_2d_double_ex1.f90&amp;lt;/i&amp;gt; which provides a MKL DFTI interface example program (Fortran-interface) to demonstrate Forward-Backward 2D complex transform for double precision data inplace.  Steps to run this program are as follows:&lt;br /&gt;
&lt;br /&gt;
1) Copy the example directory to a test directory in your account with:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -r /opt/sharcnet/intel/11.0.083/ifc/mkl/examples/dftf  /scratch/myusername/dftfdemo&lt;br /&gt;
cd /scratch/myusername/dftfdemo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Next compile the example program. In this case the machine used is Silky ie) ia64 based.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) The built output appears as follows, where you will note the first step is to compile &amp;lt;b&amp;gt;mkl_dfti.f90&amp;lt;/b&amp;gt; into a module which is then used in the program on line 42 where the statement &amp;lt;i&amp;gt;Use MKL_DFTI&amp;lt;/i&amp;gt; can be seen vizzz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make lib64 function=complex_2d_double_ex1 compiler=intel interface=ia64 [threading=parallel 2&amp;gt;&amp;amp;1 | tee myMake.out&lt;br /&gt;
rm -fr *.o *.mod&lt;br /&gt;
make mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  complex_2d_double_ex1.res  _IA=64 EXT=a RES_EXT=lib&lt;br /&gt;
make[1]: Entering directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c /opt/sharcnet/intel/11.0.083/ifc/mkl/include/mkl_dfti.f90 -o mkl_dfti.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_support.f90 -o dfti_example_support.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w -c source/dfti_example_status_print.f90 -o dfti_example_status_print.o&lt;br /&gt;
mkdir -p ./_results/intel_ia64_parallel_64_lib&lt;br /&gt;
ifort   -w mkl_dfti.o  dfti_example_support.o  dfti_example_status_print.o  source/complex_2d_double_ex1.f90 -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_lp64.a -Wl,--start-group &amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_intel_thread.a&lt;br /&gt;
&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;/libmkl_core.a -Wl,--end-group -L&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot; -liomp5 -lpthread -o&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out&lt;br /&gt;
export&lt;br /&gt;
LD_LIBRARY_PATH=&amp;quot;/opt/sharcnet/intel/11.0.083/ifc/mkl/lib/64&amp;quot;:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/lsf/6.2/linux2.6-glibc2.4-ia64/lib:/opt/sharcnet/intel/11$&lt;br /&gt;
_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.out &amp;lt;data/complex_2d_double_ex1.d &amp;gt;_results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
make[1]: Leaving directory `/home/roberpj/samples/fft-intel/fft/dftf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Since the program gets run automatically by the makefile, the output data can be examined by running more (or less) on the results file called &amp;lt;i&amp;gt;complex_2d_double_ex1.res&amp;lt;/i&amp;gt; which gets created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat _results/intel_ia64_parallel_64_lib/complex_2d_double_ex1.res&lt;br /&gt;
 COMPLEX_2D_DOUBLE_EX1&lt;br /&gt;
 Forward-Backward 2D complex transform for double precision data&lt;br /&gt;
 &lt;br /&gt;
 Configuration parameters:&lt;br /&gt;
 &lt;br /&gt;
 DFTI_FORWARD_DOMAIN       = DFTI_COMPLEX&lt;br /&gt;
 DFTI_PRECISION            = DFTI_DOUBLE &lt;br /&gt;
 DFTI_DIMENSION            =   2&lt;br /&gt;
 DFTI_LENGTHS              = {   5,   3}&lt;br /&gt;
 DFTI_PLACEMENT            = DFTI_INPLACE&lt;br /&gt;
 DFTI_INPUT_STRIDES        = {   0,   1,  15}&lt;br /&gt;
 DFTI_FORWARD_SCALE        = 1.0 &lt;br /&gt;
 DFTI_BACKWARD_SCALE       = 1.0/real(m*n)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 INPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeForward&lt;br /&gt;
 &lt;br /&gt;
 Forward OUTPUT vector X (2D columns)&lt;br /&gt;
   (  -3.720,  -2.480)   (   3.681,  -0.995)   (   0.497,   3.780)&lt;br /&gt;
   (   2.932,  -1.810)   (   1.422,   0.044)   (   3.078,  -1.928)&lt;br /&gt;
   (   1.115,  -2.479)   (  -2.040,   1.814)   (   3.144,   1.228)&lt;br /&gt;
   (  -1.859,   1.982)   (   2.343,   2.430)   (   0.890,  -2.581)&lt;br /&gt;
   (  -0.543,   3.403)   (  -0.596,   3.583)   (   0.588,   1.295)&lt;br /&gt;
 &lt;br /&gt;
 Compute DftiComputeBackward&lt;br /&gt;
 &lt;br /&gt;
 Backward OUTPUT vector X (2D columns)&lt;br /&gt;
   (   0.729,   0.486)   (  -0.865,  -0.577)   (  -0.278,  -0.186)&lt;br /&gt;
   (   0.787,   0.525)   (   0.839,   0.559)   (  -0.586,  -0.391)&lt;br /&gt;
   (   0.122,   0.081)   (  -0.741,  -0.494)   (  -0.794,  -0.529)&lt;br /&gt;
   (  -0.655,  -0.437)   (   0.580,   0.387)   (  -0.866,  -0.577)&lt;br /&gt;
   (  -0.830,  -0.554)   (  -0.371,  -0.247)   (  -0.791,  -0.527)&lt;br /&gt;
 &lt;br /&gt;
 ACCURACY =    0.248253E-15&lt;br /&gt;
 TEST PASSED&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;SUMMARY EXAMPLE PROGRAMS&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Intel compiler came with many mkl examples which can be copied to your work directory to experiment with by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cp -r /opt/sharcnet/intel/current/ifc/mkl/examples /work/$USER&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then each example can be compiled by going into any example directory and executing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make soem64t&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation (current release)&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.sharcnet.ca/Software/Intel/IntelIFC/mkl/mkl_documentation.htm&lt;br /&gt;
&lt;br /&gt;
o Intel Math Kernel Library Documentation Home (latest release)&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-documentation/&lt;br /&gt;
&lt;br /&gt;
o Version of Intel IPP, Intel MKL and Intel TBB Installed With The Intel® Compiler&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/&lt;br /&gt;
&lt;br /&gt;
o Known Limitiation In Mkl 10.1 For Linux&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/known-limitations-in-mkl-101-for-linux/&lt;br /&gt;
&lt;br /&gt;
o MKL - BLAS, CBLAS and LAPACK Compiling/Linking Functions &amp;amp;Fortran and C/C++ Calls&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-compilinglinking-functions-fortran-and-cc-calls/&lt;br /&gt;
&lt;br /&gt;
o Using the ILP64 Interface vs. LP64 Interface&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/sites/products/documentation/hpc/mkl/mkl_userguide_lnx/GUID-87821148-338B-4022-8C90-F24C866F2878.htm&lt;br /&gt;
&lt;br /&gt;
o Use of Intel MKL data types in C/C++ applications&amp;lt;br&amp;gt;&lt;br /&gt;
http://software.intel.com/en-us/articles/use-of-intel-mkl-data-types-in-cc-applications&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=6527</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=6527"/>
				<updated>2013-05-15T02:02:20Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* Sharing Packages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Octave is provided on SHARCNET clusters  to allow serial or threaded jobs to be run in the queue as described below.&lt;br /&gt;
&lt;br /&gt;
=Version Selection=&lt;br /&gt;
&lt;br /&gt;
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;module avail octave&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing.  Therefore to load octave/3.6.3 one would do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel&lt;br /&gt;
module load octave/3.6.3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Job Submission=&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -o ofile.%J octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Example Job=&lt;br /&gt;
&lt;br /&gt;
This section shows howto submit a  [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts  [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] cat sample.m &lt;br /&gt;
#! /bin/octave -qf&lt;br /&gt;
printf (&amp;quot;%s&amp;quot;, program_name ());&lt;br /&gt;
arg_list = argv ();&lt;br /&gt;
for i = 1:nargin&lt;br /&gt;
    printf (&amp;quot; %s&amp;quot;, arg_list{i});&lt;br /&gt;
endfor&lt;br /&gt;
printf (&amp;quot;\n&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To eliminate exatraneous verbosity in the output file two switches are passed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc&lt;br /&gt;
WARNING: no memory requirement defined; assuming 2GB per process.&lt;br /&gt;
submitted as jobid 6937872&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output file from the job appears as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50&lt;br /&gt;
sample.m arg1 arg2 arg3 etc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=General notes=&lt;br /&gt;
&lt;br /&gt;
==Matlab Compatibility==&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:&lt;br /&gt;
 http://wiki.octave.org/  &lt;br /&gt;
or &amp;quot;Wikibook&amp;quot;:&lt;br /&gt;
 http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB &lt;br /&gt;
provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
==Reading/Writing Files==&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;lt;i&amp;gt;input and output&amp;lt;/i&amp;gt; described in the &amp;quot;Octave manual&amp;quot; viz ...&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output&amp;lt;br&amp;gt; http://www.gnu.org/software/octave/docs.html.&lt;br /&gt;
&lt;br /&gt;
The following stanza demonstrates the &amp;quot;simple file I/O&amp;quot; approach:&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
==Large Memory Array Allocation==&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope has 32gb of unlimited memory the test will be demonstrated there since it should be sufficient to run:&lt;br /&gt;
&lt;br /&gt;
 [mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] module load octave/3.4.0&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] octave&lt;br /&gt;
 GNU Octave, version 3.4.0&lt;br /&gt;
 octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1);  C(N); 3*N &lt;br /&gt;
 ans =  1.2000e+09&lt;br /&gt;
 octave:4&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
==Octave-Forge==&lt;br /&gt;
&lt;br /&gt;
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system.  Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).&lt;br /&gt;
&lt;br /&gt;
Note however that 14 of approximately 95 octave-forge packages are installed on the sharcnet visualization workstations (currently just viz1-uwaterloo and viz6-uoguelph) under /usr/share/octave/packages.  As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature).  Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.&lt;br /&gt;
&lt;br /&gt;
===Sharing Packages===&lt;br /&gt;
&lt;br /&gt;
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users.  To do this simply set access permissions for group or global read access accordingly. For details on how to change &lt;br /&gt;
the permissions see:   https://www.sharcnet.ca/help/index.php/Knowledge_Base#How_do_I_give_other_users_access_to_my_files_.3F&lt;br /&gt;
&lt;br /&gt;
===Managing Packages===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot; http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. &lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
===Package Commands===&lt;br /&gt;
&lt;br /&gt;
Additional examples of package commands are shown in this section.  For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a package, from a terminal first do:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd ~/octave&lt;br /&gt;
rm -rf linear-algebra-2.2.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... then from within octave do:&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:5&amp;gt;  pkg uninstall linear-algebra&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:6&amp;gt;  pkg list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:7&amp;gt;  pkg load name&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:8&amp;gt;   pkg unload&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:9&amp;gt;  pkg describe -verbose all&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:10&amp;gt;  pkg describe odepkg&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:11&amp;gt;  pkg describe financial -verbose&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:12&amp;gt;   doc sin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:13&amp;gt;   help doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:14&amp;gt;  doc matrix&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:15&amp;gt;  doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Package Example===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named&lt;br /&gt;
  ~/my_octave_packages  &lt;br /&gt;
and the other &lt;br /&gt;
  ~/my_octave_sources &lt;br /&gt;
then download the required three tar.gz files into the latter from &lt;br /&gt;
 http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
 GNU Octave, version 3.4.3&lt;br /&gt;
 octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
 ans = /home/roberpj/my_octave_packages&lt;br /&gt;
 octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
 octave:3&amp;gt; ls&lt;br /&gt;
 miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz   struct-1.0.9.tar.gz&lt;br /&gt;
 octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
 octave:5&amp;gt; pkg list&lt;br /&gt;
 Package Name   | Version | Installation directory&lt;br /&gt;
 ---------------|---------|-----------------------&lt;br /&gt;
 miscellaneous *|  1.0.11 |  /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 |  /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 |  /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o Octave Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
o Octave 725 Page Manual (Version 3.4.0)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
o Statistic Package Function Reference&amp;lt;br&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
o GNU Octave Wiki&amp;lt;br&amp;gt;&lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
o Matlab-Like Tools for HPC (article)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=6526</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=6526"/>
				<updated>2013-05-15T01:43:29Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* Sharing Packages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Octave is provided on SHARCNET clusters  to allow serial or threaded jobs to be run in the queue as described below.&lt;br /&gt;
&lt;br /&gt;
=Version Selection=&lt;br /&gt;
&lt;br /&gt;
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;module avail octave&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing.  Therefore to load octave/3.6.3 one would do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel&lt;br /&gt;
module load octave/3.6.3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Job Submission=&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -o ofile.%J octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Example Job=&lt;br /&gt;
&lt;br /&gt;
This section shows howto submit a  [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts  [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] cat sample.m &lt;br /&gt;
#! /bin/octave -qf&lt;br /&gt;
printf (&amp;quot;%s&amp;quot;, program_name ());&lt;br /&gt;
arg_list = argv ();&lt;br /&gt;
for i = 1:nargin&lt;br /&gt;
    printf (&amp;quot; %s&amp;quot;, arg_list{i});&lt;br /&gt;
endfor&lt;br /&gt;
printf (&amp;quot;\n&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To eliminate exatraneous verbosity in the output file two switches are passed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc&lt;br /&gt;
WARNING: no memory requirement defined; assuming 2GB per process.&lt;br /&gt;
submitted as jobid 6937872&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output file from the job appears as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50&lt;br /&gt;
sample.m arg1 arg2 arg3 etc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=General notes=&lt;br /&gt;
&lt;br /&gt;
==Matlab Compatibility==&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:&lt;br /&gt;
 http://wiki.octave.org/  &lt;br /&gt;
or &amp;quot;Wikibook&amp;quot;:&lt;br /&gt;
 http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB &lt;br /&gt;
provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
==Reading/Writing Files==&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;lt;i&amp;gt;input and output&amp;lt;/i&amp;gt; described in the &amp;quot;Octave manual&amp;quot; viz ...&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output&amp;lt;br&amp;gt; http://www.gnu.org/software/octave/docs.html.&lt;br /&gt;
&lt;br /&gt;
The following stanza demonstrates the &amp;quot;simple file I/O&amp;quot; approach:&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
==Large Memory Array Allocation==&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope has 32gb of unlimited memory the test will be demonstrated there since it should be sufficient to run:&lt;br /&gt;
&lt;br /&gt;
 [mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] module load octave/3.4.0&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] octave&lt;br /&gt;
 GNU Octave, version 3.4.0&lt;br /&gt;
 octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1);  C(N); 3*N &lt;br /&gt;
 ans =  1.2000e+09&lt;br /&gt;
 octave:4&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
==Octave-Forge==&lt;br /&gt;
&lt;br /&gt;
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system.  Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).&lt;br /&gt;
&lt;br /&gt;
Note however that 14 of approximately 95 octave-forge packages are installed on the sharcnet visualization workstations (currently just viz1-uwaterloo and viz6-uoguelph) under /usr/share/octave/packages.  As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature).  Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.&lt;br /&gt;
&lt;br /&gt;
===Sharing Packages===&lt;br /&gt;
&lt;br /&gt;
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users.  To do this simply set access permissions for group or global read access accordingly. For details on how to change &lt;br /&gt;
the permissions see:  https://www.sharcnet.ca/help/index.php/Using_Unix_Overview#Permissions&lt;br /&gt;
&lt;br /&gt;
===Managing Packages===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot; http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. &lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
===Package Commands===&lt;br /&gt;
&lt;br /&gt;
Additional examples of package commands are shown in this section.  For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a package, from a terminal first do:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd ~/octave&lt;br /&gt;
rm -rf linear-algebra-2.2.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... then from within octave do:&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:5&amp;gt;  pkg uninstall linear-algebra&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:6&amp;gt;  pkg list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:7&amp;gt;  pkg load name&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:8&amp;gt;   pkg unload&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:9&amp;gt;  pkg describe -verbose all&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:10&amp;gt;  pkg describe odepkg&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:11&amp;gt;  pkg describe financial -verbose&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:12&amp;gt;   doc sin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:13&amp;gt;   help doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:14&amp;gt;  doc matrix&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:15&amp;gt;  doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Package Example===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named&lt;br /&gt;
  ~/my_octave_packages  &lt;br /&gt;
and the other &lt;br /&gt;
  ~/my_octave_sources &lt;br /&gt;
then download the required three tar.gz files into the latter from &lt;br /&gt;
 http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
 GNU Octave, version 3.4.3&lt;br /&gt;
 octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
 ans = /home/roberpj/my_octave_packages&lt;br /&gt;
 octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
 octave:3&amp;gt; ls&lt;br /&gt;
 miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz   struct-1.0.9.tar.gz&lt;br /&gt;
 octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
 octave:5&amp;gt; pkg list&lt;br /&gt;
 Package Name   | Version | Installation directory&lt;br /&gt;
 ---------------|---------|-----------------------&lt;br /&gt;
 miscellaneous *|  1.0.11 |  /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 |  /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 |  /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o Octave Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
o Octave 725 Page Manual (Version 3.4.0)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
o Statistic Package Function Reference&amp;lt;br&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
o GNU Octave Wiki&amp;lt;br&amp;gt;&lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
o Matlab-Like Tools for HPC (article)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=6525</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=6525"/>
				<updated>2013-05-15T01:40:30Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* Sharing Packages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Octave is provided on SHARCNET clusters  to allow serial or threaded jobs to be run in the queue as described below.&lt;br /&gt;
&lt;br /&gt;
=Version Selection=&lt;br /&gt;
&lt;br /&gt;
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;module avail octave&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing.  Therefore to load octave/3.6.3 one would do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel&lt;br /&gt;
module load octave/3.6.3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Job Submission=&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -o ofile.%J octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Example Job=&lt;br /&gt;
&lt;br /&gt;
This section shows howto submit a  [http://www.gnu.org/software/octave/doc/interpreter/Executable-Octave-Programs.html sample.m] file to the serial queue that accepts  [http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options command line] arguments. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] cat sample.m &lt;br /&gt;
#! /bin/octave -qf&lt;br /&gt;
printf (&amp;quot;%s&amp;quot;, program_name ());&lt;br /&gt;
arg_list = argv ();&lt;br /&gt;
for i = 1:nargin&lt;br /&gt;
    printf (&amp;quot; %s&amp;quot;, arg_list{i});&lt;br /&gt;
endfor&lt;br /&gt;
printf (&amp;quot;\n&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To eliminate exatraneous verbosity in the output file two switches are passed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] sqsub -r 60m -o ofile.%J octave -qf --no-window-system sample.m arg1 arg2 arg3 etc&lt;br /&gt;
WARNING: no memory requirement defined; assuming 2GB per process.&lt;br /&gt;
submitted as jobid 6937872&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output file from the job appears as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@hnd20:~/samples/octave/args] cat ofile.6937872.hnd50&lt;br /&gt;
sample.m arg1 arg2 arg3 etc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=General notes=&lt;br /&gt;
&lt;br /&gt;
==Matlab Compatibility==&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:&lt;br /&gt;
 http://wiki.octave.org/  &lt;br /&gt;
or &amp;quot;Wikibook&amp;quot;:&lt;br /&gt;
 http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB &lt;br /&gt;
provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
==Reading/Writing Files==&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;lt;i&amp;gt;input and output&amp;lt;/i&amp;gt; described in the &amp;quot;Octave manual&amp;quot; viz ...&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output&amp;lt;br&amp;gt; http://www.gnu.org/software/octave/docs.html.&lt;br /&gt;
&lt;br /&gt;
The following stanza demonstrates the &amp;quot;simple file I/O&amp;quot; approach:&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
==Large Memory Array Allocation==&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope has 32gb of unlimited memory the test will be demonstrated there since it should be sufficient to run:&lt;br /&gt;
&lt;br /&gt;
 [mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] module load octave/3.4.0&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] octave&lt;br /&gt;
 GNU Octave, version 3.4.0&lt;br /&gt;
 octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1);  C(N); 3*N &lt;br /&gt;
 ans =  1.2000e+09&lt;br /&gt;
 octave:4&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
==Octave-Forge==&lt;br /&gt;
&lt;br /&gt;
Octave-forge packages are not pre-installed on SHARCNET clusters since none are available at this time for the operating system.  Therefore any required packages must be downloaded, manually installed from source and then managed in local user accounts (as described below).&lt;br /&gt;
&lt;br /&gt;
Note however that 14 of approximately 95 octave-forge packages are installed on the sharcnet visualization workstations (currently just viz1-uwaterloo and viz6-uoguelph) under /usr/share/octave/packages.  As a word of caution however, all package versions will likely be significantly old since they are tied to the operating system fedora /etc/redhat-release major version and hence not contain recent critical bug fixes (which could be numerical in nature).  Users are therefore strongly recommended to likewise download and install the latest version similarly as would be done on the clusters.&lt;br /&gt;
&lt;br /&gt;
===Sharing Packages===&lt;br /&gt;
&lt;br /&gt;
Note that packages installed by a single sharcnet user in their home account can be shared out to other research group members or even among general SHARCNET users.  To do this simply set access permissions for group or global read access accordingly. Details on how the permissions&lt;br /&gt;
can be changed can be found in: https://www.sharcnet.ca/help/index.php/Using_Unix_Overview#Permissions&lt;br /&gt;
&lt;br /&gt;
===Managing Packages===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot; http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. &lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
===Package Commands===&lt;br /&gt;
&lt;br /&gt;
Additional examples of package commands are shown in this section.  For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a package, from a terminal first do:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd ~/octave&lt;br /&gt;
rm -rf linear-algebra-2.2.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... then from within octave do:&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:5&amp;gt;  pkg uninstall linear-algebra&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:6&amp;gt;  pkg list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:7&amp;gt;  pkg load name&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:8&amp;gt;   pkg unload&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:9&amp;gt;  pkg describe -verbose all&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:10&amp;gt;  pkg describe odepkg&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:11&amp;gt;  pkg describe financial -verbose&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:12&amp;gt;   doc sin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:13&amp;gt;   help doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:14&amp;gt;  doc matrix&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:15&amp;gt;  doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Package Example===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named&lt;br /&gt;
  ~/my_octave_packages  &lt;br /&gt;
and the other &lt;br /&gt;
  ~/my_octave_sources &lt;br /&gt;
then download the required three tar.gz files into the latter from &lt;br /&gt;
 http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
 GNU Octave, version 3.4.3&lt;br /&gt;
 octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
 ans = /home/roberpj/my_octave_packages&lt;br /&gt;
 octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
 octave:3&amp;gt; ls&lt;br /&gt;
 miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz   struct-1.0.9.tar.gz&lt;br /&gt;
 octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
 octave:5&amp;gt; pkg list&lt;br /&gt;
 Package Name   | Version | Installation directory&lt;br /&gt;
 ---------------|---------|-----------------------&lt;br /&gt;
 miscellaneous *|  1.0.11 |  /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 |  /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 |  /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o Octave Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
o Octave 725 Page Manual (Version 3.4.0)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
o Statistic Package Function Reference&amp;lt;br&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
o GNU Octave Wiki&amp;lt;br&amp;gt;&lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
o Matlab-Like Tools for HPC (article)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=6499</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=6499"/>
				<updated>2013-05-13T23:06:30Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* Octave-Forge Package Management */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Octave is provided on SHARCNET clusters  to allow serial or threaded jobs to be run in the queue as described below.&lt;br /&gt;
&lt;br /&gt;
=Usage=&lt;br /&gt;
&lt;br /&gt;
==Version Selection==&lt;br /&gt;
&lt;br /&gt;
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;module avail octave&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing.  Therefore to load octave/3.6.3 one would do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel&lt;br /&gt;
module load octave/3.6.3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Job Submission==&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -o ofile.%J octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example Job==&lt;br /&gt;
&lt;br /&gt;
An example job complete with sample .m will be provided here asap.  For now please refer to the sqsub command shown in the previous job submission section.&lt;br /&gt;
&lt;br /&gt;
=General notes=&lt;br /&gt;
&lt;br /&gt;
==Matlab Compatibility==&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:&lt;br /&gt;
 http://wiki.octave.org/  &lt;br /&gt;
or &amp;quot;Wikibook&amp;quot;:&lt;br /&gt;
 http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB &lt;br /&gt;
provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
==Reading/Writing Files==&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;lt;i&amp;gt;input and output&amp;lt;/i&amp;gt; described in the &amp;quot;Octave manual&amp;quot; viz ...&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output&amp;lt;br&amp;gt; http://www.gnu.org/software/octave/docs.html.&lt;br /&gt;
&lt;br /&gt;
The following stanza demonstrates the &amp;quot;simple file I/O&amp;quot; approach:&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
==Large Memory Array Allocation Testing==&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope is recommended for interactive use and has 32gb of memory the test will be demonstrated there:&lt;br /&gt;
&lt;br /&gt;
 [mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] module load octave/3.4.0&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] octave&lt;br /&gt;
 GNU Octave, version 3.4.0&lt;br /&gt;
 octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1);  C(N); 3*N &lt;br /&gt;
 ans =  1.2000e+09&lt;br /&gt;
 octave:4&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
==Octave-Forge Package Management==&lt;br /&gt;
&lt;br /&gt;
Octave-forge packages are NOT pre-installed on SHARCNET systems.  Users must therefore download, install then manage the versions needed for their research.  Note that these packages can be shared among members of a group or even among SHARCNET users. Thus, only one user needs&lt;br /&gt;
to install a package and set the appropriate permissions for members of his group or any other users, so that they can access the package. &lt;br /&gt;
&lt;br /&gt;
An explanation of how to handle this task is provided within this section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;DOWNLOADING AND INSTALLING PACKAGES&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot; http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. &lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;ADDITIONAL EXAMPLES OF PACKAGE COMMANDS&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a package, from a terminal first do:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd ~/octave&lt;br /&gt;
rm -rf linear-algebra-2.2.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... then from within octave do:&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:5&amp;gt;  pkg uninstall linear-algebra&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:6&amp;gt;  pkg list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:7&amp;gt;  pkg load name&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:8&amp;gt;   pkg unload&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:9&amp;gt;  pkg describe -verbose all&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:10&amp;gt;  pkg describe odepkg&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:11&amp;gt;  pkg describe financial -verbose&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:12&amp;gt;   doc sin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:13&amp;gt;   help doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:14&amp;gt;  doc matrix&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:15&amp;gt;  doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;A COMPLETE PACKAGE EXAMPLE&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named&lt;br /&gt;
  ~/my_octave_packages  &lt;br /&gt;
and the other &lt;br /&gt;
  ~/my_octave_sources &lt;br /&gt;
then download the required three tar.gz files into the latter from &lt;br /&gt;
 http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
 GNU Octave, version 3.4.3&lt;br /&gt;
 octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
 ans = /home/roberpj/my_octave_packages&lt;br /&gt;
 octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
 octave:3&amp;gt; ls&lt;br /&gt;
 miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz   struct-1.0.9.tar.gz&lt;br /&gt;
 octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
 octave:5&amp;gt; pkg list&lt;br /&gt;
 Package Name   | Version | Installation directory&lt;br /&gt;
 ---------------|---------|-----------------------&lt;br /&gt;
 miscellaneous *|  1.0.11 |  /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 |  /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 |  /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o Octave Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
o Octave 725 Page Manual (Version 3.4.0)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
o Statistic Package Function Reference&amp;lt;br&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
o GNU Octave Wiki&amp;lt;br&amp;gt;&lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
o Matlab-Like Tools for HPC (article)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=6498</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=6498"/>
				<updated>2013-05-13T22:59:40Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* Octave-Forge Package Management */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Octave is provided on SHARCNET clusters  to allow serial or threaded jobs to be run in the queue as described below.&lt;br /&gt;
&lt;br /&gt;
=Usage=&lt;br /&gt;
&lt;br /&gt;
==Version Selection==&lt;br /&gt;
&lt;br /&gt;
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;module avail octave&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing.  Therefore to load octave/3.6.3 one would do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel&lt;br /&gt;
module load octave/3.6.3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Job Submission==&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -o ofile.%J octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example Job==&lt;br /&gt;
&lt;br /&gt;
An example job complete with sample .m will be provided here asap.  For now please refer to the sqsub command shown in the previous job submission section.&lt;br /&gt;
&lt;br /&gt;
=General notes=&lt;br /&gt;
&lt;br /&gt;
==Matlab Compatibility==&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:&lt;br /&gt;
 http://wiki.octave.org/  &lt;br /&gt;
or &amp;quot;Wikibook&amp;quot;:&lt;br /&gt;
 http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB &lt;br /&gt;
provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
==Reading/Writing Files==&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;lt;i&amp;gt;input and output&amp;lt;/i&amp;gt; described in the &amp;quot;Octave manual&amp;quot; viz ...&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output&amp;lt;br&amp;gt; http://www.gnu.org/software/octave/docs.html.&lt;br /&gt;
&lt;br /&gt;
The following stanza demonstrates the &amp;quot;simple file I/O&amp;quot; approach:&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
==Large Memory Array Allocation Testing==&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope is recommended for interactive use and has 32gb of memory the test will be demonstrated there:&lt;br /&gt;
&lt;br /&gt;
 [mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] module load octave/3.4.0&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] octave&lt;br /&gt;
 GNU Octave, version 3.4.0&lt;br /&gt;
 octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1);  C(N); 3*N &lt;br /&gt;
 ans =  1.2000e+09&lt;br /&gt;
 octave:4&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
==Octave-Forge Package Management==&lt;br /&gt;
&lt;br /&gt;
Octave-forge packages are NOT pre-installed on sharcnet systems.  Users must therefore download, install then manage the versions needed for their research.  An explanation of how to handle this task is provided within this section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;DOWNLOADING AND INSTALLING PACKAGES&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot; http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. &lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;ADDITIONAL EXAMPLES OF PACKAGE COMMANDS&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a package, from a terminal first do:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd ~/octave&lt;br /&gt;
rm -rf linear-algebra-2.2.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... then from within octave do:&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:5&amp;gt;  pkg uninstall linear-algebra&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:6&amp;gt;  pkg list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:7&amp;gt;  pkg load name&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:8&amp;gt;   pkg unload&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:9&amp;gt;  pkg describe -verbose all&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:10&amp;gt;  pkg describe odepkg&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:11&amp;gt;  pkg describe financial -verbose&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:12&amp;gt;   doc sin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:13&amp;gt;   help doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:14&amp;gt;  doc matrix&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:15&amp;gt;  doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;A COMPLETE PACKAGE EXAMPLE&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named&lt;br /&gt;
  ~/my_octave_packages  &lt;br /&gt;
and the other &lt;br /&gt;
  ~/my_octave_sources &lt;br /&gt;
then download the required three tar.gz files into the latter from &lt;br /&gt;
 http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
 GNU Octave, version 3.4.3&lt;br /&gt;
 octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
 ans = /home/roberpj/my_octave_packages&lt;br /&gt;
 octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
 octave:3&amp;gt; ls&lt;br /&gt;
 miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz   struct-1.0.9.tar.gz&lt;br /&gt;
 octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
 octave:5&amp;gt; pkg list&lt;br /&gt;
 Package Name   | Version | Installation directory&lt;br /&gt;
 ---------------|---------|-----------------------&lt;br /&gt;
 miscellaneous *|  1.0.11 |  /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 |  /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 |  /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o Octave Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
o Octave 725 Page Manual (Version 3.4.0)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
o Statistic Package Function Reference&amp;lt;br&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
o GNU Octave Wiki&amp;lt;br&amp;gt;&lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
o Matlab-Like Tools for HPC (article)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=6497</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=6497"/>
				<updated>2013-05-13T22:54:50Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
Octave is provided on SHARCNET clusters  to allow serial or threaded jobs to be run in the queue as described below.&lt;br /&gt;
&lt;br /&gt;
=Usage=&lt;br /&gt;
&lt;br /&gt;
==Version Selection==&lt;br /&gt;
&lt;br /&gt;
To see what versions of Octave are available on sharcnet clusters consult the Availability table on the sharcnet OCTAVE web portal software page OR run the following command directly on a cluster:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;module avail octave&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any octave-forge packages that are to be downloaded and installed into user space are built with the native gcc compiler which is version 4.4.6 at the time of this writing.  Therefore to load octave/3.6.3 one would do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module unload intel&lt;br /&gt;
module load octave/3.6.3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Job Submission==&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -o ofile.%J octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example Job==&lt;br /&gt;
&lt;br /&gt;
An example job complete with sample .m will be provided here asap.  For now please refer to the sqsub command shown in the previous job submission section.&lt;br /&gt;
&lt;br /&gt;
=General notes=&lt;br /&gt;
&lt;br /&gt;
==Matlab Compatibility==&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:&lt;br /&gt;
 http://wiki.octave.org/  &lt;br /&gt;
or &amp;quot;Wikibook&amp;quot;:&lt;br /&gt;
 http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB &lt;br /&gt;
provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
==Reading/Writing Files==&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;lt;i&amp;gt;input and output&amp;lt;/i&amp;gt; described in the &amp;quot;Octave manual&amp;quot; viz ...&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output&amp;lt;br&amp;gt; http://www.gnu.org/software/octave/docs.html.&lt;br /&gt;
&lt;br /&gt;
The following stanza demonstrates the &amp;quot;simple file I/O&amp;quot; approach:&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
==Large Memory Array Allocation Testing==&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope is recommended for interactive use and has 32gb of memory the test will be demonstrated there:&lt;br /&gt;
&lt;br /&gt;
 [mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] module load octave/3.4.0&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] octave&lt;br /&gt;
 GNU Octave, version 3.4.0&lt;br /&gt;
 octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1);  C(N); 3*N &lt;br /&gt;
 ans =  1.2000e+09&lt;br /&gt;
 octave:4&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
==Octave-Forge Package Management==&lt;br /&gt;
&lt;br /&gt;
Octave-forge packages are NOT pre-installed on sharcnet systems.  Users must therefore download, install then manage the versions needed for their research.  An explanation of howto handle this task is provided within this section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;DOWNLOADING AND INSTALLING PACKAGES&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot; http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages available for download that notable are generally only compatible with the latest major release of octave cat be found here http://octave.sourceforge.net/packages.php. &lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;ADDITIONAL EXAMPLES OF PACKAGE COMMANDS&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a package, from a terminal first do:&lt;br /&gt;
&amp;lt;pre&amp;gt;cd ~/octave&lt;br /&gt;
rm -rf linear-algebra-2.2.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... then from within octave do:&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:5&amp;gt;  pkg uninstall linear-algebra&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:6&amp;gt;  pkg list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:7&amp;gt;  pkg load name&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:8&amp;gt;   pkg unload&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:9&amp;gt;  pkg describe -verbose all&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:10&amp;gt;  pkg describe odepkg&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:11&amp;gt;  pkg describe financial -verbose&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:12&amp;gt;   doc sin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:13&amp;gt;   help doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:14&amp;gt;  doc matrix&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;octave:15&amp;gt;  doc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;A COMPLETE PACKAGE EXAMPLE&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named&lt;br /&gt;
  ~/my_octave_packages  &lt;br /&gt;
and the other &lt;br /&gt;
  ~/my_octave_sources &lt;br /&gt;
then download the required three tar.gz files into the latter from &lt;br /&gt;
 http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
 GNU Octave, version 3.4.3&lt;br /&gt;
 octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
 ans = /home/roberpj/my_octave_packages&lt;br /&gt;
 octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
 octave:3&amp;gt; ls&lt;br /&gt;
 miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz   struct-1.0.9.tar.gz&lt;br /&gt;
 octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
 octave:5&amp;gt; pkg list&lt;br /&gt;
 Package Name   | Version | Installation directory&lt;br /&gt;
 ---------------|---------|-----------------------&lt;br /&gt;
 miscellaneous *|  1.0.11 |  /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 |  /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 |  /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
o Octave Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
o Octave 725 Page Manual (Version 3.4.0)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
o Statistic Package Function Reference&amp;lt;br&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
o GNU Octave Wiki&amp;lt;br&amp;gt;&lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
o Matlab-Like Tools for HPC (article)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5718</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5718"/>
				<updated>2013-03-05T18:46:25Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* A COMPLETE PACKAGE EXAMPLE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===LOADING THE OCTAVE MODULE===&lt;br /&gt;
&lt;br /&gt;
For best performance load the latest version of Octave. First use the module command:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
to see what versions of Octave are available.&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any packages that are to be downloaded and installed into user space are built with the native gcc 4.4.6 compiler:&lt;br /&gt;
&lt;br /&gt;
Therefore make a note of what compiler is loaded (let's assume that intel is loaded).&lt;br /&gt;
After loading Octave re-load the compiler module.&lt;br /&gt;
&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load octave/3.6.3&lt;br /&gt;
 module load intel &lt;br /&gt;
&lt;br /&gt;
===RUNNING OCTAVE JOBS IN THE QUEUE===&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -o ofile.%J octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===DOWNLOADING AND INSTALLING PACKAGES===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot;:http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages availble for download can be found &amp;quot;here&amp;quot;:http://octave.sourceforge.net/packages.php however please note these are generally only compatible with the latest major release of octave.&lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from &amp;quot;here&amp;quot;:http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
===ADDITIONAL EXAMPLES OF PACKAGE COMMANDS===&lt;br /&gt;
&lt;br /&gt;
For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To then remove it do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:5&amp;gt;  pkg uninstall linear-algebra&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:6&amp;gt;  pkg list&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:7&amp;gt;  pkg load name&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:8&amp;gt;   pkg unload&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:9&amp;gt;  pkg describe -verbose all&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:10&amp;gt;  pkg describe odepkg&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:11&amp;gt;  pkg describe financial -verbose&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:12&amp;gt;   doc sin&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:13&amp;gt;   help doc&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:14&amp;gt;  doc matrix&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
pre. octave:15&amp;gt;  doc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===READING OR WRITING FILES===&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;quot;input and output&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output described in the &amp;quot;Octave manual&amp;quot;:http://www.gnu.org/software/octave/docs.html.  The following are some demonstrating the &amp;quot;simple file I/O&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO approach&lt;br /&gt;
&lt;br /&gt;
pre. save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
===A COMPLETE PACKAGE EXAMPLE===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named&lt;br /&gt;
  ~/my_octave_packages  &lt;br /&gt;
and the other &lt;br /&gt;
  ~/my_octave_sources &lt;br /&gt;
then download the required three tar.gz files into the latter from &lt;br /&gt;
 http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
 GNU Octave, version 3.4.3&lt;br /&gt;
 octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
 ans = /home/roberpj/my_octave_packages&lt;br /&gt;
 octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
 octave:3&amp;gt; ls&lt;br /&gt;
 miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz   struct-1.0.9.tar.gz&lt;br /&gt;
 octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
 octave:5&amp;gt; pkg list&lt;br /&gt;
 Package Name   | Version | Installation directory&lt;br /&gt;
 ---------------|---------|-----------------------&lt;br /&gt;
 miscellaneous *|  1.0.11 |  /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 |  /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 |  /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===MATLAB COMPATIBILITY===&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:&lt;br /&gt;
 http://wiki.octave.org/  &lt;br /&gt;
or &amp;quot;Wikibook&amp;quot;:&lt;br /&gt;
 http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB &lt;br /&gt;
provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
===LARGE MEMORY ARRAY ALLOCATION TESTING===&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope is recommended for interactive use and has 32gb of memory the test will be demonstrated there:&lt;br /&gt;
&lt;br /&gt;
 [mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] module load octave/3.4.0&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] octave&lt;br /&gt;
 GNU Octave, version 3.4.0&lt;br /&gt;
 octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1);  C(N); 3*N &lt;br /&gt;
 ans =  1.2000e+09&lt;br /&gt;
 octave:4&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
==RERERENCES==&lt;br /&gt;
&lt;br /&gt;
* Octave Homepage&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
* Octave 725 Page Manual (Version 3.4.0)&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
* Statistic Package Function Reference &lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
* GNU Octave Wiki &lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
* Matlab-Like Tools for HPC (article) &lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5717</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5717"/>
				<updated>2013-03-05T17:43:33Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* MATLAB COMPATIBILITY */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===LOADING THE OCTAVE MODULE===&lt;br /&gt;
&lt;br /&gt;
For best performance load the latest version of Octave. First use the module command:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
to see what versions of Octave are available.&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any packages that are to be downloaded and installed into user space are built with the native gcc 4.4.6 compiler:&lt;br /&gt;
&lt;br /&gt;
Therefore make a note of what compiler is loaded (let's assume that intel is loaded).&lt;br /&gt;
After loading Octave re-load the compiler module.&lt;br /&gt;
&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load octave/3.6.3&lt;br /&gt;
 module load intel &lt;br /&gt;
&lt;br /&gt;
===RUNNING OCTAVE JOBS IN THE QUEUE===&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -o ofile.%J octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===DOWNLOADING AND INSTALLING PACKAGES===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot;:http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages availble for download can be found &amp;quot;here&amp;quot;:http://octave.sourceforge.net/packages.php however please note these are generally only compatible with the latest major release of octave.&lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from &amp;quot;here&amp;quot;:http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
===ADDITIONAL EXAMPLES OF PACKAGE COMMANDS===&lt;br /&gt;
&lt;br /&gt;
For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To then remove it do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:5&amp;gt;  pkg uninstall linear-algebra&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:6&amp;gt;  pkg list&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:7&amp;gt;  pkg load name&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:8&amp;gt;   pkg unload&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:9&amp;gt;  pkg describe -verbose all&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:10&amp;gt;  pkg describe odepkg&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:11&amp;gt;  pkg describe financial -verbose&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:12&amp;gt;   doc sin&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:13&amp;gt;   help doc&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:14&amp;gt;  doc matrix&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
pre. octave:15&amp;gt;  doc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===READING OR WRITING FILES===&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;quot;input and output&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output described in the &amp;quot;Octave manual&amp;quot;:http://www.gnu.org/software/octave/docs.html.  The following are some demonstrating the &amp;quot;simple file I/O&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO approach&lt;br /&gt;
&lt;br /&gt;
pre. save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
===A COMPLETE PACKAGE EXAMPLE===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named &amp;lt;i&amp;gt;~/my_octave_packages&amp;lt;/i&amp;gt; and the other &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then download the required three tar.gz files into the latter from http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
ans = /home/roberpj/my_octave_packages&lt;br /&gt;
octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
octave:3&amp;gt; ls&lt;br /&gt;
miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz  struct-1.0.9.tar.gz&lt;br /&gt;
octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
octave:5&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------|---------|-----------------------&lt;br /&gt;
miscellaneous *|  1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===MATLAB COMPATIBILITY===&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:&lt;br /&gt;
 http://wiki.octave.org/  &lt;br /&gt;
or &amp;quot;Wikibook&amp;quot;:&lt;br /&gt;
 http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB &lt;br /&gt;
provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
===LARGE MEMORY ARRAY ALLOCATION TESTING===&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope is recommended for interactive use and has 32gb of memory the test will be demonstrated there:&lt;br /&gt;
&lt;br /&gt;
 [mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] module load octave/3.4.0&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] octave&lt;br /&gt;
 GNU Octave, version 3.4.0&lt;br /&gt;
 octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1);  C(N); 3*N &lt;br /&gt;
 ans =  1.2000e+09&lt;br /&gt;
 octave:4&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
==RERERENCES==&lt;br /&gt;
&lt;br /&gt;
* Octave Homepage&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
* Octave 725 Page Manual (Version 3.4.0)&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
* Statistic Package Function Reference &lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
* GNU Octave Wiki &lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
* Matlab-Like Tools for HPC (article) &lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5716</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5716"/>
				<updated>2013-03-05T17:32:25Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* MATLAB COMPATIBILITY */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===LOADING THE OCTAVE MODULE===&lt;br /&gt;
&lt;br /&gt;
For best performance load the latest version of Octave. First use the module command:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
to see what versions of Octave are available.&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any packages that are to be downloaded and installed into user space are built with the native gcc 4.4.6 compiler:&lt;br /&gt;
&lt;br /&gt;
Therefore make a note of what compiler is loaded (let's assume that intel is loaded).&lt;br /&gt;
After loading Octave re-load the compiler module.&lt;br /&gt;
&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load octave/3.6.3&lt;br /&gt;
 module load intel &lt;br /&gt;
&lt;br /&gt;
===RUNNING OCTAVE JOBS IN THE QUEUE===&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -o ofile.%J octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===DOWNLOADING AND INSTALLING PACKAGES===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot;:http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages availble for download can be found &amp;quot;here&amp;quot;:http://octave.sourceforge.net/packages.php however please note these are generally only compatible with the latest major release of octave.&lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from &amp;quot;here&amp;quot;:http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
===ADDITIONAL EXAMPLES OF PACKAGE COMMANDS===&lt;br /&gt;
&lt;br /&gt;
For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To then remove it do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:5&amp;gt;  pkg uninstall linear-algebra&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:6&amp;gt;  pkg list&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:7&amp;gt;  pkg load name&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:8&amp;gt;   pkg unload&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:9&amp;gt;  pkg describe -verbose all&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:10&amp;gt;  pkg describe odepkg&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:11&amp;gt;  pkg describe financial -verbose&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:12&amp;gt;   doc sin&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:13&amp;gt;   help doc&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:14&amp;gt;  doc matrix&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
pre. octave:15&amp;gt;  doc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===READING OR WRITING FILES===&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;quot;input and output&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output described in the &amp;quot;Octave manual&amp;quot;:http://www.gnu.org/software/octave/docs.html.  The following are some demonstrating the &amp;quot;simple file I/O&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO approach&lt;br /&gt;
&lt;br /&gt;
pre. save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
===A COMPLETE PACKAGE EXAMPLE===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named &amp;lt;i&amp;gt;~/my_octave_packages&amp;lt;/i&amp;gt; and the other &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then download the required three tar.gz files into the latter from http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
ans = /home/roberpj/my_octave_packages&lt;br /&gt;
octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
octave:3&amp;gt; ls&lt;br /&gt;
miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz  struct-1.0.9.tar.gz&lt;br /&gt;
octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
octave:5&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------|---------|-----------------------&lt;br /&gt;
miscellaneous *|  1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===MATLAB COMPATIBILITY===&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:&lt;br /&gt;
 http://wiki.octave.org/wiki.pl?MatlabOctaveCompatibility &lt;br /&gt;
or &amp;quot;Wikibook&amp;quot;:&lt;br /&gt;
 http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB &lt;br /&gt;
provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
===LARGE MEMORY ARRAY ALLOCATION TESTING===&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope is recommended for interactive use and has 32gb of memory the test will be demonstrated there:&lt;br /&gt;
&lt;br /&gt;
 [mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] module load octave/3.4.0&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] octave&lt;br /&gt;
 GNU Octave, version 3.4.0&lt;br /&gt;
 octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1);  C(N); 3*N &lt;br /&gt;
 ans =  1.2000e+09&lt;br /&gt;
 octave:4&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
==RERERENCES==&lt;br /&gt;
&lt;br /&gt;
* Octave Homepage&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
* Octave 725 Page Manual (Version 3.4.0)&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
* Statistic Package Function Reference &lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
* GNU Octave Wiki &lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
* Matlab-Like Tools for HPC (article) &lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5715</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5715"/>
				<updated>2013-03-05T17:30:40Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* LARGE MEMORY ARRAY ALLOCATION TESTING */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===LOADING THE OCTAVE MODULE===&lt;br /&gt;
&lt;br /&gt;
For best performance load the latest version of Octave. First use the module command:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
to see what versions of Octave are available.&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any packages that are to be downloaded and installed into user space are built with the native gcc 4.4.6 compiler:&lt;br /&gt;
&lt;br /&gt;
Therefore make a note of what compiler is loaded (let's assume that intel is loaded).&lt;br /&gt;
After loading Octave re-load the compiler module.&lt;br /&gt;
&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load octave/3.6.3&lt;br /&gt;
 module load intel &lt;br /&gt;
&lt;br /&gt;
===RUNNING OCTAVE JOBS IN THE QUEUE===&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -o ofile.%J octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===DOWNLOADING AND INSTALLING PACKAGES===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot;:http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages availble for download can be found &amp;quot;here&amp;quot;:http://octave.sourceforge.net/packages.php however please note these are generally only compatible with the latest major release of octave.&lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from &amp;quot;here&amp;quot;:http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
===ADDITIONAL EXAMPLES OF PACKAGE COMMANDS===&lt;br /&gt;
&lt;br /&gt;
For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To then remove it do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:5&amp;gt;  pkg uninstall linear-algebra&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:6&amp;gt;  pkg list&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:7&amp;gt;  pkg load name&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:8&amp;gt;   pkg unload&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:9&amp;gt;  pkg describe -verbose all&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:10&amp;gt;  pkg describe odepkg&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:11&amp;gt;  pkg describe financial -verbose&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:12&amp;gt;   doc sin&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:13&amp;gt;   help doc&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:14&amp;gt;  doc matrix&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
pre. octave:15&amp;gt;  doc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===READING OR WRITING FILES===&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;quot;input and output&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output described in the &amp;quot;Octave manual&amp;quot;:http://www.gnu.org/software/octave/docs.html.  The following are some demonstrating the &amp;quot;simple file I/O&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO approach&lt;br /&gt;
&lt;br /&gt;
pre. save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
===A COMPLETE PACKAGE EXAMPLE===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named &amp;lt;i&amp;gt;~/my_octave_packages&amp;lt;/i&amp;gt; and the other &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then download the required three tar.gz files into the latter from http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
ans = /home/roberpj/my_octave_packages&lt;br /&gt;
octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
octave:3&amp;gt; ls&lt;br /&gt;
miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz  struct-1.0.9.tar.gz&lt;br /&gt;
octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
octave:5&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------|---------|-----------------------&lt;br /&gt;
miscellaneous *|  1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===MATLAB COMPATIBILITY===&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:http://wiki.octave.org/wiki.pl?MatlabOctaveCompatibility or &amp;quot;Wikibook&amp;quot;:http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
===LARGE MEMORY ARRAY ALLOCATION TESTING===&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope is recommended for interactive use and has 32gb of memory the test will be demonstrated there:&lt;br /&gt;
&lt;br /&gt;
 [mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] module load octave/3.4.0&lt;br /&gt;
 &lt;br /&gt;
 [tope ~] octave&lt;br /&gt;
 GNU Octave, version 3.4.0&lt;br /&gt;
 octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1);  C(N); 3*N &lt;br /&gt;
 ans =  1.2000e+09&lt;br /&gt;
 octave:4&amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
==RERERENCES==&lt;br /&gt;
&lt;br /&gt;
* Octave Homepage&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
* Octave 725 Page Manual (Version 3.4.0)&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
* Statistic Package Function Reference &lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
* GNU Octave Wiki &lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
* Matlab-Like Tools for HPC (article) &lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5709</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5709"/>
				<updated>2013-03-04T22:12:42Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* DOWNLOADING AND INSTALLING PACKAGES */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===LOADING THE OCTAVE MODULE===&lt;br /&gt;
&lt;br /&gt;
For best performance load the latest version of Octave. First use the module command:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
to see what versions of Octave are available.&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any packages that are to be downloaded and installed into user space are built with the native gcc 4.4.6 compiler:&lt;br /&gt;
&lt;br /&gt;
Therefore make a note of what compiler is loaded (let's assume that intel is loaded).&lt;br /&gt;
After loading Octave re-load the compiler module.&lt;br /&gt;
&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load octave/3.6.3&lt;br /&gt;
 module load intel &lt;br /&gt;
&lt;br /&gt;
===RUNNING OCTAVE JOBS IN THE QUEUE===&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -o ofile.%J octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===DOWNLOADING AND INSTALLING PACKAGES===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot;:http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages availble for download can be found &amp;quot;here&amp;quot;:http://octave.sourceforge.net/packages.php however please note these are generally only compatible with the latest major release of octave.&lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download an older version of a package from &amp;quot;here&amp;quot;:http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
===ADDITIONAL EXAMPLES OF PACKAGE COMMANDS===&lt;br /&gt;
&lt;br /&gt;
For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To then remove it do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:5&amp;gt;  pkg uninstall linear-algebra&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:6&amp;gt;  pkg list&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:7&amp;gt;  pkg load name&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:8&amp;gt;   pkg unload&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:9&amp;gt;  pkg describe -verbose all&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:10&amp;gt;  pkg describe odepkg&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:11&amp;gt;  pkg describe financial -verbose&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:12&amp;gt;   doc sin&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:13&amp;gt;   help doc&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:14&amp;gt;  doc matrix&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
pre. octave:15&amp;gt;  doc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===READING OR WRITING FILES===&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;quot;input and output&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output described in the &amp;quot;Octave manual&amp;quot;:http://www.gnu.org/software/octave/docs.html.  The following are some demonstrating the &amp;quot;simple file I/O&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO approach&lt;br /&gt;
&lt;br /&gt;
pre. save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
===A COMPLETE PACKAGE EXAMPLE===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named &amp;lt;i&amp;gt;~/my_octave_packages&amp;lt;/i&amp;gt; and the other &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then download the required three tar.gz files into the latter from http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
ans = /home/roberpj/my_octave_packages&lt;br /&gt;
octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
octave:3&amp;gt; ls&lt;br /&gt;
miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz  struct-1.0.9.tar.gz&lt;br /&gt;
octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
octave:5&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------|---------|-----------------------&lt;br /&gt;
miscellaneous *|  1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===MATLAB COMPATIBILITY===&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:http://wiki.octave.org/wiki.pl?MatlabOctaveCompatibility or &amp;quot;Wikibook&amp;quot;:http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
===LARGE MEMORY ARRAY ALLOCATION TESTING===&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope is recommended for interactive use and has 32gb of memory the test will be demonstrated there:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
&lt;br /&gt;
[tope ~] module load octave/3.4.0&lt;br /&gt;
&lt;br /&gt;
[tope ~] octave&lt;br /&gt;
GNU Octave, version 3.4.0&lt;br /&gt;
octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N &lt;br /&gt;
ans =  1.2000e+09&lt;br /&gt;
&lt;br /&gt;
[tope ~] top&lt;br /&gt;
24985 roberpj   24   0 9406m 9.0g  12m S  0.0 32.6   0:34.34 octave&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RERERENCES==&lt;br /&gt;
&lt;br /&gt;
* Octave Homepage&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
* Octave 725 Page Manual (Version 3.4.0)&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
* Statistic Package Function Reference &lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
* GNU Octave Wiki &lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
* Matlab-Like Tools for HPC (article) &lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5708</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5708"/>
				<updated>2013-03-04T22:11:31Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* DOWNLOAD AND INSTALLING PACKAGES */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===LOADING THE OCTAVE MODULE===&lt;br /&gt;
&lt;br /&gt;
For best performance load the latest version of Octave. First use the module command:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
to see what versions of Octave are available.&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any packages that are to be downloaded and installed into user space are built with the native gcc 4.4.6 compiler:&lt;br /&gt;
&lt;br /&gt;
Therefore make a note of what compiler is loaded (let's assume that intel is loaded).&lt;br /&gt;
After loading Octave re-load the compiler module.&lt;br /&gt;
&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load octave/3.6.3&lt;br /&gt;
 module load intel &lt;br /&gt;
&lt;br /&gt;
===RUNNING OCTAVE JOBS IN THE QUEUE===&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -o ofile.%J octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===DOWNLOADING AND INSTALLING PACKAGES===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot;:http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages availble for download can be found &amp;quot;here&amp;quot;:http://octave.sourceforge.net/packages.php however please note these are generally only compatible with the latest major release of octave.&lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download the an older version of a package from &amp;quot;here&amp;quot;:http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
===ADDITIONAL EXAMPLES OF PACKAGE COMMANDS===&lt;br /&gt;
&lt;br /&gt;
For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To then remove it do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:5&amp;gt;  pkg uninstall linear-algebra&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:6&amp;gt;  pkg list&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:7&amp;gt;  pkg load name&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:8&amp;gt;   pkg unload&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:9&amp;gt;  pkg describe -verbose all&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:10&amp;gt;  pkg describe odepkg&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:11&amp;gt;  pkg describe financial -verbose&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:12&amp;gt;   doc sin&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:13&amp;gt;   help doc&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:14&amp;gt;  doc matrix&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
pre. octave:15&amp;gt;  doc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===READING OR WRITING FILES===&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;quot;input and output&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output described in the &amp;quot;Octave manual&amp;quot;:http://www.gnu.org/software/octave/docs.html.  The following are some demonstrating the &amp;quot;simple file I/O&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO approach&lt;br /&gt;
&lt;br /&gt;
pre. save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
===A COMPLETE PACKAGE EXAMPLE===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named &amp;lt;i&amp;gt;~/my_octave_packages&amp;lt;/i&amp;gt; and the other &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then download the required three tar.gz files into the latter from http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
ans = /home/roberpj/my_octave_packages&lt;br /&gt;
octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
octave:3&amp;gt; ls&lt;br /&gt;
miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz  struct-1.0.9.tar.gz&lt;br /&gt;
octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
octave:5&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------|---------|-----------------------&lt;br /&gt;
miscellaneous *|  1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===MATLAB COMPATIBILITY===&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:http://wiki.octave.org/wiki.pl?MatlabOctaveCompatibility or &amp;quot;Wikibook&amp;quot;:http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
===LARGE MEMORY ARRAY ALLOCATION TESTING===&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope is recommended for interactive use and has 32gb of memory the test will be demonstrated there:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
&lt;br /&gt;
[tope ~] module load octave/3.4.0&lt;br /&gt;
&lt;br /&gt;
[tope ~] octave&lt;br /&gt;
GNU Octave, version 3.4.0&lt;br /&gt;
octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N &lt;br /&gt;
ans =  1.2000e+09&lt;br /&gt;
&lt;br /&gt;
[tope ~] top&lt;br /&gt;
24985 roberpj   24   0 9406m 9.0g  12m S  0.0 32.6   0:34.34 octave&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RERERENCES==&lt;br /&gt;
&lt;br /&gt;
* Octave Homepage&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
* Octave 725 Page Manual (Version 3.4.0)&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
* Statistic Package Function Reference &lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
* GNU Octave Wiki &lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
* Matlab-Like Tools for HPC (article) &lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5707</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5707"/>
				<updated>2013-03-04T22:10:09Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===LOADING THE OCTAVE MODULE===&lt;br /&gt;
&lt;br /&gt;
For best performance load the latest version of Octave. First use the module command:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
to see what versions of Octave are available.&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any packages that are to be downloaded and installed into user space are built with the native gcc 4.4.6 compiler:&lt;br /&gt;
&lt;br /&gt;
Therefore make a note of what compiler is loaded (let's assume that intel is loaded).&lt;br /&gt;
After loading Octave re-load the compiler module.&lt;br /&gt;
&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load octave/3.6.3&lt;br /&gt;
 module load intel &lt;br /&gt;
&lt;br /&gt;
===RUNNING OCTAVE JOBS IN THE QUEUE===&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -o ofile.%J octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===DOWNLOAD AND INSTALLING PACKAGES===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot;:http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages availble for download can be found &amp;quot;here&amp;quot;:http://octave.sourceforge.net/packages.php however please note these are generally only compatible with the latest major release of octave.&lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download the an older version of a package from &amp;quot;here&amp;quot;:http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ADDITIONAL EXAMPLES OF PACKAGE COMMANDS===&lt;br /&gt;
&lt;br /&gt;
For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To then remove it do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:5&amp;gt;  pkg uninstall linear-algebra&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:6&amp;gt;  pkg list&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:7&amp;gt;  pkg load name&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:8&amp;gt;   pkg unload&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:9&amp;gt;  pkg describe -verbose all&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:10&amp;gt;  pkg describe odepkg&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:11&amp;gt;  pkg describe financial -verbose&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:12&amp;gt;   doc sin&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:13&amp;gt;   help doc&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:14&amp;gt;  doc matrix&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
pre. octave:15&amp;gt;  doc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===READING OR WRITING FILES===&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;quot;input and output&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output described in the &amp;quot;Octave manual&amp;quot;:http://www.gnu.org/software/octave/docs.html.  The following are some demonstrating the &amp;quot;simple file I/O&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO approach&lt;br /&gt;
&lt;br /&gt;
pre. save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
===A COMPLETE PACKAGE EXAMPLE===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named &amp;lt;i&amp;gt;~/my_octave_packages&amp;lt;/i&amp;gt; and the other &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then download the required three tar.gz files into the latter from http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
ans = /home/roberpj/my_octave_packages&lt;br /&gt;
octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
octave:3&amp;gt; ls&lt;br /&gt;
miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz  struct-1.0.9.tar.gz&lt;br /&gt;
octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
octave:5&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------|---------|-----------------------&lt;br /&gt;
miscellaneous *|  1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===MATLAB COMPATIBILITY===&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:http://wiki.octave.org/wiki.pl?MatlabOctaveCompatibility or &amp;quot;Wikibook&amp;quot;:http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
===LARGE MEMORY ARRAY ALLOCATION TESTING===&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope is recommended for interactive use and has 32gb of memory the test will be demonstrated there:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
&lt;br /&gt;
[tope ~] module load octave/3.4.0&lt;br /&gt;
&lt;br /&gt;
[tope ~] octave&lt;br /&gt;
GNU Octave, version 3.4.0&lt;br /&gt;
octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N &lt;br /&gt;
ans =  1.2000e+09&lt;br /&gt;
&lt;br /&gt;
[tope ~] top&lt;br /&gt;
24985 roberpj   24   0 9406m 9.0g  12m S  0.0 32.6   0:34.34 octave&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RERERENCES==&lt;br /&gt;
&lt;br /&gt;
* Octave Homepage&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
* Octave 725 Page Manual (Version 3.4.0)&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
* Statistic Package Function Reference &lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
* GNU Octave Wiki &lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
* Matlab-Like Tools for HPC (article) &lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5706</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5706"/>
				<updated>2013-03-04T20:17:52Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: /* LOADING THE OCTAVE MODULE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===LOADING THE OCTAVE MODULE===&lt;br /&gt;
&lt;br /&gt;
For best performance load the latest version of Octave. First use the module command:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
to see what versions of Octave are available.&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the Octave module.  This is done to ensure any packages that are to be downloaded and installed into user space are built with the native gcc 4.4.6 compiler:&lt;br /&gt;
&lt;br /&gt;
Therefore make a note of what compiler is loaded (let's assume that intel is loaded).&lt;br /&gt;
After loading Octave re-load the compiler module.&lt;br /&gt;
&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load octave/3.6.3&lt;br /&gt;
 module load intel &lt;br /&gt;
&lt;br /&gt;
===RUNNING OCTAVE JOBS IN THE QUEUE===&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs can be submitted to the serial queue using following sqsub command:&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -o ofile.%J octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 sqsub -r 60m -n 8 -q threaded --mpp=1G -o  ofile.%J time octave mycode.m&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===DOWNLOAD AND INSTALLING PACKAGES===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot;:http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages availble for download can be found &amp;quot;here&amp;quot;:http://octave.sourceforge.net/packages.php however please note these are generally only compatible with the latest major release of octave.&lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download the an older version of a package from &amp;quot;here&amp;quot;:http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ADDITIONAL EXAMPLES OF PACKAGE COMMANDS===&lt;br /&gt;
&lt;br /&gt;
For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To then remove it do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:5&amp;gt;  pkg uninstall linear-algebra&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:6&amp;gt;  pkg list&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:7&amp;gt;  pkg load name&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:8&amp;gt;   pkg unload&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:9&amp;gt;  pkg describe -verbose all&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:10&amp;gt;  pkg describe odepkg&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:11&amp;gt;  pkg describe financial -verbose&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:12&amp;gt;   doc sin&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:13&amp;gt;   help doc&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:14&amp;gt;  doc matrix&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
pre. octave:15&amp;gt;  doc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===READING OR WRITING FILES===&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;quot;input and output&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output described in the &amp;quot;Octave manual&amp;quot;:http://www.gnu.org/software/octave/docs.html.  The following are some demonstrating the &amp;quot;simple file I/O&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO approach&lt;br /&gt;
&lt;br /&gt;
pre. save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
===A COMPLETE PACKAGE EXAMPLE===&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named &amp;lt;i&amp;gt;~/my_octave_packages&amp;lt;/i&amp;gt; and the other &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then download the required three tar.gz files into the latter from http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [roberpj@orc-login1:~] module unload octave&lt;br /&gt;
 [roberpj@orc-login1:~] module load octave&lt;br /&gt;
 [roberpj@orc-login1:~] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
ans = /home/roberpj/my_octave_packages&lt;br /&gt;
octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
octave:3&amp;gt; ls&lt;br /&gt;
miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz  struct-1.0.9.tar.gz&lt;br /&gt;
octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
octave:5&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------|---------|-----------------------&lt;br /&gt;
miscellaneous *|  1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===MATLAB COMPATIBILITY===&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:http://wiki.octave.org/wiki.pl?MatlabOctaveCompatibility or &amp;quot;Wikibook&amp;quot;:http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
===LARGE MEMORY ARRAY ALLOCATION TESTING===&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope is recommended for interactive use and has 32gb of memory the test will be demonstrated there:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
&lt;br /&gt;
[tope ~] module load octave/3.4.0&lt;br /&gt;
&lt;br /&gt;
[tope ~] octave&lt;br /&gt;
GNU Octave, version 3.4.0&lt;br /&gt;
octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N &lt;br /&gt;
ans =  1.2000e+09&lt;br /&gt;
&lt;br /&gt;
[tope ~] top&lt;br /&gt;
24985 roberpj   24   0 9406m 9.0g  12m S  0.0 32.6   0:34.34 octave&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Octave Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
o Octave 725 Page Manual (Version 3.4.0)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
o Statistic Package Function Reference&amp;lt;br&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
o GNU Octave Wiki&amp;lt;br&amp;gt;&lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
o Matlab-Like Tools for HPC (article)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	<entry>
		<id>https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5705</id>
		<title>OCTAVE</title>
		<link rel="alternate" type="text/html" href="https://www.sharcnet.ca/help/index.php?title=OCTAVE&amp;diff=5705"/>
				<updated>2013-03-04T19:12:12Z</updated>
		
		<summary type="html">&lt;p&gt;Nickc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Software&lt;br /&gt;
|package_name=OCTAVE&lt;br /&gt;
|package_description=Mostly compatible language with Matlab primarily intended for numerical computations&lt;br /&gt;
|package_idnumber=28&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===LOADING THE OCTAVE MODULE===&lt;br /&gt;
&lt;br /&gt;
For best performance load the latest version of octave. First use the module command:&lt;br /&gt;
&lt;br /&gt;
 module avail&lt;br /&gt;
&lt;br /&gt;
to see what versions of octave are available.&lt;br /&gt;
Starting with version 3.6.3 its necessary to first unload the intel compiler module (or any other compiler that might be loaded) before loading the octave module.  This is done to ensure any packages that are to be downloaded and installed into user space are built with the native gcc 4.4.6 compiler:&lt;br /&gt;
&lt;br /&gt;
Therefore make a note of what compiler is loaded (let's assume that intel is loaded).&lt;br /&gt;
After loading octave re-load the compiler module.&lt;br /&gt;
&lt;br /&gt;
 module unload intel&lt;br /&gt;
 module load octave/3.6.3&lt;br /&gt;
 module load intel &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;RUNNING OCTAVE JOBS IN THE QUEUE&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On SHARCNET clusters Octave should only be run via the queuing system.  Octave serial jobs bas best submitted to the serial queue on kraken assuming they use less than 1gb by doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sqsub -r 60m -f wha -o ofile.%J octave mycode.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of version 3.4.3 the sharcnet octave installation supports multi-threading which based on initial testing lapack/blas intensive octave jobs run in the threaded queue achieve an order of magnitude speedup compared to running single core jobs in the serial queue, without making any changes to your code.  Once the optimal number of processors is determined by scaling tests submit the job to the threaded queue for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sqsub -r 60m -n 8 -q threaded --mpp=1G -o ofile.%J time octave mycode.m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;DOWNLOAD AND INSTALLING PACKAGES&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Octave Forge&amp;quot;:http://octave.sourceforge.net/ project provides extra packages for use with octave that can be downloaded into a directory such as &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then manually installed into your own sharcnet account as will be shown in the follow example.  A current list of packages availble for download can be found &amp;quot;here&amp;quot;:http://octave.sourceforge.net/packages.php however please note these are generally only compatible with the latest major release of octave.&lt;br /&gt;
&lt;br /&gt;
In the event where the major version of octave on sharcnet you are using (for instance 3.4.x) is not the same as latest major version (at the time of writing 3.6.x) and there were programming api changes between the two versions that effect the package you want to use, then you probably will need to download the an older version of a package from &amp;quot;here&amp;quot;:http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/. for it to work.&lt;br /&gt;
 &lt;br /&gt;
To help estimate the package version required as a starting point, consider the major release dates of recent which are octave-3.4.3 (10/10/11), octave-3.6.0 (01/15/12), octave-3.6.1 (02/22/12) and finally octave-3.6.2 (05/31/12).  Next consider you want to download the latest geometry package that was compatible with  octave-3.4.3 at the time of its release, then simply display all the archived versions as shown in the following stanza and pick the last available geometry release date before the next major release octave-3.6.0 (01/15/12).   To show a list of all archived geometry versions, do the following steps:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/&lt;br /&gt;
Click Packages on top menu menu bar&lt;br /&gt;
Scroll down to the miscellaneous package row and click details&lt;br /&gt;
Click (older versions) located below &amp;quot;Download Package&amp;quot;&lt;br /&gt;
Click Octave Forge Packages&lt;br /&gt;
Click  Individual Package Releases&lt;br /&gt;
Please wait for the page to load ...&lt;br /&gt;
Click &amp;quot;Name&amp;quot; at the top of first colum to sort packages alphabetically&lt;br /&gt;
Scroll down you will find all available archived geometry packages:&lt;br /&gt;
 geometry-1.0.1.tar.gz  2011-09-27&lt;br /&gt;
 geometry-1.1.1.tar.gz  2011-10-06&lt;br /&gt;
 geometry-1.1.2.tar.gz  2011-10-09&lt;br /&gt;
 geometry-1.1.3.tar.gz  2011-10-13&lt;br /&gt;
 geometry-1.1.tar.gz    2011-10-04&lt;br /&gt;
 geometry-1.2.0.tar.gz  2011-10-22&lt;br /&gt;
 geometry-1.2.1.tar.gz  2011-11-02&lt;br /&gt;
 geometry-1.2.2.tar.gz  2011-11-04&lt;br /&gt;
 geometry-1.4.0.tar.gz  2012-01-25&lt;br /&gt;
 geometry-1.4.1.tar.gz  2012-03-24&lt;br /&gt;
 geometry-1.5.0.tar.gz  2012-06-05&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore you will download geometry-1.2.2.tar.gz (2011-11-04) since the next&lt;br /&gt;
release geometry-1.4.0.tar.gz (2012-01-25) and then install it into octave&lt;br /&gt;
3.4.3 as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@tope:~/my_octave_sources] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg install geometry-1.2.2.tar.gz&lt;br /&gt;
octave:2&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------+---------+-----------------------&lt;br /&gt;
     geometry  |   1.2.2 | /home/roberpj/octave/geometry-1.2.2&lt;br /&gt;
octave:15&amp;gt; pkg load geometry&lt;br /&gt;
octave:16&amp;gt; pkg describe geometry&lt;br /&gt;
---&lt;br /&gt;
Package name:&lt;br /&gt;
        geometry&lt;br /&gt;
Version:&lt;br /&gt;
        1.2.2&lt;br /&gt;
Short description:&lt;br /&gt;
        Library for geometric computing extending MatGeom functions. Useful to create,&lt;br /&gt;
transform, manipulate and display geometric primitives.&lt;br /&gt;
Status:&lt;br /&gt;
        Loaded&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any questions regarding package version compatibility with major or minor octave release should be referred to the developers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;ADDITIONAL EXAMPLES OF PACKAGE COMMANDS&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For demonstration purpose linear-algebra will first be downloaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[roberpj@iqaluk:~] mkdir my_octave_sources&lt;br /&gt;
[roberpj@iqaluk:~] cd my_octave_sources&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/general-1.3.2.tar.gz&lt;br /&gt;
  wget http://downloads.sourceforge.net/octave/linear-algebra-2.2.0.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[myusername@orc-login1:~]octave&lt;br /&gt;
&lt;br /&gt;
octave:1&amp;gt;  help pkg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To install a package such as linear-algebra do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
octave:2&amp;gt;  cd ~/my_octave_sources&lt;br /&gt;
octave:3&amp;gt;  pkg install  general-1.3.2.tar.gz&lt;br /&gt;
octave:4&amp;gt;  pkg install linear-algebra-2.2.0.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To then remove it do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:5&amp;gt;  pkg uninstall linear-algebra&lt;br /&gt;
&lt;br /&gt;
To list all installed packages do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:6&amp;gt;  pkg list&lt;br /&gt;
&lt;br /&gt;
To add a named packages to your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:7&amp;gt;  pkg load name&lt;br /&gt;
&lt;br /&gt;
To remove a named package from your path:&lt;br /&gt;
&lt;br /&gt;
pre. octave:8&amp;gt;   pkg unload&lt;br /&gt;
&lt;br /&gt;
To list all functions provided by a package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:9&amp;gt;  pkg describe -verbose all&lt;br /&gt;
&lt;br /&gt;
To list functions provide by extra odepkg package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:10&amp;gt;  pkg describe odepkg&lt;br /&gt;
&lt;br /&gt;
To list functions details for extra financial package:&lt;br /&gt;
&lt;br /&gt;
pre. octave:11&amp;gt;  pkg describe financial -verbose&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as sin do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:12&amp;gt;   doc sin&lt;br /&gt;
&lt;br /&gt;
To get help using the doc command do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:13&amp;gt;   help doc&lt;br /&gt;
&lt;br /&gt;
To get documentation for a topic such as matrix do:&lt;br /&gt;
&lt;br /&gt;
pre. octave:14&amp;gt;  doc matrix&lt;br /&gt;
&lt;br /&gt;
To get documentation for any topic run the doc command alone:&lt;br /&gt;
&lt;br /&gt;
pre. octave:15&amp;gt;  doc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;READING OR WRITING FILES&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are two strategies for handling file &amp;quot;input and output&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Input-and-Output.html#Input-and-Output described in the &amp;quot;Octave manual&amp;quot;:http://www.gnu.org/software/octave/docs.html.  The following are some demonstrating the &amp;quot;simple file I/O&amp;quot;:http://www.gnu.org/software/octave/doc/interpreter/Simple-File-I_002fO.html#Simple-File-I_002fO approach&lt;br /&gt;
&lt;br /&gt;
pre. save myiofile.dat A B C&lt;br /&gt;
save (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
save (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load myiofile.dat&lt;br /&gt;
load (&amp;quot;-text&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
load (&amp;quot;-binary&amp;quot;, &amp;quot;myiofile.dat&amp;quot;, &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
where A, B and C are a potential mix of entities such as scalars, vectors or matrices.  Note that for large files the binary format is strongly recommended to both minimize disk space and file read/write wallclock times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;A COMPLETE PACKAGE EXAMPLE&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example assumes you first create two directories in your home account one being named &amp;lt;i&amp;gt;~/my_octave_packages&amp;lt;/i&amp;gt; and the other &amp;lt;i&amp;gt;~/my_octave_sources&amp;lt;/i&amp;gt; then download the required three tar.gz files into the latter from http://octave.sourceforge.net/packages.php ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
[roberpj@orc-login1:~] module unload octave&lt;br /&gt;
[roberpj@orc-login1:~] module load octave&lt;br /&gt;
[roberpj@orc-login1:~] octave&lt;br /&gt;
GNU Octave, version 3.4.3&lt;br /&gt;
octave:1&amp;gt; pkg prefix ~/my_octave_packages&lt;br /&gt;
ans = /home/roberpj/my_octave_packages&lt;br /&gt;
octave:2&amp;gt; cd my_octave_sources&lt;br /&gt;
octave:3&amp;gt; ls&lt;br /&gt;
miscellaneous-1.0.11.tar.gz  optim-1.0.17.tar.gz  struct-1.0.9.tar.gz&lt;br /&gt;
octave:4&amp;gt; pkg install miscellaneous-1.0.11.tar.gz optim-1.0.17.tar.gz struct-1.0.9.tar.gz&lt;br /&gt;
octave:5&amp;gt; pkg list&lt;br /&gt;
Package Name   | Version | Installation directory&lt;br /&gt;
---------------|---------|-----------------------&lt;br /&gt;
miscellaneous *|  1.0.11 | /home/roberpj/my_octave_packages/miscellaneous-1.0.11&lt;br /&gt;
        optim *|  1.0.17 | /home/roberpj/my_octave_packages/optim-1.0.17&lt;br /&gt;
       struct *|   1.0.9 | /home/roberpj/my_octave_packages/struct-1.0.9&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;U&amp;gt;MATLAB COMPATIBILITY&amp;lt;/U&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The online wiki resources &amp;quot;Octave Wiki&amp;quot;:http://wiki.octave.org/wiki.pl?MatlabOctaveCompatibility or &amp;quot;Wikibook&amp;quot;:http://en.wikibooks.org/wiki/MATLAB_Programming/Differences_between_Octave_and_MATLAB provide good introductory explanations of code compatibility between Octave and Matlab.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;LARGE MEMORY ARRAY ALLOCATION TESTING&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following command sequence should successfully run on hound or tope.  Since tope is recommended for interactive use and has 32gb of memory the test will be demonstrated there:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[mypc ~] ssh tope.sharcnet.ca&lt;br /&gt;
&lt;br /&gt;
[tope ~] module load octave/3.4.0&lt;br /&gt;
&lt;br /&gt;
[tope ~] octave&lt;br /&gt;
GNU Octave, version 3.4.0&lt;br /&gt;
octave:3&amp;gt; N=4e8; A=[1:N]; B=[2*(1:N)]; C=A+B; C(1); C(N); 3*N &lt;br /&gt;
ans =  1.2000e+09&lt;br /&gt;
&lt;br /&gt;
[tope ~] top&lt;br /&gt;
24985 roberpj   24   0 9406m 9.0g  12m S  0.0 32.6   0:34.34 octave&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
o Octave Homepage&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/&lt;br /&gt;
&lt;br /&gt;
o Octave 725 Page Manual (Version 3.4.0)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.gnu.org/software/octave/doc/interpreter/&lt;br /&gt;
&lt;br /&gt;
o Statistic Package Function Reference&amp;lt;br&amp;gt;&lt;br /&gt;
http://octave.sourceforge.net/doc/funref_statistics.html&lt;br /&gt;
&lt;br /&gt;
o GNU Octave Wiki&amp;lt;br&amp;gt;&lt;br /&gt;
http://wiki.octave.org/&lt;br /&gt;
&lt;br /&gt;
o Matlab-Like Tools for HPC (article)&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.admin-magazine.com/HPC/Articles/Matlab-Like-Tools-for-HPC&lt;/div&gt;</summary>
		<author><name>Nickc</name></author>	</entry>

	</feed>