next up previous
Next: A new code for Up: annexe1 Previous: Description of useful MPI

General Framework

/*
 * MPI-2: Out-of-Core Matrix Product - Framework of the MPI-2 implementation
 * http://www.pdc.kth.se/training/Talks/SMP/maui98/jpprost/ex2_c_incomp.htm
 *
 * Author: Jean-Pierre Prost
 * Email: jpprost@us.ibm.com
 * Home Page: http://www.research.ibm.com/people/p/prost
*/

#define P          4              /* number of tasks       */
#define Nb         64             /* slice size            */
#define Ng         ( Nb * P )     /* global size of matrix */

....

    colext = Nb * extent;
    slicelen = Ng * Nb;
    sliceext = slicelen * extent;

    /* create filetype for matrix A */
    /* TO BE COMPLETED */

    /* create filetype for matrix B */
    /* TO BE COMPLETED */
    
    /* create filetype for matrix C */
    /* TO BE COMPLETED */

    /* open files */
    /* TO BE COMPLETED */

    /* set views */
    /* TO BE COMPLETED */

    /* read horizontal slice of A */
    /* TO BE COMPLETED */

    /* loop on vertical slices */
    for ( iv = 0; iv < P; iv++ ) {

      /* read next vertical slice of B */
      /* TO BE COMPLETED */

      /* compute block product */
      for ( i = 0; i < Nb; i++ ) {
        for ( j = 0; j < Nb; j++ ) {
          val_C[ i ][ j ] = 0;
          for ( k = 0; k < Ng; k++ ) {
            val_C[ i ][ j ] += val_A[ i ][ k ] * val_B[ k ][ j ];
          }
        }
      }

      /* write block of C */ 
      /* TO BE COMPLETED */

    }

    /* close files */
    /* TO BE COMPLETED */



Christophe Cérin 2002-09-16