Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > DKU > DKU__Matrix_Mult__Bench
view Matrix_Mult.h @ 0:d138e0acf9a0
Initial add of standard DKU matrix mult code -- to be modified
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Sun, 26 Aug 2012 03:04:50 -0700 |
| parents | |
| children |
line source
1 /*
2 * Copyright Oct 24, 2009 OpenSourceCodeStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 */
6 #ifndef MATRIX_MULT_H_
7 #define MATRIX_MULT_H_
9 #include <stdio.h>
11 #include "../BLIS/BLIS_primitive_data_types.h"
13 #include "ParamHelper/Param.h"
15 //============================== Structures ==============================
17 typedef
18 struct
19 { int32 numRows;
20 int32 numCols;
21 float32 *matrix; //2D, but dynamically sized, so use addr arith
22 }
23 Matrix;
25 /* This is the "appSpecificPiece" that is carried inside a DKUPiece.
26 * In the DKUPiece data struc it is declared to be of type "void *". This
27 * allows the application to define any data structure it wants and put it
28 * into a DKUPiece.
29 * When the app specific info is used, it is in app code, so it is cast to
30 * the correct type to tell the compiler how to access fields.
31 * This keeps all app-specific things out of the DKU directory, as per the
32 * DKU standard. */
33 typedef
34 struct
35 {
36 // pointers to shared data.. the result matrix must be created when the
37 // left and right matrices are put into the root ancestor DKUPiece.
38 Matrix * leftMatrix;
39 Matrix * rightMatrix;
40 Matrix * resultMatrix;
42 // define the starting and ending boundaries for this piece of the
43 // result matrix. These are derivable from the left and right
44 // matrices, but included them for readability of code.
45 int prodStartRow, prodEndRow;
46 int prodStartCol, prodEndCol;
47 // Start and end of the portion of the left matrix that contributes to
48 // this piece of the product
49 int leftStartRow, leftEndRow;
50 int leftStartCol, leftEndCol;
51 // Start and end of the portion of the right matrix that contributes to
52 // this piece of the product
53 int rightStartRow, rightEndRow;
54 int rightStartCol, rightEndCol;
55 }
56 MatrixProdPiece;
58 //============================== Functions ================================
59 void readFile();
61 Matrix *makeMatrix( int32 numRows, int32 numCols );
62 Matrix *makeMatrix_Flat( int32 numRows, int32 numCols );
63 void freeMatrix_Flat( Matrix * matrix );
64 void freeMatrix( Matrix * matrix );
66 MatrixProdPiece *
67 makeMatrixProdPiece_Empty();
68 MatrixProdPiece *
69 makeMatrixProdPiece_FromMatrixProdPiece( MatrixProdPiece * piece );
70 MatrixProdPiece *
71 makeMatrixProdPiece_FromMatrices( Matrix *leftMatrix, Matrix *rightMatrix );
73 void read_Matrix_From_File( Matrix *matrixStruc, char *matrixFileName );
75 void freeMatrixProdPiece_Flat( MatrixProdPiece * piece );
76 void freeMatrixProdPiece( MatrixProdPiece * piece );
79 //===========================================================================
81 #endif /*MATRIX_MULT_H_*/
