Fortran double precision matrix multiplication using MIC

Fortran double precision matrix multiplication using MIC

Can someone send us an example makefile which uses the Fortran compiler and mkl to multiple 2 double precision matrices and compiles for mic.

We want to run this program on mic only (for testing). 

We have no problems to compile and run on the main processor!

Thanks, Renate

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Here you go, a very simple example.This is how you build it for native execution on Xeon Phi (assuming you have Intel Fotran Composer XE installed on your system):

 ifort -mmic -I$MKLROOT/include dgemm_example.f -L$MKLROOT/lib/mic -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -L$MKLROOT/../compiler/lib/mic -liomp5 -lpthread -lm

C   Copyright(C) 2012 Intel Corporation. All Rights Reserved.
C   The source code, information  and  material ("Material") contained herein is
C   owned  by Intel Corporation or its suppliers or licensors, and title to such
C   Material remains  with Intel Corporation  or its suppliers or licensors. The
C   Material  contains proprietary information  of  Intel or  its  suppliers and
C   licensors. The  Material is protected by worldwide copyright laws and treaty
C   provisions. No  part  of  the  Material  may  be  used,  copied, reproduced,
C   modified, published, uploaded, posted, transmitted, distributed or disclosed
C   in any way  without Intel's  prior  express written  permission. No  license
C   under  any patent, copyright  or  other intellectual property rights  in the
C   Material  is  granted  to  or  conferred  upon  you,  either  expressly,  by
C   implication, inducement,  estoppel or  otherwise.  Any  license  under  such
C   intellectual  property  rights must  be express  and  approved  by  Intel in
C   writing.
C   *Third Party trademarks are the property of their respective owners.
C   Unless otherwise  agreed  by Intel  in writing, you may not remove  or alter
C   this  notice or  any other notice embedded  in Materials by Intel or Intel's
C   suppliers or licensors in any way.

*   In this simple example memory management, data alignment, I/O, etc.
*   that are necessary for a good programming style are omitted to
*   improve readability.


      INCLUDE ""

      INTEGER          I, J, K, N
      PARAMETER        (N=200)
*      Executable Statements
*      Set input data
      ALPHA = 1.0
      BETA = 0.0
      DO I = 1, N
        DO J = 1, N
          A(I,J) = (I-1) * N + J
          B(I,J) = -((I-1) * N + J)
          A(I,J) = 0.0
          B(I,J) = 0.0
          C(I,J) = 0.0
        END DO
      END DO

      PRINT *, "Start!"
*      Call DGEMM subroutine
      PRINT *, "Finished!"


Leave a Comment

Please sign in to add a comment. Not a member? Join today