Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VReo > Reo__Matrix_Mult
changeset 0:c4b1849c05ef
init add
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/Matrix_Mult.c Sun Feb 02 17:58:41 2014 -0800 1.3 @@ -0,0 +1,165 @@ 1.4 +/* 1.5 + * Copyright 2009 OpenSourceStewardshipFoundation.org 1.6 + * Licensed under GNU General Public License version 2 1.7 + * 1.8 + * Author: seanhalle@yahoo.com 1.9 + * 1.10 + * Created on November 15, 2009, 2:35 AM 1.11 + */ 1.12 + 1.13 +#include <malloc.h> 1.14 +#include <stdlib.h> 1.15 + 1.16 +#include "Matrix_Mult.h" 1.17 +#include "ParamHelper/Param.h" 1.18 + 1.19 +void 1.20 +initialize_Input_Matrices_Via( Matrix **leftMatrix, Matrix **rightMatrix, 1.21 + ParamBag *paramBag ) 1.22 + { char *leftMatrixFileName, *rightMatrixFileName; 1.23 + int leftMatrixRows, leftMatrixCols, rightMatrixRows, rightMatrixCols; 1.24 + 1.25 + ParamStruc *param; 1.26 + param = getParamFromBag( "leftMatrixRows", paramBag ); 1.27 + leftMatrixRows = param->intValue; 1.28 + param = getParamFromBag( "leftMatrixCols", paramBag ); 1.29 + leftMatrixCols = param->intValue; 1.30 + *leftMatrix = makeMatrix_WithResMat( leftMatrixRows, leftMatrixCols ); 1.31 + 1.32 + param = getParamFromBag( "leftMatrixFileName", paramBag ); 1.33 + leftMatrixFileName = param->strValue; //no need to copy 1.34 + read_Matrix_From_File( *leftMatrix, leftMatrixFileName ); 1.35 + 1.36 + param = getParamFromBag( "rightMatrixRows", paramBag ); 1.37 + rightMatrixRows = param->intValue; 1.38 + param = getParamFromBag( "rightMatrixCols", paramBag ); 1.39 + rightMatrixCols = param->intValue; 1.40 + *rightMatrix = makeMatrix_WithResMat( rightMatrixRows, rightMatrixCols ); 1.41 + 1.42 + param = getParamFromBag( "rightMatrixFileName", paramBag ); 1.43 + rightMatrixFileName = param->strValue; 1.44 + read_Matrix_From_File( *rightMatrix, rightMatrixFileName ); 1.45 + } 1.46 + 1.47 + 1.48 +void parseLineIntoRow( char *line, float32* row ); 1.49 + 1.50 + 1.51 + void 1.52 +read_Matrix_From_File( Matrix *matrixStruc, char *matrixFileName ) 1.53 + { int row, maxRead, numRows, numCols; 1.54 + float32 *matrixStart; 1.55 + size_t lineSz = 0; 1.56 + FILE *file; 1.57 + char *line = NULL; 1.58 + 1.59 + lineSz = 50000; //max length of line in a matrix data file 1.60 + line = (char *) malloc( lineSz ); 1.61 + if( line == NULL ) printf( "no mem for matrix line" ); 1.62 + 1.63 + numRows = matrixStruc->numRows; 1.64 + numCols = matrixStruc->numCols; 1.65 + matrixStart = matrixStruc->array; 1.66 + 1.67 + file = fopen( matrixFileName, "r" ); 1.68 + if( file == NULL ) { printf( "\nCouldn't open file!!\n"); exit(1);} 1.69 + fseek( file, 0, SEEK_SET ); 1.70 + for( row = 0; row < numRows; row++ ) 1.71 + { 1.72 + if( feof( file ) ) printf( "file ran out too soon" ); 1.73 + maxRead = getline( &line, &lineSz, file ); 1.74 + if( maxRead == -1 ) printf( "prob reading mat line"); 1.75 + 1.76 + if( *line == '\n') continue; //blank line 1.77 + if( *line == '/' ) continue; //comment line 1.78 + 1.79 + parseLineIntoRow( line, matrixStart + row * numCols ); 1.80 + } 1.81 + free( line ); 1.82 + } 1.83 + 1.84 +/*This function relies on each line having the proper number of cols. It 1.85 + * doesn't check, nor enforce, so if the file is improperly formatted it 1.86 + * can write over unrelated memory 1.87 + */ 1.88 + void 1.89 +parseLineIntoRow( char *line, float32* row ) 1.90 + { 1.91 + char *valueStr, *searchPos; 1.92 + 1.93 + //read the float values 1.94 + searchPos = valueStr = line; //start 1.95 + 1.96 + for( ; *searchPos != 0; searchPos++) //bit dangerous, should use buff len 1.97 + { 1.98 + if( *searchPos == '\n' ) //last col.. relying on well-formatted file 1.99 + { *searchPos = 0; 1.100 + *row = atof( valueStr ); 1.101 + break; //end FOR loop 1.102 + } 1.103 + if( *searchPos == ',' ) 1.104 + { *searchPos = 0; //mark end of string 1.105 + *row = (float32) atof( valueStr ); 1.106 + row += 1; //address arith 1.107 + //skip any spaces before digits.. use searchPos + 1 to skip the 0 1.108 + for( ; *(searchPos + 1)== ' ' && *(searchPos + 1) !=0; searchPos++); 1.109 + valueStr = searchPos + 1; 1.110 + } 1.111 + } 1.112 + } 1.113 + 1.114 + //========================================================================== 1.115 + 1.116 +/*In the "_Flat" version of constructor, do only malloc of the top data struc 1.117 + * and set values in that top-level. Don't malloc any sub-structures. 1.118 + */ 1.119 + Matrix * 1.120 +makeMatrix_Flat( int32 numRows, int32 numCols ) 1.121 + { Matrix * retMatrix; 1.122 + retMatrix = malloc( sizeof( Matrix ) ); 1.123 + retMatrix->numRows = numRows; 1.124 + retMatrix->numCols = numCols; 1.125 + 1.126 + return retMatrix; 1.127 + } 1.128 + 1.129 + Matrix * 1.130 +makeMatrix_WithResMat( int32 numRows, int32 numCols ) 1.131 + { Matrix * retMatrix; 1.132 + retMatrix = malloc( sizeof( Matrix ) ); 1.133 + retMatrix->numRows = numRows; 1.134 + retMatrix->numCols = numCols; 1.135 + retMatrix->array = malloc( numRows * numCols * sizeof(float32) ); 1.136 + 1.137 + return retMatrix; 1.138 + } 1.139 + 1.140 + void 1.141 +freeMatrix_Flat( Matrix * matrix ) 1.142 + { //( matrix ); 1.143 + } 1.144 + void 1.145 +freeMatrix( Matrix * matrix ) 1.146 + { free( matrix->array ); 1.147 + free( matrix ); 1.148 + } 1.149 + 1.150 +void 1.151 +printMatrix( Matrix *matrix ) 1.152 + { int r, c, numRows, numCols, rowsToPrint, colsToPrint, rowIncr, colIncr; 1.153 + float32 *matrixArray; 1.154 + 1.155 + numRows = rowsToPrint = matrix->numRows; 1.156 + numCols = colsToPrint = matrix->numCols; 1.157 + matrixArray = matrix->array; 1.158 + 1.159 + rowIncr = numRows/20; if(rowIncr == 0) rowIncr = 1;//20 to 39 rows printed 1.160 + colIncr = numCols/20; if(colIncr == 0) colIncr = 1;//20 to 39 cols printed 1.161 + for( r = 0; r < numRows; r += rowIncr ) 1.162 + { for( c = 0; c < numCols; c += colIncr ) 1.163 + { printf( "%3.1f | ", matrixArray[ r * numCols + c ] ); 1.164 + } 1.165 + printf("\n"); 1.166 + } 1.167 + } 1.168 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/Matrix_Mult.h Sun Feb 02 17:58:41 2014 -0800 2.3 @@ -0,0 +1,76 @@ 2.4 +/* 2.5 + * Copyright Oct 24, 2009 OpenSourceCodeStewardshipFoundation.org 2.6 + * Licensed under GNU General Public License version 2 2.7 + */ 2.8 + 2.9 +#ifndef MATRIX_MULT_H_ 2.10 +#define MATRIX_MULT_H_ 2.11 + 2.12 +#include <stdio.h> 2.13 +#include <unistd.h> 2.14 +#include <malloc.h> 2.15 + 2.16 +#include "ParamHelper/Param.h" 2.17 + 2.18 +//============================== Structures ============================== 2.19 + 2.20 +typedef 2.21 +struct 2.22 + { int32 numRows; 2.23 + int32 numCols; 2.24 + float32 *array; //2D, but dynamically sized, so use addr arith 2.25 + } 2.26 +Matrix; 2.27 + 2.28 +/* This is the "appSpecificPiece" that is carried inside a DKUPiece. 2.29 + * In the DKUPiece data struc it is declared to be of type "void *". This 2.30 + * allows the application to define any data structure it wants and put it 2.31 + * into a DKUPiece. 2.32 + * When the app specific info is used, it is in app code, so it is cast to 2.33 + * the correct type to tell the compiler how to access fields. 2.34 + * This keeps all app-specific things out of the DKU directory, as per the 2.35 + * DKU standard. */ 2.36 +typedef 2.37 +struct 2.38 + { 2.39 + // pointers to shared data.. the result matrix must be created when the 2.40 + // left and right matrices are put into the root ancestor DKUPiece. 2.41 + Matrix * leftMatrix; 2.42 + Matrix * rightMatrix; 2.43 + Matrix * resultMatrix; 2.44 + 2.45 + // define the starting and ending boundaries for this piece of the 2.46 + // result matrix. These are derivable from the left and right 2.47 + // matrices, but included them for readability of code. 2.48 + int prodStartRow, prodEndRow; 2.49 + int prodStartCol, prodEndCol; 2.50 + // Start and end of the portion of the left matrix that contributes to 2.51 + // this piece of the product 2.52 + int leftStartRow, leftEndRow; 2.53 + int leftStartCol, leftEndCol; 2.54 + // Start and end of the portion of the right matrix that contributes to 2.55 + // this piece of the product 2.56 + int rightStartRow, rightEndRow; 2.57 + int rightStartCol, rightEndCol; 2.58 + } 2.59 +MatrixProdPiece; 2.60 + 2.61 +//============================== Functions ================================ 2.62 +void readFile(); 2.63 + 2.64 +Matrix *makeMatrix( int32 numRows, int32 numCols ); 2.65 +Matrix *makeMatrix_Flat( int32 numRows, int32 numCols ); 2.66 +Matrix *makeMatrix_WithResMat( int32 numRows, int32 numCols ); 2.67 +void freeMatrix_Flat( Matrix * matrix ); 2.68 +void freeMatrix( Matrix * matrix ); 2.69 +void printMatrix( Matrix *matrix ); 2.70 + 2.71 +void read_Matrix_From_File( Matrix *matrixStruc, char *matrixFileName ); 2.72 + 2.73 +void 2.74 +initialize_Input_Matrices_Via( Matrix **leftMatrix, Matrix **rightMatrix, 2.75 + ParamBag *paramBag ); 2.76 + 2.77 +//=========================================================================== 2.78 + 2.79 +#endif /*MATRIX_MULT_H_*/
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/ParamHelper/Param.h Sun Feb 02 17:58:41 2014 -0800 3.3 @@ -0,0 +1,56 @@ 3.4 +/* 3.5 + * 3.6 + * Author: SeanHalle@yahoo.com 3.7 + * 3.8 + * Created on November 19, 2009, 6:30 PM 3.9 + */ 3.10 + 3.11 +#ifndef _PARAM_H 3.12 +#define _PARAM_H 3.13 + 3.14 +typedef 3.15 +struct 3.16 + { int type; 3.17 + int intValue; 3.18 + char * strValue; 3.19 + float floatValue; 3.20 + } 3.21 +ParamStruc; 3.22 + 3.23 +#define INT_PARAM_TYPE 0 3.24 +#define STRING_PARAM_TYPE 1 3.25 +#define FLOAT_PARAM_TYPE 2 3.26 + 3.27 +#define PARAM_BAG_HASHSIZE 1024 3.28 + 3.29 +typedef struct _ParamBagHashEntry ParamBagHashEntry; 3.30 + 3.31 +struct _ParamBagHashEntry 3.32 + { 3.33 + char *key; 3.34 + ParamStruc *param; 3.35 + struct _ParamBagHashEntry *next; 3.36 + } 3.37 +/*ParamBagHashEntry*/; 3.38 + 3.39 + 3.40 +typedef 3.41 +struct 3.42 + { int bagSz; 3.43 + ParamBagHashEntry* *entries; 3.44 + } 3.45 +ParamBag; 3.46 + 3.47 + 3.48 +ParamBag *makeParamBag(); 3.49 +void readParamFileIntoBag( char *paramFileName, ParamBag * bag ); 3.50 +ParamStruc *getParamFromBag( char *key, ParamBag * bag ); 3.51 +int addParamToBag( char* key, ParamStruc *param, ParamBag *bag ); 3.52 +void freeParamBag( ParamBag *bag ); 3.53 +//char *paramBagToString( ParamBag * bag ); 3.54 +ParamStruc *makeParamStruc(); 3.55 +ParamStruc *makeParamFromStrs( char * type, char *value ); 3.56 +ssize_t getline( char **lineptr, size_t *n, FILE *stream ); 3.57 + 3.58 +#endif /* _PARAM_H */ 3.59 +
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/ParamHelper/ParamBag.c Sun Feb 02 17:58:41 2014 -0800 4.3 @@ -0,0 +1,203 @@ 4.4 +/* 4.5 + * Copyright 2009 OpenSourceStewardshipFoundation.org 4.6 + * Licensed under GNU General Public License version 2 4.7 + * 4.8 + * Based on code posted to a discussion group on the web. (Forgot to mark 4.9 + * down where got it from) 4.10 + * 4.11 + * Author: seanhalle@yahoo.com 4.12 + * 4.13 + * Created on November 14, 2009, 9:00 PM 4.14 + */ 4.15 +#include <string.h> 4.16 +#include <stdio.h> 4.17 +#include <stdlib.h> 4.18 + 4.19 +#include "Param.h" 4.20 + 4.21 +void freeParamStruc( ParamStruc * param ); 4.22 +void freeParamBagHashEntry( ParamBagHashEntry *entry ); 4.23 +ParamBagHashEntry * lookupKeyInHash( char *key, ParamBag * bag ); 4.24 +unsigned int hashThisKey( char *s, int hashSz ); 4.25 +void nullOutParamBagHashEntries( ParamBag *bag ); 4.26 + 4.27 + ParamBag * 4.28 +makeParamBag() 4.29 + { ParamBag * retBag; 4.30 + retBag = malloc( sizeof( ParamBag ) ); 4.31 + retBag->entries = malloc( PARAM_BAG_HASHSIZE * sizeof( ParamBagHashEntry *) ); 4.32 + retBag->bagSz = PARAM_BAG_HASHSIZE; 4.33 + nullOutParamBagHashEntries( retBag ); 4.34 + 4.35 + return retBag; 4.36 + } 4.37 + 4.38 + void 4.39 +nullOutParamBagHashEntries( ParamBag *bag ) 4.40 + { int i, bagSz; 4.41 + bagSz = bag->bagSz; 4.42 + ParamBagHashEntry ** entries = bag->entries; 4.43 + for( i = 0; i < bagSz; i++ ) 4.44 + entries[ i ] = NULL; 4.45 + } 4.46 + 4.47 + unsigned int 4.48 +hashKey( char *s, int hashSz ) 4.49 + { unsigned int h = 0; 4.50 + 4.51 + for( ; *s != 0; s++ ) 4.52 + h = *s + h*31; 4.53 + return h % hashSz; 4.54 + } 4.55 + 4.56 +/*Need this to be separated out, for use in both getParam and putParam 4.57 + */ 4.58 + ParamBagHashEntry * 4.59 +lookupKeyInHash( char *key, ParamBag * bag ) 4.60 + { unsigned int 4.61 + hashIndex = hashKey( key, bag->bagSz ); 4.62 + ParamBagHashEntry* 4.63 + hashEntry = bag->entries[ hashIndex ]; 4.64 + for( ; hashEntry != NULL; hashEntry = hashEntry->next ) 4.65 + { if( strcmp( hashEntry->key, key ) == 0 ) return hashEntry; 4.66 + } 4.67 + return NULL; 4.68 + } 4.69 + 4.70 + ParamStruc * 4.71 +getParamFromBag( char *key, ParamBag * bag ) 4.72 + { ParamBagHashEntry *entry; 4.73 + entry = lookupKeyInHash( key, bag ); 4.74 + if( entry == NULL ) return NULL; 4.75 + 4.76 + return entry->param; 4.77 + } 4.78 + 4.79 + int 4.80 +addParamToBag( char* key, ParamStruc *param, ParamBag *bag ) 4.81 + { unsigned int hashIdx; 4.82 + ParamBagHashEntry* hashEntry; 4.83 + hashEntry = lookupKeyInHash( key, bag ); 4.84 + if( hashEntry == NULL ) 4.85 + { hashIdx = hashKey( key, bag->bagSz ); 4.86 + hashEntry = (ParamBagHashEntry*) malloc( sizeof( ParamBagHashEntry ) ); 4.87 + if( hashEntry == NULL ) return 0; 4.88 + hashEntry->key = strdup( key ); 4.89 + if( hashEntry->key == NULL ) return 0; 4.90 + hashEntry->next = (bag->entries)[hashIdx]; 4.91 + (bag->entries)[hashIdx] = hashEntry; 4.92 + } 4.93 + else 4.94 + { freeParamStruc( hashEntry->param ); 4.95 + } 4.96 + hashEntry->param = param; 4.97 + return 1; 4.98 + } 4.99 + 4.100 + 4.101 + void 4.102 +freeParamBag( ParamBag *bag ) 4.103 + { int i; 4.104 + ParamBagHashEntry *hashEntry, *temp, **entries; 4.105 + 4.106 + entries = bag->entries; 4.107 + for( i=0; i < bag->bagSz; i++ ) 4.108 + { if( entries[i] != NULL ) 4.109 + { hashEntry = entries[i]; 4.110 + while( hashEntry != NULL ) 4.111 + { 4.112 + temp = hashEntry->next; 4.113 + freeParamBagHashEntry( hashEntry ); 4.114 + hashEntry = temp; 4.115 + } 4.116 + } 4.117 + } 4.118 + } 4.119 + 4.120 + void 4.121 +freeParamBagHashEntry( ParamBagHashEntry *entry ) 4.122 + { 4.123 + freeParamStruc( entry->param ); 4.124 + free( entry->key ); //was malloc'd above, so free it 4.125 + free( entry ); 4.126 + } 4.127 + 4.128 + void 4.129 +freeParamStruc( ParamStruc * param ) 4.130 + { if( param->type == STRING_PARAM_TYPE ) free( param->strValue ); 4.131 + free( param ); 4.132 + } 4.133 + 4.134 + ParamStruc * 4.135 +makeParamStruc() 4.136 + { ParamStruc *retStruc; 4.137 + retStruc = malloc( sizeof( ParamStruc ) ); 4.138 + retStruc->floatValue = 0.0; 4.139 + retStruc->intValue = 0; 4.140 + retStruc->strValue = NULL; 4.141 + 4.142 + return retStruc; 4.143 + } 4.144 + 4.145 +void 4.146 +removeEndWhtSpaceFromStr( char *str ) 4.147 + { int n; 4.148 + 4.149 + n = strlen ( str ); 4.150 + while( --n >= 0 ) 4.151 + { 4.152 + if(str[n] != ' ' && str[n] != '\t' && str[n] != '\n' && str[n] != '\r') 4.153 + break; 4.154 + } 4.155 + str[n + 1] = '\0'; 4.156 + } 4.157 + 4.158 + 4.159 +ParamStruc * 4.160 +makeParamFromStrs( char * type, char *value ) 4.161 + { ParamStruc *retParam; 4.162 + retParam = makeParamStruc(); 4.163 + switch(*type) 4.164 + { case 'i': 4.165 + { retParam->type = INT_PARAM_TYPE; 4.166 + retParam->intValue = atoi( value ); 4.167 + } break; 4.168 + case 's': 4.169 + { retParam->type = STRING_PARAM_TYPE; 4.170 + retParam->strValue = malloc( strlen(value) + 1); 4.171 + strcpy( retParam->strValue, value ); 4.172 + removeEndWhtSpaceFromStr( retParam->strValue ); 4.173 + } break; 4.174 + case 'f': 4.175 + { retParam->type = FLOAT_PARAM_TYPE; 4.176 + retParam->floatValue = atof( value ); 4.177 + } break; 4.178 + } 4.179 + return retParam; 4.180 + } 4.181 + 4.182 + 4.183 +/* A pretty useless but good debugging function, 4.184 + which simply displays the hashtable in (key.value) pairs 4.185 +*/ 4.186 +/*void paramBagToString( ParamBag * bag ) 4.187 + { int i; 4.188 + ParamBagHashEntry *t; 4.189 + for( i = 0; i < bag->bagSz; i++ ) 4.190 + { t = entries[i]; 4.191 + if( t == NULL ) 4.192 + strcat_m( retStr, &"()" ); 4.193 + else 4.194 + { strcat_m( retStr, &"(" ); 4.195 + for( ; t != NULL; t = t->next ) 4.196 + { strcat_m( retStr, &" " ); 4.197 + strcat_m( retStr, t->key ); 4.198 + strcat_m( retStr, &"." ); 4.199 + strcat_m( retStr, paramToString( t->param ) ); 4.200 + strcat_m( retStr, &" " ); 4.201 + } 4.202 + strcat_m( retStr, &")" ); 4.203 + } 4.204 + } 4.205 + } 4.206 +*/
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/ParamHelper/ReadParamsFromFile.c Sun Feb 02 17:58:41 2014 -0800 5.3 @@ -0,0 +1,110 @@ 5.4 +/* 5.5 + * Author: SeanHalle@yahoo.com 5.6 + * 5.7 + * Created on June 15, 2009, 10:12 AM 5.8 + */ 5.9 + 5.10 +#include <stdio.h> 5.11 +#include <stdlib.h> 5.12 +#include <string.h> 5.13 + 5.14 +#include "../Matrix_Mult.h" 5.15 + 5.16 +ParamStruc * makeParamFromStrs( char * type, char *value ); 5.17 + 5.18 +#define _GNU_SOURCE 5.19 + 5.20 +/*Copied from gnu's win32 lib 5.21 + */ 5.22 + ssize_t 5.23 +getline( char **lineptr, size_t *n, FILE *stream ) 5.24 + { 5.25 + if ( lineptr == NULL || n == NULL) return -1; 5.26 + if (*lineptr == NULL || *n == 0) 5.27 + { *n = 500; //max length of line in a config file 5.28 + *lineptr = (char *) malloc( *n ); 5.29 + if (*lineptr == NULL) return -1; 5.30 + } 5.31 + if( fgets( *lineptr, *n, stream ) ) 5.32 + return *n; 5.33 + else 5.34 + return -1; 5.35 + } 5.36 + 5.37 + void 5.38 +readParamFileIntoBag( char *paramFileName, ParamBag * bag ) 5.39 + { 5.40 + size_t lineSz = 0; 5.41 + FILE* paramFile; 5.42 + char* line = NULL; 5.43 + 5.44 + char* paramType;// = malloc( 12 ); //"double" is the longest type 5.45 + char* paramName;// = malloc( 500 ); //max of 500 chars in name 5.46 + char* paramValue;// = malloc( 500 ); //max of 500 chars in value 5.47 + 5.48 + lineSz = 500; //max length of line in a config file 5.49 + line = (char *) malloc( lineSz ); 5.50 + if( line == NULL ) 5.51 + { printf( "\nIn readParamFileIntoBag: no mem for line\n" ); 5.52 + return; 5.53 + } 5.54 + 5.55 + 5.56 + paramFile = fopen( paramFileName, "r" ); 5.57 + if( paramFile == NULL ) {printf("\ncouldn't open file\n"); exit(0);} 5.58 + fseek( paramFile, 0, SEEK_SET ); 5.59 + while( !feof( paramFile ) ) 5.60 + { while( getline( &line, &lineSz, paramFile ) != -1 ) 5.61 + { 5.62 + char *lineEnd = line + strlen(line) +1; 5.63 + char *searchPos = line; 5.64 + 5.65 + if( *line == '\n') continue; //blank line 5.66 + if( *line == '/' ) continue; //comment line 5.67 + 5.68 + //read the param type 5.69 + paramType = line; //start of string 5.70 + int foundIt = 0; 5.71 + for( ; searchPos < lineEnd && !foundIt; searchPos++) 5.72 + { if( *searchPos == ',' ) 5.73 + { foundIt = 1; 5.74 + *searchPos = 0; //mark end of string 5.75 + } 5.76 + } 5.77 + //get rid of leading spaces 5.78 + for( ; searchPos < lineEnd; searchPos++) 5.79 + { if( *searchPos != ' ' ) break; 5.80 + } 5.81 + //read the param name 5.82 + paramName = searchPos; 5.83 + foundIt = 0; 5.84 + for( ; searchPos < lineEnd && !foundIt; searchPos++) 5.85 + { if( *searchPos == ',' ) 5.86 + { foundIt = 1; 5.87 + *searchPos = 0; //mark end 5.88 + } 5.89 + } 5.90 + //get rid of leading spaces 5.91 + for( ; searchPos < lineEnd; searchPos++) 5.92 + { if( *searchPos != ' ' ) break; 5.93 + } 5.94 + //read the param value 5.95 + paramValue = searchPos; 5.96 + foundIt = 0; 5.97 + for( ; searchPos < lineEnd && !foundIt; searchPos++) 5.98 + { if( *searchPos == '\n' ) 5.99 + { foundIt = 1; 5.100 + *searchPos = 0; //mark end 5.101 + } 5.102 + } 5.103 + if( foundIt ) 5.104 + { printf("Found: %s, %s, %s\n", paramType, paramName, paramValue ); 5.105 + ParamStruc * 5.106 + paramStruc = makeParamFromStrs( paramType, paramValue ); 5.107 + addParamToBag( paramName, paramStruc, bag ); 5.108 + } 5.109 + } 5.110 + } 5.111 + free( line ); 5.112 + } 5.113 +
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/Reo__Matrix_Mult/Circuit.c Sun Feb 02 17:58:41 2014 -0800 6.3 @@ -0,0 +1,938 @@ 6.4 +#include <math.h> 6.5 +#include <string.h> 6.6 +#include "VReo__Test_App.h" 6.7 +#include "Circuit.h" 6.8 + 6.9 +VReoCircuit *create_circuit(SlaveVP *animVP) { 6.10 + 6.11 + /* Declare variables. */ 6.12 + VReoCircuit *circuit; 6.13 + VReoBridge *bridge, *bridges, **boundaryBridges; 6.14 + VReoIsland *islands, *island; 6.15 + VReoO1island *o1islands, *o1island; 6.16 + VReoCheckerFn *bridgeReaderCheckerFns, *bridgeWriterCheckerFns; 6.17 + VReoDoerFn *bridgeReaderDoerFns, *bridgeWriterDoerFns; 6.18 + PrivQueueStruc *offerQ0, *offerQ1; 6.19 + VReoPartnerQStruct *partnerQStruct0, *partnerQStruct1; 6.20 + 6.21 + /* Allocate memory for bridges, islands, and the circuit. */ 6.22 + bridges = PR_WL__malloc(NUM_BRIDGES * sizeof(VReoBridge)); 6.23 + islands = PR_WL__malloc((NUM_ISLANDS == 0 ? 1 : NUM_ISLANDS) * sizeof(VReoIsland)); 6.24 + o1islands = PR_WL__malloc((NUM_O1ISLANDS == 0 ? 1 : NUM_O1ISLANDS) * sizeof(VReoO1island)); 6.25 + circuit = (VReoCircuit *) PR_WL__malloc(sizeof(VReoCircuit)); 6.26 + 6.27 + // 6.28 + // INITIALIZE BRIDGES 6.29 + // 6.30 + 6.31 + /* Initialize bridge Broad_0. */ 6.32 + bridge = &(bridges[CKT_BRIDGE_Broad_0]); 6.33 + bridge->buffer = NULL; 6.34 + bridge->bridgeIsFull = FALSE; 6.35 + bridge->waitingReaderVP = NULL; 6.36 + bridge->waitingWriterVP = NULL; 6.37 + bridge->readerPartnerQStruct = NULL; 6.38 + bridge->writerPartnerQStruct = NULL; 6.39 + 6.40 + /* Initialize bridge In_0. */ 6.41 + bridge = &(bridges[CKT_BRIDGE_In_0]); 6.42 + bridge->buffer = NULL; 6.43 + bridge->bridgeIsFull = FALSE; 6.44 + bridge->waitingReaderVP = NULL; 6.45 + bridge->waitingWriterVP = NULL; 6.46 + bridge->readerPartnerQStruct = NULL; 6.47 + bridge->writerPartnerQStruct = NULL; 6.48 + 6.49 + /* Initialize bridge In_1. */ 6.50 + bridge = &(bridges[CKT_BRIDGE_In_1]); 6.51 + bridge->buffer = NULL; 6.52 + bridge->bridgeIsFull = FALSE; 6.53 + bridge->waitingReaderVP = NULL; 6.54 + bridge->waitingWriterVP = NULL; 6.55 + bridge->readerPartnerQStruct = NULL; 6.56 + bridge->writerPartnerQStruct = NULL; 6.57 + 6.58 + /* Initialize bridge Out_0. */ 6.59 + bridge = &(bridges[CKT_BRIDGE_Out_0]); 6.60 + bridge->buffer = NULL; 6.61 + bridge->bridgeIsFull = FALSE; 6.62 + bridge->waitingReaderVP = NULL; 6.63 + bridge->waitingWriterVP = NULL; 6.64 + bridge->readerPartnerQStruct = NULL; 6.65 + bridge->writerPartnerQStruct = NULL; 6.66 + 6.67 + /* Initialize bridge Out_1. */ 6.68 + bridge = &(bridges[CKT_BRIDGE_Out_1]); 6.69 + bridge->buffer = NULL; 6.70 + bridge->bridgeIsFull = FALSE; 6.71 + bridge->waitingReaderVP = NULL; 6.72 + bridge->waitingWriterVP = NULL; 6.73 + bridge->readerPartnerQStruct = NULL; 6.74 + bridge->writerPartnerQStruct = NULL; 6.75 + 6.76 + /* Initialize bridge FIFO0. */ 6.77 + bridge = &(bridges[CKT_BRIDGE_FIFO0]); 6.78 + bridge->buffer = NULL; 6.79 + bridge->bridgeIsFull = FALSE; 6.80 + bridge->waitingReaderVP = NULL; 6.81 + bridge->waitingWriterVP = NULL; 6.82 + bridge->readerPartnerQStruct = NULL; 6.83 + bridge->writerPartnerQStruct = NULL; 6.84 + 6.85 + /* Initialize bridge FIFO1. */ 6.86 + bridge = &(bridges[CKT_BRIDGE_FIFO1]); 6.87 + bridge->buffer = malloc(1); 6.88 + bridge->bridgeIsFull = TRUE; 6.89 + bridge->waitingReaderVP = NULL; 6.90 + bridge->waitingWriterVP = NULL; 6.91 + bridge->readerPartnerQStruct = NULL; 6.92 + bridge->writerPartnerQStruct = NULL; 6.93 + 6.94 + /* Initialize bridge FIFO2. */ 6.95 + bridge = &(bridges[CKT_BRIDGE_FIFO2]); 6.96 + bridge->buffer = NULL; 6.97 + bridge->bridgeIsFull = FALSE; 6.98 + bridge->waitingReaderVP = NULL; 6.99 + bridge->waitingWriterVP = NULL; 6.100 + bridge->readerPartnerQStruct = NULL; 6.101 + bridge->writerPartnerQStruct = NULL; 6.102 + 6.103 + /* Initialize bridge FIFO3. */ 6.104 + bridge = &(bridges[CKT_BRIDGE_FIFO3]); 6.105 + bridge->buffer = malloc(1); 6.106 + bridge->bridgeIsFull = TRUE; 6.107 + bridge->waitingReaderVP = NULL; 6.108 + bridge->waitingWriterVP = NULL; 6.109 + bridge->readerPartnerQStruct = NULL; 6.110 + bridge->writerPartnerQStruct = NULL; 6.111 + 6.112 + /* Initialize boundary bridges. */ 6.113 + boundaryBridges = PR_WL__malloc(NUM_BOUNDARY_BRIDGES * sizeof(VReoBridge*)); 6.114 + boundaryBridges[0] = &(bridges[CKT_BRIDGE_Broad_0]); 6.115 + boundaryBridges[1] = &(bridges[CKT_BRIDGE_In_0]); 6.116 + boundaryBridges[2] = &(bridges[CKT_BRIDGE_In_1]); 6.117 + boundaryBridges[3] = &(bridges[CKT_BRIDGE_Out_0]); 6.118 + boundaryBridges[4] = &(bridges[CKT_BRIDGE_Out_1]); 6.119 + 6.120 + // 6.121 + // INITIALIZE ISLANDS 6.122 + // 6.123 + 6.124 + /* Initialize Island 0. */ 6.125 + island = &(islands[CKT_I0]); 6.126 + 6.127 + island->numCheckerFns = 1; 6.128 + island->numBridges = 4; 6.129 + 6.130 + island->checkerFns = PR_WL__malloc(island->numCheckerFns * sizeof(VReoCheckerFn)); 6.131 + island->checkerFns[0] = &Checker_0__I0; 6.132 + 6.133 + island->doerFns = PR_WL__malloc(island->numCheckerFns * sizeof(VReoDoerFn)); 6.134 + island->doerFns[0] = &Doer_0__I0; 6.135 + 6.136 + island->bridges = PR_WL__malloc(island->numBridges * sizeof(VReoBridge *)); 6.137 + island->bridges[I0_BRIDGE_Broad_0] = &(bridges[CKT_BRIDGE_Broad_0]); 6.138 + island->bridges[I0_BRIDGE_Broad_0Output1] = &(bridges[CKT_BRIDGE_Broad_0Output1]); 6.139 + island->bridges[I0_BRIDGE_Broad_0Output2] = &(bridges[CKT_BRIDGE_Broad_0Output2]); 6.140 + island->bridges[I0_BRIDGE_Out_1] = &(bridges[CKT_BRIDGE_Out_1]); 6.141 + 6.142 + /* 6.143 + * Initialize Island 0: register Island 0 as a reader on 6.144 + * bridge Broad_0. 6.145 + */ 6.146 + bridgeReaderCheckerFns = PR_WL__malloc( NUM_I0_CHECKERS_INVOLVE_BRIDGE_Broad_0 * sizeof(VReoCheckerFn *) ); 6.147 + bridgeReaderDoerFns = PR_WL__malloc( NUM_I0_CHECKERS_INVOLVE_BRIDGE_Broad_0 * sizeof(VReoDoerFn *) ); 6.148 + bridgeReaderCheckerFns[0] = (VReoCheckerFn) &CHECKER3_I0; 6.149 + bridgeReaderDoerFns[0] = (VReoDoerFn) &DOER3_I0; 6.150 + 6.151 + bridge = &(bridges[CKT_BRIDGE_Broad_0]); 6.152 + bridge->reader = &(islands[CKT_I0]); 6.153 + bridge->readerType = Island; 6.154 + bridge->numReaderCheckerFns = NUM_I0_CHECKERS_INVOLVE_BRIDGE_Broad_0; 6.155 + bridge->readerCheckerFns = (VReoCheckerFn *) bridgeReaderCheckerFns; 6.156 + bridge->readerDoerFns = (VReoDoerFn *) bridgeReaderDoerFns; 6.157 + 6.158 + /* 6.159 + * Initialize Island 0: register Island 0 as a writer on 6.160 + * bridge Broad_0Output1. 6.161 + */ 6.162 + bridgeWriterCheckerFns = PR_WL__malloc( NUM_I0_CHECKERS_INVOLVE_BRIDGE_Broad_0Output1 * sizeof(VReoCheckerFn *) ); 6.163 + bridgeWriterDoerFns = PR_WL__malloc( NUM_I0_CHECKERS_INVOLVE_BRIDGE_Broad_0Output1 * sizeof(VReoDoerFn *) ); 6.164 + bridgeWriterCheckerFns[0] = (VReoCheckerFn) &CHECKER3_I0; 6.165 + bridgeWriterDoerFns[0] = (VReoDoerFn) &DOER3_I0; 6.166 + 6.167 + bridge = &(bridges[CKT_BRIDGE_Broad_0Output1]); 6.168 + bridge->writer = &(islands[CKT_I0]); 6.169 + bridge->writerType = Island; 6.170 + bridge->numWriterCheckerFns = NUM_I0_CHECKERS_INVOLVE_BRIDGE_Broad_0Output1; 6.171 + bridge->writerCheckerFns = (VReoCheckerFn *) bridgeWriterCheckerFns; 6.172 + bridge->writerDoerFns = (VReoDoerFn *) bridgeWriterDoerFns; 6.173 + 6.174 + /* 6.175 + * Initialize Island 0: register Island 0 as a writer on 6.176 + * bridge Broad_0Output2. 6.177 + */ 6.178 + bridgeWriterCheckerFns = PR_WL__malloc( NUM_I0_CHECKERS_INVOLVE_BRIDGE_Broad_0Output2 * sizeof(VReoCheckerFn *) ); 6.179 + bridgeWriterDoerFns = PR_WL__malloc( NUM_I0_CHECKERS_INVOLVE_BRIDGE_Broad_0Output2 * sizeof(VReoDoerFn *) ); 6.180 + bridgeWriterCheckerFns[0] = (VReoCheckerFn) &CHECKER3_I0; 6.181 + bridgeWriterDoerFns[0] = (VReoDoerFn) &DOER3_I0; 6.182 + 6.183 + bridge = &(bridges[CKT_BRIDGE_Broad_0Output2]); 6.184 + bridge->writer = &(islands[CKT_I0]); 6.185 + bridge->writerType = Island; 6.186 + bridge->numWriterCheckerFns = NUM_I0_CHECKERS_INVOLVE_BRIDGE_Broad_0Output2; 6.187 + bridge->writerCheckerFns = (VReoCheckerFn *) bridgeWriterCheckerFns; 6.188 + bridge->writerDoerFns = (VReoDoerFn *) bridgeWriterDoerFns; 6.189 + 6.190 + /* 6.191 + * Initialize Island 0: register Island 0 as a writer on 6.192 + * bridge Out_1. 6.193 + */ 6.194 + bridgeWriterCheckerFns = PR_WL__malloc( NUM_I0_CHECKERS_INVOLVE_BRIDGE_Out_1 * sizeof(VReoCheckerFn *) ); 6.195 + bridgeWriterDoerFns = PR_WL__malloc( NUM_I0_CHECKERS_INVOLVE_BRIDGE_Out_1 * sizeof(VReoDoerFn *) ); 6.196 + bridgeWriterCheckerFns[0] = (VReoCheckerFn) &CHECKER3_I0; 6.197 + bridgeWriterDoerFns[0] = (VReoDoerFn) &DOER3_I0; 6.198 + 6.199 + bridge = &(bridges[CKT_BRIDGE_Out_1]); 6.200 + bridge->writer = &(islands[CKT_I0]); 6.201 + bridge->writerType = Island; 6.202 + bridge->numWriterCheckerFns = NUM_I0_CHECKERS_INVOLVE_BRIDGE_Out_1; 6.203 + bridge->writerCheckerFns = (VReoCheckerFn *) bridgeWriterCheckerFns; 6.204 + bridge->writerDoerFns = (VReoDoerFn *) bridgeWriterDoerFns; 6.205 + 6.206 + /* Initialize Island 1. */ 6.207 + island = &(islands[CKT_I1]); 6.208 + 6.209 + island->numCheckerFns = 1; 6.210 + island->numBridges = 3; 6.211 + 6.212 + island->checkerFns = PR_WL__malloc(island->numCheckerFns * sizeof(VReoCheckerFn)); 6.213 + island->checkerFns[0] = &Checker_0__I1; 6.214 + 6.215 + island->doerFns = PR_WL__malloc(island->numCheckerFns * sizeof(VReoDoerFn)); 6.216 + island->doerFns[0] = &Doer_0__I1; 6.217 + 6.218 + island->bridges = PR_WL__malloc(island->numBridges * sizeof(VReoBridge *)); 6.219 + island->bridges[I1_BRIDGE_X_0Input0] = &(bridges[CKT_BRIDGE_X_0Input0]); 6.220 + island->bridges[I1_BRIDGE_In_0] = &(bridges[CKT_BRIDGE_In_0]); 6.221 + island->bridges[I1_BRIDGE_In_0Output1] = &(bridges[CKT_BRIDGE_In_0Output1]); 6.222 + 6.223 + /* 6.224 + * Initialize Island 1: register Island 1 as a reader on 6.225 + * bridge X_0Input0. 6.226 + */ 6.227 + bridgeReaderCheckerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_BRIDGE_X_0Input0 * sizeof(VReoCheckerFn *) ); 6.228 + bridgeReaderDoerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_BRIDGE_X_0Input0 * sizeof(VReoDoerFn *) ); 6.229 + bridgeReaderCheckerFns[0] = (VReoCheckerFn) &CHECKER2_I1; 6.230 + bridgeReaderDoerFns[0] = (VReoDoerFn) &DOER2_I1; 6.231 + 6.232 + bridge = &(bridges[CKT_BRIDGE_X_0Input0]); 6.233 + bridge->reader = &(islands[CKT_I1]); 6.234 + bridge->readerType = Island; 6.235 + bridge->numReaderCheckerFns = NUM_I1_CHECKERS_INVOLVE_BRIDGE_X_0Input0; 6.236 + bridge->readerCheckerFns = (VReoCheckerFn *) bridgeReaderCheckerFns; 6.237 + bridge->readerDoerFns = (VReoDoerFn *) bridgeReaderDoerFns; 6.238 + 6.239 + /* 6.240 + * Initialize Island 1: register Island 1 as a reader on 6.241 + * bridge In_0. 6.242 + */ 6.243 + bridgeReaderCheckerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_BRIDGE_In_0 * sizeof(VReoCheckerFn *) ); 6.244 + bridgeReaderDoerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_BRIDGE_In_0 * sizeof(VReoDoerFn *) ); 6.245 + bridgeReaderCheckerFns[0] = (VReoCheckerFn) &CHECKER2_I1; 6.246 + bridgeReaderDoerFns[0] = (VReoDoerFn) &DOER2_I1; 6.247 + 6.248 + bridge = &(bridges[CKT_BRIDGE_In_0]); 6.249 + bridge->reader = &(islands[CKT_I1]); 6.250 + bridge->readerType = Island; 6.251 + bridge->numReaderCheckerFns = NUM_I1_CHECKERS_INVOLVE_BRIDGE_In_0; 6.252 + bridge->readerCheckerFns = (VReoCheckerFn *) bridgeReaderCheckerFns; 6.253 + bridge->readerDoerFns = (VReoDoerFn *) bridgeReaderDoerFns; 6.254 + 6.255 + /* 6.256 + * Initialize Island 1: register Island 1 as a writer on 6.257 + * bridge In_0Output1. 6.258 + */ 6.259 + bridgeWriterCheckerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_BRIDGE_In_0Output1 * sizeof(VReoCheckerFn *) ); 6.260 + bridgeWriterDoerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_BRIDGE_In_0Output1 * sizeof(VReoDoerFn *) ); 6.261 + bridgeWriterCheckerFns[0] = (VReoCheckerFn) &CHECKER2_I1; 6.262 + bridgeWriterDoerFns[0] = (VReoDoerFn) &DOER2_I1; 6.263 + 6.264 + bridge = &(bridges[CKT_BRIDGE_In_0Output1]); 6.265 + bridge->writer = &(islands[CKT_I1]); 6.266 + bridge->writerType = Island; 6.267 + bridge->numWriterCheckerFns = NUM_I1_CHECKERS_INVOLVE_BRIDGE_In_0Output1; 6.268 + bridge->writerCheckerFns = (VReoCheckerFn *) bridgeWriterCheckerFns; 6.269 + bridge->writerDoerFns = (VReoDoerFn *) bridgeWriterDoerFns; 6.270 + 6.271 + /* Initialize Island 2. */ 6.272 + island = &(islands[CKT_I2]); 6.273 + 6.274 + island->numCheckerFns = 1; 6.275 + island->numBridges = 3; 6.276 + 6.277 + island->checkerFns = PR_WL__malloc(island->numCheckerFns * sizeof(VReoCheckerFn)); 6.278 + island->checkerFns[0] = &Checker_0__I2; 6.279 + 6.280 + island->doerFns = PR_WL__malloc(island->numCheckerFns * sizeof(VReoDoerFn)); 6.281 + island->doerFns[0] = &Doer_0__I2; 6.282 + 6.283 + island->bridges = PR_WL__malloc(island->numBridges * sizeof(VReoBridge *)); 6.284 + island->bridges[I2_BRIDGE_In_1] = &(bridges[CKT_BRIDGE_In_1]); 6.285 + island->bridges[I2_BRIDGE_X_1Input0] = &(bridges[CKT_BRIDGE_X_1Input0]); 6.286 + island->bridges[I2_BRIDGE_In_1Output0] = &(bridges[CKT_BRIDGE_In_1Output0]); 6.287 + 6.288 + /* 6.289 + * Initialize Island 2: register Island 2 as a reader on 6.290 + * bridge In_1. 6.291 + */ 6.292 + bridgeReaderCheckerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_BRIDGE_In_1 * sizeof(VReoCheckerFn *) ); 6.293 + bridgeReaderDoerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_BRIDGE_In_1 * sizeof(VReoDoerFn *) ); 6.294 + bridgeReaderCheckerFns[0] = (VReoCheckerFn) &CHECKER3_I2; 6.295 + bridgeReaderDoerFns[0] = (VReoDoerFn) &DOER3_I2; 6.296 + 6.297 + bridge = &(bridges[CKT_BRIDGE_In_1]); 6.298 + bridge->reader = &(islands[CKT_I2]); 6.299 + bridge->readerType = Island; 6.300 + bridge->numReaderCheckerFns = NUM_I2_CHECKERS_INVOLVE_BRIDGE_In_1; 6.301 + bridge->readerCheckerFns = (VReoCheckerFn *) bridgeReaderCheckerFns; 6.302 + bridge->readerDoerFns = (VReoDoerFn *) bridgeReaderDoerFns; 6.303 + 6.304 + /* 6.305 + * Initialize Island 2: register Island 2 as a reader on 6.306 + * bridge X_1Input0. 6.307 + */ 6.308 + bridgeReaderCheckerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_BRIDGE_X_1Input0 * sizeof(VReoCheckerFn *) ); 6.309 + bridgeReaderDoerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_BRIDGE_X_1Input0 * sizeof(VReoDoerFn *) ); 6.310 + bridgeReaderCheckerFns[0] = (VReoCheckerFn) &CHECKER3_I2; 6.311 + bridgeReaderDoerFns[0] = (VReoDoerFn) &DOER3_I2; 6.312 + 6.313 + bridge = &(bridges[CKT_BRIDGE_X_1Input0]); 6.314 + bridge->reader = &(islands[CKT_I2]); 6.315 + bridge->readerType = Island; 6.316 + bridge->numReaderCheckerFns = NUM_I2_CHECKERS_INVOLVE_BRIDGE_X_1Input0; 6.317 + bridge->readerCheckerFns = (VReoCheckerFn *) bridgeReaderCheckerFns; 6.318 + bridge->readerDoerFns = (VReoDoerFn *) bridgeReaderDoerFns; 6.319 + 6.320 + /* 6.321 + * Initialize Island 2: register Island 2 as a writer on 6.322 + * bridge In_1Output0. 6.323 + */ 6.324 + bridgeWriterCheckerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_BRIDGE_In_1Output0 * sizeof(VReoCheckerFn *) ); 6.325 + bridgeWriterDoerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_BRIDGE_In_1Output0 * sizeof(VReoDoerFn *) ); 6.326 + bridgeWriterCheckerFns[0] = (VReoCheckerFn) &CHECKER3_I2; 6.327 + bridgeWriterDoerFns[0] = (VReoDoerFn) &DOER3_I2; 6.328 + 6.329 + bridge = &(bridges[CKT_BRIDGE_In_1Output0]); 6.330 + bridge->writer = &(islands[CKT_I2]); 6.331 + bridge->writerType = Island; 6.332 + bridge->numWriterCheckerFns = NUM_I2_CHECKERS_INVOLVE_BRIDGE_In_1Output0; 6.333 + bridge->writerCheckerFns = (VReoCheckerFn *) bridgeWriterCheckerFns; 6.334 + bridge->writerDoerFns = (VReoDoerFn *) bridgeWriterDoerFns; 6.335 + 6.336 + /* Initialize O1Island 0. */ 6.337 + o1island = &(o1islands[CKT_O1I0]); 6.338 + 6.339 + o1island->numBridges = 3; 6.340 + o1island->bridges = PR_WL__malloc(o1island->numBridges * sizeof(VReoBridge *)); 6.341 + o1island->bridges[O1I0_BRIDGE_Out_0Input1] = &(bridges[CKT_BRIDGE_Out_0Input1]); 6.342 + o1island->bridges[O1I0_BRIDGE_Out_0Input0] = &(bridges[CKT_BRIDGE_Out_0Input0]); 6.343 + o1island->bridges[O1I0_BRIDGE_Out_0] = &(bridges[CKT_BRIDGE_Out_0]); 6.344 + 6.345 + /* 6.346 + * Initialize O1Island 0: create queues (queue 0 holds puts of input 6.347 + * bridges; queue 1 holds gets of the output bridge). 6.348 + */ 6.349 + offerQ0 = makePrivQ(); 6.350 + offerQ1 = makePrivQ(); 6.351 + 6.352 + partnerQStruct0 = PR_WL__malloc( sizeof(VReoPartnerQStruct) ); 6.353 + partnerQStruct0->numQs = 1; 6.354 + partnerQStruct0->partnerQs = PR_WL__malloc( partnerQStruct0->numQs * sizeof(PrivQueueStruc *) ); 6.355 + partnerQStruct0->doerFns = PR_WL__malloc( partnerQStruct0->numQs * sizeof(VReoO1islandDoerFn) ); 6.356 + partnerQStruct0->doerFns[0] = &o1islandReadBridgeToWrittenBridgeDoer; 6.357 + partnerQStruct0->partnerQs[0] = offerQ1; 6.358 + 6.359 + partnerQStruct1 = PR_WL__malloc( sizeof(VReoPartnerQStruct) ); 6.360 + partnerQStruct1->numQs = 1; 6.361 + partnerQStruct1->partnerQs = PR_WL__malloc( partnerQStruct1->numQs * sizeof(PrivQueueStruc *) ); 6.362 + partnerQStruct1->doerFns = PR_WL__malloc( partnerQStruct1->numQs * sizeof(VReoO1islandDoerFn) ); 6.363 + partnerQStruct1->doerFns[0] = &o1islandReadBridgeToWrittenBridgeDoer; 6.364 + partnerQStruct1->partnerQs[0] = offerQ0; 6.365 + 6.366 + /* 6.367 + * Initialize O1Island 0: register O1Island 0 as a reader on 6.368 + * bridge Out_0Input1. 6.369 + */ 6.370 + bridge = &(bridges[CKT_BRIDGE_Out_0Input1]); 6.371 + bridge->reader = &(o1island); 6.372 + bridge->readerType = O1island; 6.373 + bridge->readerPartnerQStruct = partnerQStruct0; 6.374 + bridge->readerOfferQ = offerQ0; 6.375 + 6.376 + /* 6.377 + * Initialize O1Island 0: register O1Island 0 as a reader on 6.378 + * bridge Out_0Input0. 6.379 + */ 6.380 + bridge = &(bridges[CKT_BRIDGE_Out_0Input0]); 6.381 + bridge->reader = &(o1island); 6.382 + bridge->readerType = O1island; 6.383 + bridge->readerPartnerQStruct = partnerQStruct0; 6.384 + bridge->readerOfferQ = offerQ0; 6.385 + 6.386 + /* 6.387 + * Initialize O1Island 0: register O1Island 0 as the only 6.388 + * writer on bridge Out_0. 6.389 + */ 6.390 + bridge = &(bridges[CKT_BRIDGE_Out_0]); 6.391 + bridge->writer = &(o1island); 6.392 + bridge->writerType = O1island; 6.393 + bridge->writerPartnerQStruct = partnerQStruct1; 6.394 + bridge->writerOfferQ = offerQ1; 6.395 + 6.396 + // 6.397 + // INITIALIZE QUEUES 6.398 + // 6.399 + 6.400 + /* Assumption: (writerType != NULL) implies (writerType != VP) */ 6.401 + bridge = &(bridges[CKT_BRIDGE_Out_0Input1]); 6.402 + if (bridge->writerType != NULL && bridge->bridgeIsFull) 6.403 + writePrivQ( bridge, bridge->readerOfferQ ); 6.404 + 6.405 + /* Assumption: (writerType != NULL) implies (writerType != VP) */ 6.406 + bridge = &(bridges[CKT_BRIDGE_Out_0Input0]); 6.407 + if (bridge->writerType != NULL && bridge->bridgeIsFull) 6.408 + writePrivQ( bridge, bridge->readerOfferQ ); 6.409 + 6.410 + /* Assumption: (readerType != NULL) implies (readerType != VP) */ 6.411 + bridge = &(bridges[CKT_BRIDGE_Out_0]); 6.412 + if (bridge->readerType != NULL && !bridge->bridgeIsFull) 6.413 + writePrivQ( bridge, bridge->writerOfferQ ); 6.414 + 6.415 + // 6.416 + // INITIALIZE CIRCUIT 6.417 + // 6.418 + 6.419 + /* Initialize circuit. */ 6.420 + circuit->numIslands = NUM_ISLANDS; 6.421 + circuit->numO1islands = NUM_O1ISLANDS; 6.422 + circuit->numBridges = NUM_BRIDGES; 6.423 + circuit->islands = islands; 6.424 + circuit->o1islands = o1islands; 6.425 + circuit->bridges = bridges; 6.426 + circuit->boundaryBridges = boundaryBridges; 6.427 + circuit->VPs = NULL; 6.428 + 6.429 + /* Return. */ 6.430 + return (circuit); 6.431 +} 6.432 + 6.433 +void create_VPs_w_init_and_connect( VReoCircuit *circuit, void **initDatums, 6.434 + SlaveVP *animVP) 6.435 + { 6.436 + 6.437 + /* Declare variables. */ 6.438 + VReoBridge **boundaryBridges, *bridges, **bridgesForVP; 6.439 + SlaveVP **VPs; 6.440 + 6.441 + TestAppProducerParams *prodParams; 6.442 + TestAppConsumerParams *consParams; 6.443 + 6.444 + /* Initialize (boundary) bridges. */ 6.445 + boundaryBridges = circuit->boundaryBridges; 6.446 + bridges = circuit->bridges; 6.447 + 6.448 + /* Allocate memory for VPs. */ 6.449 + VPs = PR_WL__malloc(NUM_VPs * sizeof(SlaveVP *)); 6.450 + 6.451 + /* Create Producer VP 0. */ 6.452 + bridgesForVP = PR_WL__malloc(1 * sizeof(VReoBridge *)); 6.453 + bridgesForVP[0] = boundaryBridges[CKT_VP_PROD0]; 6.454 + 6.455 + prodParams = PR_WL__malloc(sizeof(TestAppProducerParams)); 6.456 + prodParams->inBridges = NULL; 6.457 + prodParams->outBridges = bridgesForVP; 6.458 + prodParams->initData = initDatums[CKT_VP_PROD0]; 6.459 + 6.460 + VPs[CKT_VP_PROD0] = VReo__create_VP(&producer_Fn, prodParams, circuit, animVP); 6.461 + 6.462 + boundaryBridges[CKT_VP_PROD0]->writer = VPs[CKT_VP_PROD0]; 6.463 + boundaryBridges[CKT_VP_PROD0]->writerType = VP; 6.464 + 6.465 + /* Create Producer VP 1. */ 6.466 + bridgesForVP = PR_WL__malloc(1 * sizeof(VReoBridge *)); 6.467 + bridgesForVP[0] = boundaryBridges[CKT_VP_PROD1]; 6.468 + 6.469 + prodParams = PR_WL__malloc(sizeof(TestAppProducerParams)); 6.470 + prodParams->inBridges = NULL; 6.471 + prodParams->outBridges = bridgesForVP; 6.472 + prodParams->initData = initDatums[CKT_VP_PROD1]; 6.473 + 6.474 + VPs[CKT_VP_PROD1] = VReo__create_VP(&producer_Fn, prodParams, circuit, animVP); 6.475 + 6.476 + boundaryBridges[CKT_VP_PROD1]->writer = VPs[CKT_VP_PROD1]; 6.477 + boundaryBridges[CKT_VP_PROD1]->writerType = VP; 6.478 + 6.479 + /* Create Producer VP 2. */ 6.480 + bridgesForVP = PR_WL__malloc(1 * sizeof(VReoBridge *)); 6.481 + bridgesForVP[0] = boundaryBridges[CKT_VP_PROD2]; 6.482 + 6.483 + prodParams = PR_WL__malloc(sizeof(TestAppProducerParams)); 6.484 + prodParams->inBridges = NULL; 6.485 + prodParams->outBridges = bridgesForVP; 6.486 + prodParams->initData = initDatums[CKT_VP_PROD2]; 6.487 + 6.488 + VPs[CKT_VP_PROD2] = VReo__create_VP(&producer_Fn, prodParams, circuit, animVP); 6.489 + 6.490 + boundaryBridges[CKT_VP_PROD2]->writer = VPs[CKT_VP_PROD2]; 6.491 + boundaryBridges[CKT_VP_PROD2]->writerType = VP; 6.492 + 6.493 +// /* Create Consumer VP 0. */ 6.494 +// consParams = PR_WL__malloc(sizeof(TestAppConsumerParams)); 6.495 +// 6.496 +// //bridgesForVP = PR_WL__malloc(1 * sizeof(VReoBridge *)); 6.497 +// //bridgesForVP[0] = boundaryBridges[CKT_VP_CONS0]; 6.498 +// 6.499 +// bridgesForVP = PR_WL__malloc(2 * sizeof(VReoBridge *)); 6.500 +// bridgesForVP[0] = bridges[CKT_BRIDGE_Out_0]; 6.501 +// bridgesForVP[0] = bridges[CKT_BRIDGE_Out_1]; 6.502 +// 6.503 +// consParams->inBridges = bridgesForVP; 6.504 +// consParams->outBridges = NULL; 6.505 +// 6.506 +// VPs[CKT_VP_CONS0] = VReo__create_VP(&consumer_Fn, consParams, circuit, animVP); 6.507 +// boundaryBridges[CKT_VP_CONS0]->reader = VPs[CKT_VP_CONS0]; 6.508 +// boundaryBridges[CKT_VP_CONS0]->readerType = VP; 6.509 + 6.510 +// /* Create Consumer VP 1. */ 6.511 +// consParams = PR_WL__malloc(sizeof(TestAppConsumerParams)); 6.512 +// 6.513 +// //bridgesForVP = PR_WL__malloc(1 * sizeof(VReoBridge *)); 6.514 +// //bridgesForVP[0] = boundaryBridges[CKT_VP_CONS1]; 6.515 +// 6.516 +// bridgesForVP = PR_WL__malloc(2 * sizeof(VReoBridge *)); 6.517 +// bridgesForVP[0] = bridges[CKT_BRIDGE_Out_0]; 6.518 +// bridgesForVP[0] = bridges[CKT_BRIDGE_Out_1]; 6.519 +// 6.520 +// consParams->inBridges = bridgesForVP; 6.521 +// consParams->outBridges = NULL; 6.522 +// 6.523 +// VPs[CKT_VP_CONS1] = VReo__create_VP(&consumer_Fn, consParams, circuit, animVP); 6.524 +// boundaryBridges[CKT_VP_CONS1]->reader = VPs[CKT_VP_CONS1]; 6.525 +// boundaryBridges[CKT_VP_CONS1]->readerType = VP; 6.526 + 6.527 + /* Create Consumer VP. */ 6.528 + consParams = PR_WL__malloc(sizeof(TestAppConsumerParams)); 6.529 + 6.530 + bridgesForVP = PR_WL__malloc(2 * sizeof(VReoBridge *)); 6.531 + bridgesForVP[0] = &(bridges[CKT_BRIDGE_Out_0]); 6.532 + bridgesForVP[1] = &(bridges[CKT_BRIDGE_Out_1]); 6.533 + 6.534 + consParams->inBridges = bridgesForVP; 6.535 + consParams->outBridges = NULL; 6.536 + consParams->initData = initDatums[CKT_VP_CONS0]; 6.537 + 6.538 + VPs[CKT_VP_CONS0] = VReo__create_VP(&consumer_Fn, consParams, circuit, animVP); 6.539 + 6.540 + bridges[CKT_BRIDGE_Out_0].reader = VPs[CKT_VP_CONS0]; 6.541 + bridges[CKT_BRIDGE_Out_1].reader = VPs[CKT_VP_CONS0]; 6.542 + bridges[CKT_BRIDGE_Out_0].readerType = VP; 6.543 + bridges[CKT_BRIDGE_Out_1].readerType = VP; 6.544 + 6.545 + /* Start circuit. */ 6.546 + VReo__start_circuit(circuit, animVP); 6.547 +} 6.548 + 6.549 +//============================================================================== 6.550 + 6.551 +/* Checkers for Island 0. */ 6.552 + 6.553 +bool32 Checker_0__I0( VReoIsland *island ) { 6.554 + VReoBridge *bridgeBroad_0Output1, *bridgeBroad_0Output2, *bridgeOut_1, *bridgeBroad_0; 6.555 + bool32 satisfied; 6.556 + 6.557 + bridgeBroad_0Output1 = (island->bridges)[I0_BRIDGE_Broad_0Output1]; 6.558 + bridgeBroad_0Output2 = (island->bridges)[I0_BRIDGE_Broad_0Output2]; 6.559 + bridgeOut_1 = (island->bridges)[I0_BRIDGE_Out_1]; 6.560 + bridgeBroad_0 = (island->bridges)[I0_BRIDGE_Broad_0]; 6.561 + satisfied = READY_FOR_READ_BRIDGE_Broad_0 && READY_FOR_WRITE_BRIDGE_Broad_0Output1 && READY_FOR_WRITE_BRIDGE_Broad_0Output2 && READY_FOR_WRITE_BRIDGE_Out_1; 6.562 + return satisfied; 6.563 +} 6.564 + 6.565 +/* Checkers for Island 1. */ 6.566 + 6.567 +bool32 Checker_0__I1( VReoIsland *island ) { 6.568 + VReoBridge *bridgeX_0Input0, *bridgeIn_0, *bridgeIn_0Output1; 6.569 + bool32 satisfied; 6.570 + 6.571 + bridgeX_0Input0 = (island->bridges)[I1_BRIDGE_X_0Input0]; 6.572 + bridgeIn_0 = (island->bridges)[I1_BRIDGE_In_0]; 6.573 + bridgeIn_0Output1 = (island->bridges)[I1_BRIDGE_In_0Output1]; 6.574 + satisfied = READY_FOR_READ_BRIDGE_X_0Input0 && READY_FOR_READ_BRIDGE_In_0 && READY_FOR_WRITE_BRIDGE_In_0Output1; 6.575 + return satisfied; 6.576 +} 6.577 + 6.578 +/* Checkers for Island 2. */ 6.579 + 6.580 +bool32 Checker_0__I2( VReoIsland *island ) { 6.581 + VReoBridge *bridgeIn_1Output0, *bridgeIn_1, *bridgeX_1Input0; 6.582 + bool32 satisfied; 6.583 + 6.584 + bridgeIn_1Output0 = (island->bridges)[I2_BRIDGE_In_1Output0]; 6.585 + bridgeIn_1 = (island->bridges)[I2_BRIDGE_In_1]; 6.586 + bridgeX_1Input0 = (island->bridges)[I2_BRIDGE_X_1Input0]; 6.587 + satisfied = READY_FOR_READ_BRIDGE_In_1 && READY_FOR_READ_BRIDGE_X_1Input0 && READY_FOR_WRITE_BRIDGE_In_1Output0; 6.588 + return satisfied; 6.589 +} 6.590 + 6.591 +//============================================================================== 6.592 + 6.593 +/* Declaration of auxiliary doers. */ 6.594 + 6.595 +void Auxdoer_for_bridge_Broad_0( VReoBridge *bridge ); 6.596 +void Auxdoer_for_bridge_In_0( VReoBridge *bridge ); 6.597 +void Auxdoer_for_bridge_In_1( VReoBridge *bridge ); 6.598 +void Auxdoer_for_bridge_Out_0( VReoBridge *bridge ); 6.599 +void Auxdoer_for_bridge_Out_1( VReoBridge *bridge ); 6.600 +void Auxdoer_for_bridge_In_0Output1( VReoBridge *bridge ); 6.601 +void Auxdoer_for_bridge_Out_0Input1( VReoBridge *bridge ); 6.602 + 6.603 +void Auxdoer_for_bridge_Broad_0Output1( VReoBridge *bridge ); 6.604 +void Auxdoer_for_bridge_X_0Input0( VReoBridge *bridge ); 6.605 + 6.606 +void Auxdoer_for_bridge_In_1Output0( VReoBridge *bridge ); 6.607 +void Auxdoer_for_bridge_Out_0Input0( VReoBridge *bridge ); 6.608 + 6.609 +void Auxdoer_for_bridge_Broad_0Output2( VReoBridge *bridge ); 6.610 +void Auxdoer_for_bridge_X_1Input0( VReoBridge *bridge ); 6.611 + 6.612 +/* Doers for Island 0. */ 6.613 + 6.614 +void Doer_0__I0( VReoIsland *island ) { 6.615 + VReoBridge *bridgeBroad_0Output1, *bridgeBroad_0Output2, *bridgeOut_1, *bridgeBroad_0; 6.616 + 6.617 + /* Initialize bridges. */ 6.618 + bridgeBroad_0Output1 = (island->bridges)[I0_BRIDGE_Broad_0Output1]; 6.619 + bridgeBroad_0Output2 = (island->bridges)[I0_BRIDGE_Broad_0Output2]; 6.620 + bridgeOut_1 = (island->bridges)[I0_BRIDGE_Out_1]; 6.621 + bridgeBroad_0 = (island->bridges)[I0_BRIDGE_Broad_0]; 6.622 + 6.623 + /* Distribute data. */ 6.624 + bridgeBroad_0Output1->buffer = bridgeBroad_0->buffer; 6.625 + bridgeBroad_0Output2->buffer = bridgeBroad_0->buffer; 6.626 + bridgeOut_1->buffer = bridgeBroad_0->buffer; 6.627 + 6.628 + /* Update bridge status. */ 6.629 + bridgeBroad_0->bridgeIsFull = FALSE; 6.630 + bridgeBroad_0Output1->bridgeIsFull = TRUE; 6.631 + bridgeBroad_0Output2->bridgeIsFull = TRUE; 6.632 + bridgeOut_1->bridgeIsFull = TRUE; 6.633 + 6.634 + /* Prepare reader VPs. */ 6.635 + PR_PI__make_slave_ready_for_lang(bridgeOut_1->waitingReaderVP, VReo_MAGIC_NUMBER); 6.636 + bridgeOut_1->waitingReaderVP->dataRetFromReq = bridgeOut_1->buffer; 6.637 + bridgeOut_1->waitingReaderVP = NULL; 6.638 + bridgeOut_1->bridgeIsFull = FALSE; 6.639 + 6.640 + /* Prepare writer VPs. */ 6.641 + PR_PI__make_slave_ready_for_lang(bridgeBroad_0->waitingWriterVP, VReo_MAGIC_NUMBER); 6.642 + bridgeBroad_0->waitingWriterVP = NULL; 6.643 + 6.644 + /* Call auxiliary doers to complete this transition. */ 6.645 + Auxdoer_for_bridge_Broad_0Output1(bridgeBroad_0Output1); 6.646 + Auxdoer_for_bridge_Broad_0Output2(bridgeBroad_0Output2); 6.647 + Auxdoer_for_bridge_Out_1(bridgeOut_1); 6.648 + Auxdoer_for_bridge_Broad_0(bridgeBroad_0); 6.649 +} 6.650 + 6.651 +/* Doers for Island 1. */ 6.652 + 6.653 +void Doer_0__I1( VReoIsland *island ) { 6.654 + VReoBridge *bridgeX_0Input0, *bridgeIn_0, *bridgeIn_0Output1; 6.655 + 6.656 + /* Initialize bridges. */ 6.657 + bridgeX_0Input0 = (island->bridges)[I1_BRIDGE_X_0Input0]; 6.658 + bridgeIn_0 = (island->bridges)[I1_BRIDGE_In_0]; 6.659 + bridgeIn_0Output1 = (island->bridges)[I1_BRIDGE_In_0Output1]; 6.660 + 6.661 + /* Distribute data. */ 6.662 + bridgeIn_0Output1->buffer = bridgeIn_0->buffer; 6.663 + 6.664 + /* Update bridge status. */ 6.665 + bridgeX_0Input0->bridgeIsFull = FALSE; 6.666 + bridgeIn_0->bridgeIsFull = FALSE; 6.667 + bridgeIn_0Output1->bridgeIsFull = TRUE; 6.668 + 6.669 + /* Prepare reader VPs. */ 6.670 + 6.671 + /* Prepare writer VPs. */ 6.672 + PR_PI__make_slave_ready_for_lang(bridgeIn_0->waitingWriterVP, VReo_MAGIC_NUMBER); 6.673 + bridgeIn_0->waitingWriterVP = NULL; 6.674 + 6.675 + /* Call auxiliary doers to complete this transition. */ 6.676 + Auxdoer_for_bridge_X_0Input0(bridgeX_0Input0); 6.677 + Auxdoer_for_bridge_In_0(bridgeIn_0); 6.678 + Auxdoer_for_bridge_In_0Output1(bridgeIn_0Output1); 6.679 +} 6.680 + 6.681 +/* Doers for Island 2. */ 6.682 + 6.683 +void Doer_0__I2( VReoIsland *island ) { 6.684 + VReoBridge *bridgeIn_1Output0, *bridgeIn_1, *bridgeX_1Input0; 6.685 + 6.686 + /* Initialize bridges. */ 6.687 + bridgeIn_1Output0 = (island->bridges)[I2_BRIDGE_In_1Output0]; 6.688 + bridgeIn_1 = (island->bridges)[I2_BRIDGE_In_1]; 6.689 + bridgeX_1Input0 = (island->bridges)[I2_BRIDGE_X_1Input0]; 6.690 + 6.691 + /* Distribute data. */ 6.692 + bridgeIn_1Output0->buffer = bridgeIn_1->buffer; 6.693 + 6.694 + /* Update bridge status. */ 6.695 + bridgeIn_1->bridgeIsFull = FALSE; 6.696 + bridgeX_1Input0->bridgeIsFull = FALSE; 6.697 + bridgeIn_1Output0->bridgeIsFull = TRUE; 6.698 + 6.699 + /* Prepare reader VPs. */ 6.700 + 6.701 + /* Prepare writer VPs. */ 6.702 + PR_PI__make_slave_ready_for_lang(bridgeIn_1->waitingWriterVP, VReo_MAGIC_NUMBER); 6.703 + bridgeIn_1->waitingWriterVP = NULL; 6.704 + 6.705 + /* Call auxiliary doers to complete this transition. */ 6.706 + Auxdoer_for_bridge_In_1Output0(bridgeIn_1Output0); 6.707 + Auxdoer_for_bridge_In_1(bridgeIn_1); 6.708 + Auxdoer_for_bridge_X_1Input0(bridgeX_1Input0); 6.709 +} 6.710 + 6.711 +//============================================================================== 6.712 + 6.713 +/* Auxiliary doers for input bridges. */ 6.714 + 6.715 +void Auxdoer_for_bridge_Broad_0( VReoBridge *bridge ) { 6.716 + ; 6.717 +} 6.718 + 6.719 +void Auxdoer_for_bridge_In_0( VReoBridge *bridge ) { 6.720 + ; 6.721 +} 6.722 + 6.723 +void Auxdoer_for_bridge_In_1( VReoBridge *bridge ) { 6.724 + ; 6.725 +} 6.726 + 6.727 +/* Auxiliary doers for output bridges. */ 6.728 + 6.729 +void Auxdoer_for_bridge_Out_0( VReoBridge *bridge ) { 6.730 + ; 6.731 +} 6.732 + 6.733 +void Auxdoer_for_bridge_Out_1( VReoBridge *bridge ) { 6.734 + ; 6.735 +} 6.736 + 6.737 +/* Auxiliary doers for FIFO bridges. */ 6.738 + 6.739 +void Auxdoer_for_bridge_In_0Output1( VReoBridge *bridge ) { 6.740 + int32 numCheckerFns; 6.741 + VReoIsland *islandOnOtherSide; 6.742 + VReoCheckerFn *checkerFns; 6.743 + VReoDoerFn *doerFns; 6.744 + 6.745 + VReoO1island *o1islandOnOtherSide; 6.746 + VReoPartnerQStruct *partnerQstruct; 6.747 + 6.748 + if (bridge->readerType == Island) { 6.749 + islandOnOtherSide = (VReoIsland*) bridge->reader; 6.750 + numCheckerFns = bridge->numReaderCheckerFns; 6.751 + checkerFns = bridge->readerCheckerFns; 6.752 + doerFns = bridge->readerDoerFns; 6.753 + 6.754 + VReo__check_an_island( islandOnOtherSide, numCheckerFns, checkerFns, doerFns ); 6.755 + } 6.756 + 6.757 + else if (bridge->readerType == O1island) { 6.758 + o1islandOnOtherSide = (VReoO1island *)bridge->reader; 6.759 + partnerQstruct = bridge->readerPartnerQStruct; 6.760 + 6.761 + VReo__check_an_o1island_that_reads_bridge( o1islandOnOtherSide, bridge, partnerQstruct ); 6.762 + } 6.763 +} 6.764 +void Auxdoer_for_bridge_Out_0Input1( VReoBridge *bridge ) { 6.765 + int32 numCheckerFns; 6.766 + VReoIsland *islandOnOtherSide; 6.767 + VReoCheckerFn *checkerFns; 6.768 + VReoDoerFn *doerFns; 6.769 + 6.770 + VReoO1island *o1islandOnOtherSide; 6.771 + VReoPartnerQStruct *partnerQstruct; 6.772 + 6.773 + if (bridge->writerType == Island) { 6.774 + islandOnOtherSide = (VReoIsland*) bridge->writer; 6.775 + numCheckerFns = bridge->numWriterCheckerFns; 6.776 + checkerFns = bridge->writerCheckerFns; 6.777 + doerFns = bridge->writerDoerFns; 6.778 + 6.779 + VReo__check_an_island( islandOnOtherSide, numCheckerFns, checkerFns, doerFns ); 6.780 + } 6.781 + 6.782 + else if (bridge->writerType == O1island) { 6.783 + o1islandOnOtherSide = (VReoO1island *)bridge->writer; 6.784 + partnerQstruct = bridge->writerPartnerQStruct; 6.785 + 6.786 + VReo__check_an_o1island_that_writes_bridge( o1islandOnOtherSide, bridge, partnerQstruct ); 6.787 + } 6.788 +} 6.789 + 6.790 +void Auxdoer_for_bridge_Broad_0Output1( VReoBridge *bridge ) { 6.791 + int32 numCheckerFns; 6.792 + VReoIsland *islandOnOtherSide; 6.793 + VReoCheckerFn *checkerFns; 6.794 + VReoDoerFn *doerFns; 6.795 + 6.796 + VReoO1island *o1islandOnOtherSide; 6.797 + VReoPartnerQStruct *partnerQstruct; 6.798 + 6.799 + if (bridge->readerType == Island) { 6.800 + islandOnOtherSide = (VReoIsland*) bridge->reader; 6.801 + numCheckerFns = bridge->numReaderCheckerFns; 6.802 + checkerFns = bridge->readerCheckerFns; 6.803 + doerFns = bridge->readerDoerFns; 6.804 + 6.805 + VReo__check_an_island( islandOnOtherSide, numCheckerFns, checkerFns, doerFns ); 6.806 + } 6.807 + 6.808 + else if (bridge->readerType == O1island) { 6.809 + o1islandOnOtherSide = (VReoO1island *)bridge->reader; 6.810 + partnerQstruct = bridge->readerPartnerQStruct; 6.811 + 6.812 + VReo__check_an_o1island_that_reads_bridge( o1islandOnOtherSide, bridge, partnerQstruct ); 6.813 + } 6.814 +} 6.815 +void Auxdoer_for_bridge_X_0Input0( VReoBridge *bridge ) { 6.816 + int32 numCheckerFns; 6.817 + VReoIsland *islandOnOtherSide; 6.818 + VReoCheckerFn *checkerFns; 6.819 + VReoDoerFn *doerFns; 6.820 + 6.821 + VReoO1island *o1islandOnOtherSide; 6.822 + VReoPartnerQStruct *partnerQstruct; 6.823 + 6.824 + if (bridge->writerType == Island) { 6.825 + islandOnOtherSide = (VReoIsland*) bridge->writer; 6.826 + numCheckerFns = bridge->numWriterCheckerFns; 6.827 + checkerFns = bridge->writerCheckerFns; 6.828 + doerFns = bridge->writerDoerFns; 6.829 + 6.830 + VReo__check_an_island( islandOnOtherSide, numCheckerFns, checkerFns, doerFns ); 6.831 + } 6.832 + 6.833 + else if (bridge->writerType == O1island) { 6.834 + o1islandOnOtherSide = (VReoO1island *)bridge->writer; 6.835 + partnerQstruct = bridge->writerPartnerQStruct; 6.836 + 6.837 + VReo__check_an_o1island_that_writes_bridge( o1islandOnOtherSide, bridge, partnerQstruct ); 6.838 + } 6.839 +} 6.840 + 6.841 +void Auxdoer_for_bridge_In_1Output0( VReoBridge *bridge ) { 6.842 + int32 numCheckerFns; 6.843 + VReoIsland *islandOnOtherSide; 6.844 + VReoCheckerFn *checkerFns; 6.845 + VReoDoerFn *doerFns; 6.846 + 6.847 + VReoO1island *o1islandOnOtherSide; 6.848 + VReoPartnerQStruct *partnerQstruct; 6.849 + 6.850 + if (bridge->readerType == Island) { 6.851 + islandOnOtherSide = (VReoIsland*) bridge->reader; 6.852 + numCheckerFns = bridge->numReaderCheckerFns; 6.853 + checkerFns = bridge->readerCheckerFns; 6.854 + doerFns = bridge->readerDoerFns; 6.855 + 6.856 + VReo__check_an_island( islandOnOtherSide, numCheckerFns, checkerFns, doerFns ); 6.857 + } 6.858 + 6.859 + else if (bridge->readerType == O1island) { 6.860 + o1islandOnOtherSide = (VReoO1island *)bridge->reader; 6.861 + partnerQstruct = bridge->readerPartnerQStruct; 6.862 + 6.863 + VReo__check_an_o1island_that_reads_bridge( o1islandOnOtherSide, bridge, partnerQstruct ); 6.864 + } 6.865 +} 6.866 +void Auxdoer_for_bridge_Out_0Input0( VReoBridge *bridge ) { 6.867 + int32 numCheckerFns; 6.868 + VReoIsland *islandOnOtherSide; 6.869 + VReoCheckerFn *checkerFns; 6.870 + VReoDoerFn *doerFns; 6.871 + 6.872 + VReoO1island *o1islandOnOtherSide; 6.873 + VReoPartnerQStruct *partnerQstruct; 6.874 + 6.875 + if (bridge->writerType == Island) { 6.876 + islandOnOtherSide = (VReoIsland*) bridge->writer; 6.877 + numCheckerFns = bridge->numWriterCheckerFns; 6.878 + checkerFns = bridge->writerCheckerFns; 6.879 + doerFns = bridge->writerDoerFns; 6.880 + 6.881 + VReo__check_an_island( islandOnOtherSide, numCheckerFns, checkerFns, doerFns ); 6.882 + } 6.883 + 6.884 + else if (bridge->writerType == O1island) { 6.885 + o1islandOnOtherSide = (VReoO1island *)bridge->writer; 6.886 + partnerQstruct = bridge->writerPartnerQStruct; 6.887 + 6.888 + VReo__check_an_o1island_that_writes_bridge( o1islandOnOtherSide, bridge, partnerQstruct ); 6.889 + } 6.890 +} 6.891 + 6.892 +void Auxdoer_for_bridge_Broad_0Output2( VReoBridge *bridge ) { 6.893 + int32 numCheckerFns; 6.894 + VReoIsland *islandOnOtherSide; 6.895 + VReoCheckerFn *checkerFns; 6.896 + VReoDoerFn *doerFns; 6.897 + 6.898 + VReoO1island *o1islandOnOtherSide; 6.899 + VReoPartnerQStruct *partnerQstruct; 6.900 + 6.901 + if (bridge->readerType == Island) { 6.902 + islandOnOtherSide = (VReoIsland*) bridge->reader; 6.903 + numCheckerFns = bridge->numReaderCheckerFns; 6.904 + checkerFns = bridge->readerCheckerFns; 6.905 + doerFns = bridge->readerDoerFns; 6.906 + 6.907 + VReo__check_an_island( islandOnOtherSide, numCheckerFns, checkerFns, doerFns ); 6.908 + } 6.909 + 6.910 + else if (bridge->readerType == O1island) { 6.911 + o1islandOnOtherSide = (VReoO1island *)bridge->reader; 6.912 + partnerQstruct = bridge->readerPartnerQStruct; 6.913 + 6.914 + VReo__check_an_o1island_that_reads_bridge( o1islandOnOtherSide, bridge, partnerQstruct ); 6.915 + } 6.916 +} 6.917 +void Auxdoer_for_bridge_X_1Input0( VReoBridge *bridge ) { 6.918 + int32 numCheckerFns; 6.919 + VReoIsland *islandOnOtherSide; 6.920 + VReoCheckerFn *checkerFns; 6.921 + VReoDoerFn *doerFns; 6.922 + 6.923 + VReoO1island *o1islandOnOtherSide; 6.924 + VReoPartnerQStruct *partnerQstruct; 6.925 + 6.926 + if (bridge->writerType == Island) { 6.927 + islandOnOtherSide = (VReoIsland*) bridge->writer; 6.928 + numCheckerFns = bridge->numWriterCheckerFns; 6.929 + checkerFns = bridge->writerCheckerFns; 6.930 + doerFns = bridge->writerDoerFns; 6.931 + 6.932 + VReo__check_an_island( islandOnOtherSide, numCheckerFns, checkerFns, doerFns ); 6.933 + } 6.934 + 6.935 + else if (bridge->writerType == O1island) { 6.936 + o1islandOnOtherSide = (VReoO1island *)bridge->writer; 6.937 + partnerQstruct = bridge->writerPartnerQStruct; 6.938 + 6.939 + VReo__check_an_o1island_that_writes_bridge( o1islandOnOtherSide, bridge, partnerQstruct ); 6.940 + } 6.941 +} 6.942 \ No newline at end of file
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/Reo__Matrix_Mult/Circuit.h Sun Feb 02 17:58:41 2014 -0800 7.3 @@ -0,0 +1,158 @@ 7.4 +#ifndef _Circuit_App1_H 7.5 +#define _Circuit_App1_H 7.6 + 7.7 +//#include "PR_impl/PR.h" 7.8 +//#include "VReo_impl/VReo.h" 7.9 +#include <PR__include/PR__structs__common.h> 7.10 +#include <PR__include/langlets/vreo_wrapper_library.h> 7.11 + 7.12 +//============================================================================== 7.13 + 7.14 +/* Counts. */ 7.15 +#define NUM_VPs 5 7.16 +#define NUM_PROD 3 7.17 +#define NUM_ISLANDS 3 7.18 +#define NUM_O1ISLANDS 1 7.19 +#define NUM_BRIDGES 9 7.20 +#define NUM_BOUNDARY_BRIDGES 5 7.21 + 7.22 +/* Producer VPs attached to circuit. */ 7.23 +#define CKT_VP_PROD0 0 7.24 +#define CKT_VP_PROD1 1 7.25 +#define CKT_VP_PROD2 2 7.26 + 7.27 +/* Consumer VPs attached to circuit. */ 7.28 +// #define CKT_VP_CONS0 (3+0) 7.29 +// #define CKT_VP_CONS1 (3+1) 7.30 +#define CKT_VP_CONS0 3 7.31 + 7.32 +/* Islands in circuit. */ 7.33 +#define CKT_I0 0 7.34 +#define CKT_I1 1 7.35 +#define CKT_I2 2 7.36 + 7.37 +/* O1Islands in circuit. */ 7.38 +#define CKT_O1I0 0 7.39 + 7.40 +/* Bridges in circuit. */ 7.41 +#define CKT_BRIDGE_Broad_0 0 7.42 +#define CKT_BRIDGE_In_0 1 7.43 +#define CKT_BRIDGE_In_1 2 7.44 +#define CKT_BRIDGE_Out_0 3 7.45 +#define CKT_BRIDGE_Out_1 4 7.46 + 7.47 +#define CKT_BRIDGE_FIFO0 (5+0) 7.48 +#define CKT_BRIDGE_In_0Output1 (5+0) 7.49 +#define CKT_BRIDGE_Out_0Input1 (5+0) 7.50 + 7.51 +#define CKT_BRIDGE_FIFO1 (5+1) 7.52 +#define CKT_BRIDGE_Broad_0Output1 (5+1) 7.53 +#define CKT_BRIDGE_X_0Input0 (5+1) 7.54 + 7.55 +#define CKT_BRIDGE_FIFO2 (5+2) 7.56 +#define CKT_BRIDGE_In_1Output0 (5+2) 7.57 +#define CKT_BRIDGE_Out_0Input0 (5+2) 7.58 + 7.59 +#define CKT_BRIDGE_FIFO3 (5+3) 7.60 +#define CKT_BRIDGE_Broad_0Output2 (5+3) 7.61 +#define CKT_BRIDGE_X_1Input0 (5+3) 7.62 + 7.63 +/* Bridges in Island 0. */ 7.64 +#define I0_BRIDGE_Broad_0Output1 0 7.65 +#define I0_BRIDGE_Broad_0Output2 1 7.66 +#define I0_BRIDGE_Out_1 2 7.67 +#define I0_BRIDGE_Broad_0 3 7.68 + 7.69 +/* Bridges in Island 1. */ 7.70 +#define I1_BRIDGE_X_0Input0 0 7.71 +#define I1_BRIDGE_In_0 1 7.72 +#define I1_BRIDGE_In_0Output1 2 7.73 + 7.74 +/* Bridges in Island 2. */ 7.75 +#define I2_BRIDGE_In_1Output0 0 7.76 +#define I2_BRIDGE_In_1 1 7.77 +#define I2_BRIDGE_X_1Input0 2 7.78 + 7.79 +/* Bridges in O1Island 0. */ 7.80 +#define O1I0_BRIDGE_Out_0 0 7.81 +#define O1I0_BRIDGE_Out_0Input1 1 7.82 +#define O1I0_BRIDGE_Out_0Input0 2 7.83 + 7.84 +/* Readiness of boundary bridges. */ 7.85 +#define READY_FOR_READ_BRIDGE_Broad_0 bridgeBroad_0->bridgeIsFull 7.86 +#define READY_FOR_READ_BRIDGE_In_0 bridgeIn_0->bridgeIsFull 7.87 +#define READY_FOR_READ_BRIDGE_In_1 bridgeIn_1->bridgeIsFull 7.88 +#define READY_FOR_WRITE_BRIDGE_Out_0 bridgeOut_0->waitingReaderVP 7.89 +#define READY_FOR_WRITE_BRIDGE_Out_1 bridgeOut_1->waitingReaderVP 7.90 + 7.91 +/* Readiness of bridges of FIFO 0. */ 7.92 +#define READY_FOR_WRITE_BRIDGE_In_0Output1 !bridgeIn_0Output1->bridgeIsFull 7.93 +#define READY_FOR_READ_BRIDGE_Out_0Input1 bridgeOut_0Input1->bridgeIsFull 7.94 + 7.95 +/* Readiness of bridges of FIFO 1. */ 7.96 +#define READY_FOR_WRITE_BRIDGE_Broad_0Output1 !bridgeBroad_0Output1->bridgeIsFull 7.97 +#define READY_FOR_READ_BRIDGE_X_0Input0 bridgeX_0Input0->bridgeIsFull 7.98 + 7.99 +/* Readiness of bridges of FIFO 2. */ 7.100 +#define READY_FOR_WRITE_BRIDGE_In_1Output0 !bridgeIn_1Output0->bridgeIsFull 7.101 +#define READY_FOR_READ_BRIDGE_Out_0Input0 bridgeOut_0Input0->bridgeIsFull 7.102 + 7.103 +/* Readiness of bridges of FIFO 3. */ 7.104 +#define READY_FOR_WRITE_BRIDGE_Broad_0Output2 !bridgeBroad_0Output2->bridgeIsFull 7.105 +#define READY_FOR_READ_BRIDGE_X_1Input0 bridgeX_1Input0->bridgeIsFull 7.106 + 7.107 +/* Number of checkers per bridge in Island 0. */ 7.108 +#define NUM_I0_CHECKERS_INVOLVE_BRIDGE_Broad_0Output1 1 7.109 +#define NUM_I0_CHECKERS_INVOLVE_BRIDGE_Broad_0Output2 1 7.110 +#define NUM_I0_CHECKERS_INVOLVE_BRIDGE_Out_1 1 7.111 +#define NUM_I0_CHECKERS_INVOLVE_BRIDGE_Broad_0 1 7.112 + 7.113 +/* Number of checkers per bridge in Island 1. */ 7.114 +#define NUM_I1_CHECKERS_INVOLVE_BRIDGE_X_0Input0 1 7.115 +#define NUM_I1_CHECKERS_INVOLVE_BRIDGE_In_0 1 7.116 +#define NUM_I1_CHECKERS_INVOLVE_BRIDGE_In_0Output1 1 7.117 + 7.118 +/* Number of checkers per bridge in Island 2. */ 7.119 +#define NUM_I2_CHECKERS_INVOLVE_BRIDGE_In_1Output0 1 7.120 +#define NUM_I2_CHECKERS_INVOLVE_BRIDGE_In_1 1 7.121 +#define NUM_I2_CHECKERS_INVOLVE_BRIDGE_X_1Input0 1 7.122 + 7.123 +/* Checkers and doers for Island 0. */ 7.124 +#define CHECKER3_I0 Checker_0__I0 7.125 +#define DOER3_I0 Doer_0__I0 7.126 + 7.127 +/* Checkers and doers for Island 1. */ 7.128 +#define CHECKER2_I1 Checker_0__I1 7.129 +#define DOER2_I1 Doer_0__I1 7.130 + 7.131 +/* Checkers and doers for Island 2. */ 7.132 +#define CHECKER3_I2 Checker_0__I2 7.133 +#define DOER3_I2 Doer_0__I2 7.134 + 7.135 +//============================================================================== 7.136 + 7.137 +/* Create VPs and connect. */ 7.138 +void create_VPs_and_connect( VReoCircuit *circuit, SlaveVP *animVP ); 7.139 + 7.140 +/* Create circuit. */ 7.141 +VReoCircuit * create_circuit( SlaveVP *animVP ); 7.142 + 7.143 +/* Checkers of Island 0. */ 7.144 +bool32 Checker_0__I0( VReoIsland *island ); 7.145 + 7.146 +/* Checkers of Island 1. */ 7.147 +bool32 Checker_0__I1( VReoIsland *island ); 7.148 + 7.149 +/* Checkers of Island 2. */ 7.150 +bool32 Checker_0__I2( VReoIsland *island ); 7.151 + 7.152 +/* Doers of Island 0. */ 7.153 +void Doer_0__I0( VReoIsland *island ); 7.154 + 7.155 +/* Doers of Island 1. */ 7.156 +void Doer_0__I1( VReoIsland *island ); 7.157 + 7.158 +/* Doers of Island 2. */ 7.159 +void Doer_0__I2( VReoIsland *island ); 7.160 + 7.161 +#endif /* _Circuit_App1_H */ 7.162 \ No newline at end of file
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/Reo__Matrix_Mult/DivideWork.c Sun Feb 02 17:58:41 2014 -0800 8.3 @@ -0,0 +1,79 @@ 8.4 +/* 8.5 + * Copyright 2009 OpenSourceStewardshipFoundation.org 8.6 + * Licensed under GNU General Public License version 2 8.7 + * 8.8 + * Author: seanhalle@yahoo.com 8.9 + * 8.10 + */ 8.11 + 8.12 + 8.13 +#include "Reo__Matrix_Mult.h" 8.14 +#include <stdlib.h> 8.15 + 8.16 +/*Divider chunks row-col pairs together, and creates a "workUnit" for each 8.17 + * It takes the square root of the target number of pieces, and 8.18 + * divides the number of rows/cols by that, to get the target number 8.19 + * of rows/cols in a single piece. For now, only works with powers of 2, 8.20 + * to keep the algorithms simple. 8.21 + * It puts into this: 8.22 + * the left and right matrices 8.23 + * the start row and end row and start col and end col to be multiplied 8.24 + * the length of the vectors 8.25 + */ 8.26 +WorkUnitParams ** 8.27 +divideWork( Matrix *leftMatrix, Matrix *rightMatrix, int targetNumUnits ) 8.28 + { 8.29 + WorkUnitParams *workUnitParams, **workUnits; 8.30 + Matrix *leftMatrix, *rightMatrix, *resultMatrix; 8.31 + int retCode; 8.32 + int targetDivisor, targetIncrement; 8.33 + 8.34 +// printf("start divide\n"); fflush(stdin); 8.35 + 8.36 + if( leftMatrix->numRows != rightMatrix->numCols ) 8.37 + { printf("error: left num rows must == right num cols\n"); exit(0);} 8.38 + if( leftMatrix->numRows % 4 != 0 ) 8.39 + { printf("error: left num rows must be divisible by 4\n"); exit(0);} 8.40 + 8.41 + targetDivisor = (int)sqrt( targetNumUnits ); 8.42 + targetIncrement = (int)(leftMatrix->numRows / targetDivisor); 8.43 + if( targetDivisor * targetDivisor != targetNumUnits || 8.44 + targetIncrement * targetDivisor != leftMatrix->numRows ) 8.45 + { printf("error: the target number of units to be made must be a perfect square and it must evenly divide the left number of rows (vector length)\n"); 8.46 + fflush(stdout); exit(0); 8.47 + } 8.48 + 8.49 + 8.50 + //make a data struct for each work unit, and fill it with params of work 8.51 + //params are start and end row and col to be multiplied and length of a row 8.52 + workUnits = PR__malloc( sizeof(WorkUnitParams) ); 8.53 + int row, col, index = 0; 8.54 + for( row = 0; row < leftMatrix->numRows; row += targetIncrement ) 8.55 + { 8.56 + for( col = 0; col < rightMatrix->numCols; col += targetIncrement ) 8.57 + { 8.58 + workUnitParams = PR__malloc( sizeof(WorkUnitParams) ); 8.59 + workUnitParams->startRow = row; 8.60 + workUnitParams->endRow = row + targetIncrement -1; 8.61 + workUnitParams->startCol = col; 8.62 + workUnitParams->endCol = col + targetIncrement -1; 8.63 + workUnitParams->vectLength = leftMatrix->numCols; 8.64 + workUnitParams->leftMatrix = leftMatrix; 8.65 + workUnitParams->rightMatrix = rightMatrix; 8.66 + 8.67 + workUnits[ index ] = workUnitParams; 8.68 + index += 1; 8.69 + } 8.70 + } 8.71 + return workUnits; 8.72 + } 8.73 + 8.74 + 8.75 + 8.76 + resultsParams = malloc( sizeof(ResultsParams) ); 8.77 + resultsParams->numCols = rightMatrix->numCols; 8.78 + resultsParams->numRows = leftMatrix->numRows; 8.79 + 8.80 + //=========== Set up global vars, including conds and mutexes =========== 8.81 + globals = malloc( sizeof(MatrixMultGlobals) ); 8.82 + //========================================================================
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/Reo__Matrix_Mult/Producer_and_Consumer.c Sun Feb 02 17:58:41 2014 -0800 9.3 @@ -0,0 +1,192 @@ 9.4 +#include <math.h> 9.5 +#include <string.h> 9.6 +#include "VReo__Test_App.h" 9.7 + 9.8 +/*The input to a VP's birth function is a struct that holds two arrays of 9.9 + * pointers to bridges -- one for input bridges, one for output bridges 9.10 + */ 9.11 +void producer_Fn(void *_birthParams, SlaveVP *animVP) { 9.12 + TestAppProducerParams *birthParams = (TestAppProducerParams *) _birthParams; 9.13 + 9.14 + //Tell the Reo tool that generates circuit about the bridges of this VP 9.15 + //#Reo numInBridges 0 | numOutbridges 1 9.16 + VReoBridge **outBridges = birthParams->outBridges; 9.17 + VReoBridge *bridge; 9.18 + TestAppProdConsMsg *msg; 9.19 + int32 i; 9.20 + 9.21 + DEBUG__printf(dbgAppFlow, "Producer on core: %d", animVP->coreAnimatedBy); 9.22 + 9.23 + bridge = outBridges[0]; 9.24 + 9.25 + 9.26 + msg = PR__malloc(sizeof(TestAppProdConsMsg)); 9.27 + msg->producerID = animVP->slaveNum; 9.28 + 9.29 + //A producer puts out 5 items, doing a print for each. 9.30 + for (i = 0; i < NUM_ITER; i++) { 9.31 + //msg = PR__malloc(sizeof(TestAppProdConsMsg)); 9.32 + //msg->producerID = animVP->slaveNum; 9.33 + msg->producedCnt = i + 1; 9.34 + VReo__put_into_bridge(msg, bridge, animVP); 9.35 + DEBUG__printf(dbgAppFlow, "Producer %d, put in %d", msg->producerID, 9.36 + msg->producedCnt); 9.37 + } 9.38 + VReo__end_VP(animVP); 9.39 +} 9.40 + 9.41 + 9.42 +/*Accumulate the results of individual multiplies into the result matrix 9.43 + * then increment the count of results. 9.44 + * 9.45 + *After the count reaches the point that all results have been received, it 9.46 + * ends itself -- result matrix is returned by side effect inside the params. 9.47 + */ 9.48 +void consumer_Fn(void *_params, SlaveVP *animVP) { 9.49 + ResultsParams *params = (ResultsParams *) _params; 9.50 + 9.51 + //The circuit creator sends the bridges this VP is connected to 9.52 + // numInBridges 2 | numOutbridges 0 9.53 + VReoBridge **inBridges = params->inBridges; 9.54 + VReoBridge **outBridges = params->outBridges; 9.55 + VReoBridge *inBridge0, *inBridge1; 9.56 + int32 i, j, got; 9.57 + TestAppProdConsMsg *msg; 9.58 + 9.59 + DEBUG__printf(dbgAppFlow, "Consumer on core: %d", animVP->coreAnimatedBy); 9.60 + 9.61 + inBridge0 = inBridges[0]; 9.62 + inBridge1 = inBridges[1]; 9.63 + 9.64 + 9.65 + int numRows, numCols, numCells, count=0; 9.66 + float32 *resultMatrixArray; 9.67 + ProductResult *aResult; 9.68 + VectorParams *aResult; 9.69 + 9.70 + 9.71 + params = (ResultsParams *)_params; 9.72 + numCols = params->numCols; 9.73 + numRows = params->numRows; 9.74 + numCells = numRows * numCols; 9.75 + 9.76 + resultMatrixArray = malloc( numCells * sizeof( float32 ) ); 9.77 + params->resultMatrixArray = resultMatrixArray; 9.78 + 9.79 +// sleep(10); 9.80 + NUM_PROD = params->numProducers; 9.81 + int32 row, col; 9.82 + 9.83 + for (i = 0; i < NUM_ITER; i++) 9.84 + { 9.85 + for (j = 0; j < NUM_PROD; j++) 9.86 + { 9.87 + //get next result from a producer 9.88 + aResult = (ProductResult *) VReo__get_from_bridge(inBridge0, animVP); 9.89 + DEBUG__printf( dbgAppFlow, "Consumer got %d from %d", 9.90 + aResult->producedCnt, aResult->producerID ); 9.91 + aResArray = aResult->array; 9.92 + 9.93 + accumulateResult( resultArray, aResult->partialResultArray, 9.94 + aResult->leftSubMatrix->origStartRow, 9.95 + aResult->leftSubMatrix->numRows, 9.96 + aResult->rightSubMatrix->origStartCol, 9.97 + aResult->rightSubMatrix->numCols, 9.98 + aResult->rightSubMatrix->origMatrix->numCols ); 9.99 + 9.100 + PR__free(aResult); 9.101 + } 9.102 + 9.103 + //tell producers they can go on to next matrix 9.104 + VReo__get_from_bridge(inBridge1, animVP); //doing a get triggers broadcast 9.105 + } 9.106 + VReo__end_VP(animVP); 9.107 + } 9.108 + 9.109 +inline void 9.110 +accumulateResult( float32 *resultArray, float32 *subMatrixPairResultArray, 9.111 + int32 startRow, 9.112 + int32 numRows, 9.113 + int32 startCol, 9.114 + int32 numCols, 9.115 + int32 numOrigCols ) 9.116 + { int32 row, col; 9.117 + 9.118 + for( row = 0; row < numRows; row++ ) 9.119 + { 9.120 + for( col = 0; col < numCols; col++ ) 9.121 + { 9.122 + resultArray[ (row + startRow) * numOrigCols + (col + startCol) ] += 9.123 + subMatrixPairResultArray[ row * numCols + col ]; 9.124 + } 9.125 + } 9.126 + 9.127 + } 9.128 + 9.129 + 9.130 + startRow = aResult->leftSubMatrix->origStartRow; 9.131 + numRows = aResult->leftSubMatrix->numRows, 9.132 + startCol = aResult->rightSubMatrix->origStartCol, 9.133 + numCols = aResult->rightSubMatrix->numCols, 9.134 + numOrigCols = aResult->rightSubMatrix->origMatrix->numCols 9.135 + 9.136 + for( row = 0; row < numRows; row++ ) 9.137 + { 9.138 + for( col = 0; col < numCols; col++ ) 9.139 + { 9.140 + resultArray[ (row + startRow) * numOrigCols + (col + startCol) ] += 9.141 + aResArray[ row * numCols + col ]; 9.142 + } 9.143 + } 9.144 + 9.145 + 9.146 +//===================================== 9.147 +/*A Vector processor is created with an environment that holds two matrices, 9.148 + * the row and col that it owns, and the name of a result gathering 9.149 + * processor. 9.150 + *It calculates its vector product then sends the result to the result 9.151 + * processor, which puts it into the result matrix and returns that matrix 9.152 + * when all is done. 9.153 + */ 9.154 +void * 9.155 +calcVector( void *data ) 9.156 + { 9.157 + VectorParams *params; 9.158 + int myRow, myCol, vectLength, pos; 9.159 + float32 *leftMatrixArray, *rightMatrixArray, result = 0.0; 9.160 + Matrix *leftMatrix, *rightMatrix; 9.161 + 9.162 + params = (VectorParams *)data; 9.163 + myCol = params->myCol; 9.164 + myRow = params->myRow; 9.165 + vectLength = params->vectLength; 9.166 + leftMatrix = params->leftMatrix; 9.167 + rightMatrix = params->rightMatrix; 9.168 + leftMatrixArray = leftMatrix->array; 9.169 + rightMatrixArray = rightMatrix->array; 9.170 + //===================== DEBUG ====================== 9.171 + #ifdef PRINT_DEBUG_1 9.172 + if( myCol == 0 ) 9.173 + printf("start vector: %d, %d\n", myRow, myCol ); fflush(stdin); 9.174 + #endif 9.175 + //==================================================== 9.176 + 9.177 + for( pos = 0; pos < vectLength; pos++ ) 9.178 + { 9.179 + result += *(leftMatrixArray + myRow * vectLength + pos) * 9.180 + *(rightMatrixArray + pos * vectLength + myCol); 9.181 + } 9.182 + params->result = result; 9.183 + 9.184 + //Send result to results thread 9.185 + pthread_mutex_lock( &(globals->vector_mutex) );//only get 9.186 + //the lock when results thd is inside wait. 9.187 + globals->currVector = params; 9.188 + pthread_cond_signal( &(globals->vector_cond) ); 9.189 + pthread_mutex_unlock( &(globals->vector_mutex) );//release 9.190 + //wait-er -- cond_signal implemented such that wait-er gets lock, no other 9.191 + 9.192 + pthread_exit(0); 9.193 + } 9.194 + 9.195 +//=======================================
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/Reo__Matrix_Mult/Reo__Matrix_Mult.h Sun Feb 02 17:58:41 2014 -0800 10.3 @@ -0,0 +1,96 @@ 10.4 +#ifndef _VReo_TEST_APP_H_ 10.5 +#define _VReo_TEST_APP_H_ 10.6 + 10.7 +#include <stdio.h> 10.8 + 10.9 +#include <PR__include/langlets/vreo_wrapper_library.h> 10.10 +#include "Circuit.h" 10.11 + 10.12 + 10.13 +extern int NUM_ITER; 10.14 + 10.15 +//=============================== Defines ============================== 10.16 + 10.17 +//============================== Structures ============================== 10.18 +typedef struct 10.19 + { 10.20 + Matrix *leftMatrix; 10.21 + Matrix *rightMatrix; 10.22 + Matrix *resultMatrix; 10.23 + } 10.24 +DividerParams; 10.25 + 10.26 +typedef struct 10.27 + { 10.28 + int numRows; 10.29 + int numCols; 10.30 + } 10.31 +ResultsParams; 10.32 + 10.33 +typedef struct 10.34 + { 10.35 + int myCol; 10.36 + int myRow; 10.37 + int vectLength; 10.38 + Matrix *leftMatrix; 10.39 + Matrix *rightMatrix; 10.40 + float32 result; 10.41 + } 10.42 +VectorParams; 10.43 + 10.44 +typedef struct 10.45 + { 10.46 + //for communicating vector results to results Thd 10.47 + pthread_mutex_t vector_mutex; 10.48 + pthread_cond_t vector_cond; 10.49 + VectorParams *currVector; 10.50 + 10.51 + //for communicating results array back to seed (divider) Thd 10.52 + pthread_mutex_t results_mutex; 10.53 + pthread_cond_t results_cond; 10.54 + float32 *results; 10.55 + 10.56 + //for ensuring results thd has vector lock before making vector thds 10.57 + pthread_mutex_t start_mutex; 10.58 + pthread_cond_t start_cond; 10.59 + 10.60 + Matrix *rightMatrix; 10.61 + Matrix *resultMatrix; 10.62 + } 10.63 +MatrixMultGlobals; 10.64 + 10.65 + 10.66 +// NOTE: this is a birth function param. The first field of any structure 10.67 +// that is passed as the argument to a birth function must be a pointer to 10.68 +// the Reo circuit 10.69 +typedef struct { //The first field must be pointer to a circuit (because is param to birth Fn) 10.70 + VReoCircuit *circuit; //First field must ALWAYS be a pointer to a circuit 10.71 + 10.72 + VReoBridge **inBridges; //array of pointers into circuit's array of bridges 10.73 + VReoBridge **outBridges; //array of pointers into circuit's array of bridges 10.74 +} TestAppProducerParams; 10.75 + 10.76 +typedef struct { //The first field must be pointer to a circuit (because is param to birth Fn) 10.77 + VReoCircuit *circuit; //First field must ALWAYS be a pointer to a circuit 10.78 + 10.79 + VReoBridge **inBridges; //array of pointers into circuit's array of bridges 10.80 + VReoBridge **outBridges; //array of pointers into circuit's array of bridges 10.81 +} TestAppConsumerParams; 10.82 + 10.83 +typedef struct { 10.84 + int32 producerID; 10.85 + int32 producedCnt; 10.86 +} TestAppProdConsMsg; 10.87 + 10.88 +//============================= Processor Functions ========================= 10.89 +void matrix_mult__seed_Fn(void *data, SlaveVP *animatingVP); //seed VP function 10.90 +void producer_Fn(void *data, SlaveVP *animatingVP); 10.91 +void consumer_Fn(void *data, SlaveVP *animatingVP); 10.92 + 10.93 +void *divideIntoVectors( void *data ); 10.94 +void *calcVector( void *data ); 10.95 +void *gatherResults( void *data ); 10.96 + 10.97 +//================================ Global Vars ============================== 10.98 + 10.99 +#endif
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/Reo__Matrix_Mult/Result_Pr.c Sun Feb 02 17:58:41 2014 -0800 11.3 @@ -0,0 +1,9 @@ 11.4 +/* 11.5 + * Copyright 2009 OpenSourceCodeStewardshipFoundation.org 11.6 + * Licensed under GNU General Public License version 2 11.7 + * 11.8 + * Author: seanhalle@yahoo.com 11.9 + * 11.10 + */ 11.11 + 11.12 +#include "PThread__Matrix_Mult.h"
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/Reo__Matrix_Mult/SeedVP.c Sun Feb 02 17:58:41 2014 -0800 12.3 @@ -0,0 +1,169 @@ 12.4 +#include <math.h> 12.5 +#include <string.h> 12.6 + 12.7 +#include "VReo__Test_App.h" 12.8 + 12.9 +#define NO_INPUT NULL 12.10 + 12.11 +// ============================================================================= 12.12 + 12.13 +//SELECT how the measurement is done 12.14 +//only one must be enabled 12.15 +#define MEASURE_TSC 12.16 +//#define MEASURE_PERF 12.17 + 12.18 +#define saveTimeStampCountInto(low, high) \ 12.19 + asm volatile("RDTSC; \ 12.20 + movl %%eax, %0; \ 12.21 + movl %%edx, %1;" \ 12.22 + /* outputs */ : "=m" (low), "=m" (high)\ 12.23 + /* inputs */ : \ 12.24 + /* clobber */ : "%eax", "%edx" \ 12.25 + ); 12.26 + 12.27 +#define saveLowTimeStampCountInto(low) \ 12.28 + asm volatile("RDTSC; \ 12.29 + movl %%eax, %0;" \ 12.30 + /* outputs */ : "=m" (low) \ 12.31 + /* inputs */ : \ 12.32 + /* clobber */ : "%eax", "%edx" \ 12.33 + ); 12.34 + 12.35 +union timeStamp { 12.36 + uint32_t lowHigh[2]; //lowHigh[0] is low, lowHigh[1] is high 12.37 + uint64_t total; 12.38 +}; 12.39 + 12.40 +struct perfData { 12.41 + uint64_t cycles; 12.42 + uint64_t instructions; 12.43 +}; 12.44 + 12.45 +//MEASURE_TSC should be mutually exclusive with MEASURE_PERF 12.46 +#ifdef MEASURE_TSC 12.47 +typedef union timeStamp MeasStruct; 12.48 +#else 12.49 +#ifdef MEASURE_PERF 12.50 +typedef struct perfData MeasStruct; 12.51 +#endif 12.52 +#endif 12.53 + 12.54 + 12.55 +//read and save current perf-counter readings for cycles and instrs 12.56 +#ifdef MEASURE_PERF 12.57 +#define takeAMeas(core, perfDataStruct) do{ \ 12.58 + int cycles_fd = cycles_counter_fd[core]; \ 12.59 + int nread; \ 12.60 + \ 12.61 + nread = read(cycles_fd,&(perfDataStruct.cycles),sizeof(perfDataStruct.cycles)); \ 12.62 + if(nread<0){ \ 12.63 + perror("Error reading cycles counter"); \ 12.64 + cycles = 0; \ 12.65 + } \ 12.66 + } while (0) //macro magic for scoping 12.67 +#else 12.68 +#define takeAMeas(core, timeStampStruct) do{ \ 12.69 + saveTimeStampCountInto(timeStampStruct.lowHigh[0], timeStampStruct.lowHigh[1]);\ 12.70 + } while (0) //macro magic for scoping 12.71 +#endif 12.72 + 12.73 +#ifdef MEASURE_PERF 12.74 +int cycles_counter_fd[NUM_CORES]; 12.75 +int instrs_counter_fd[NUM_CORES]; 12.76 +int cycles_counter_main_fd; 12.77 +#endif 12.78 + 12.79 +//=================================== 12.80 +/* provide a millisecond-resolution timer for each system */ 12.81 +#if defined(unix) || defined(__unix__) 12.82 +#include <time.h> 12.83 +#include <sys/time.h> 12.84 +unsigned long get_msec(void) { 12.85 + static struct timeval timeval, first_timeval; 12.86 + 12.87 + gettimeofday(&timeval, 0); 12.88 + if(first_timeval.tv_sec == 0) { 12.89 + first_timeval = timeval; 12.90 + return 0; 12.91 + } 12.92 + return (timeval.tv_sec - first_timeval.tv_sec) * 1000 + (timeval.tv_usec - first_timeval.tv_usec) / 1000; 12.93 +} 12.94 +#elif defined(__WIN32__) || defined(WIN32) 12.95 +#include <windows.h> 12.96 +unsigned long get_msec(void) { 12.97 + return GetTickCount(); 12.98 +} 12.99 +#else 12.100 +#error "I don't know how to measure time on your platform" 12.101 +#endif 12.102 + 12.103 +// ============================================================================= 12.104 + 12.105 +/*The _params was passed into the create_process call inside main. 12.106 + * 12.107 + * the seed first starts up VReo, then it calls the create circuit Fn, 12.108 + which returns a pointer to the circuit, then it calls create_VP three 12.109 + times. The first, it hands it the pointer to the producer Fn, along with 12.110 + a pointer to the circuit and an integer that indicates that it connects to 12.111 + bridge 1 of the circuit. Second, it creates another producer, but connected 12.112 + to bridge 2, then it creates a consumer connected to bridge 3. 12.113 + 12.114 + Then, it waits for the computation to end. 12.115 + 12.116 + A producer puts out 5 items, doing a print for each. The consumer consumes 12.117 + 10 items, doing a print for each. 12.118 + 12.119 + Then each of them call "end_VP". 12.120 + 12.121 + That ends the computation, and the seed comes back, and calls "end_seed_VP" 12.122 + 12.123 + */ 12.124 +void matrix_mult__seed_Fn(void *_params, SlaveVP *seedVP) 12.125 + { 12.126 + 12.127 + /* Declare variables. */ 12.128 + VReoCircuit *circuit; 12.129 + 12.130 + /* Log. */ 12.131 + DEBUG__printf(dbgAppFlow, "start app"); 12.132 + 12.133 + /* Start Reo plug-in. */ 12.134 + VReo__start(seedVP); 12.135 + 12.136 + 12.137 + //take measurement before creation of threads, to get total exetime 12.138 + MeasStruct benchStartMeas, benchEndMeas; 12.139 + takeAMeas(0, benchStartMeas); 12.140 + 12.141 + /* Create circuit. */ 12.142 + circuit = (VReoCircuit *) create_circuit(seedVP); 12.143 + 12.144 + /* Create VPs. */ 12.145 + create_VPs_and_connect(circuit, seedVP); 12.146 + 12.147 + /* Wait for work to end. */ 12.148 + VReo__wait_for_all_VReo_created_work_to_end(seedVP); 12.149 + 12.150 + /* Log. */ 12.151 + DEBUG__printf(TRUE, "work done"); 12.152 + 12.153 + //work is all done, so take a measurement snapshot at end 12.154 + takeAMeas(0, benchEndMeas); 12.155 + 12.156 + #ifdef MEASURE_PERF 12.157 + uint64_t totalExeCycles = ( benchEndMeas.cycles - benchStartMeas.cycles); 12.158 + printf("Total Execution: %lu\n", totalExeCycles); 12.159 + #else 12.160 + uint64_t totalExeCycles = (benchEndMeas.total - benchStartMeas.total); 12.161 + printf("Total Cycles of Execution: %lu\n", totalExeCycles); 12.162 + #endif 12.163 + 12.164 + fflush(stdout); 12.165 + exit(0); 12.166 + 12.167 + /* Stop Reo plug-in. */ 12.168 + VReo__shutdown(seedVP); 12.169 + 12.170 + /* Stop PR. */ 12.171 + PR__end_process_from_inside(seedVP); 12.172 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/Reo__Matrix_Mult/Vector_Pr.c Sun Feb 02 17:58:41 2014 -0800 13.3 @@ -0,0 +1,10 @@ 13.4 +/* 13.5 + * Copyright 2009 OpenSourceCodeStewardshipFoundation.org 13.6 + * Licensed under GNU General Public License version 2 13.7 + * 13.8 + * Author: SeanHalle@yahoo.com 13.9 + * 13.10 + */ 13.11 + 13.12 +#include "Reo__Matrix_Mult.h" 13.13 +
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/main.c Sun Feb 02 17:58:41 2014 -0800 14.3 @@ -0,0 +1,109 @@ 14.4 +#include <malloc.h> 14.5 +#include <stdlib.h> 14.6 +#include <PR__include/PR__WL.h> 14.7 + 14.8 +#include "Matrix_Mult.h" 14.9 +#include "Reo__Matrix_Mult/Reo__Matrix_Mult.h" 14.10 + 14.11 +void set_up_performance_counters(); 14.12 + 14.13 +// ============================================================================= 14.14 + 14.15 +int NUM_ITER; 14.16 + 14.17 +MatrixMultGlobals *globals; 14.18 + 14.19 +int main(int argc, char **argv) 14.20 + { Matrix *leftMatrix, *rightMatrix, *resultMatrix; 14.21 + ParamBag *paramBag; 14.22 + 14.23 + DEBUG__printf(TRUE, "arguments: %s | %s", argv[0], argv[1]); 14.24 + if(argc < 3) {printf("give num iter and path to param file on cmd line\n"); exit(1);} 14.25 + NUM_ITER = atoi(argv[1]); 14.26 + 14.27 + //read parameters, from file whose path is given on command line 14.28 + paramBag = makeParamBag(); 14.29 + readParamFileIntoBag( argv[2], paramBag ); 14.30 + initialize_Input_Matrices_Via( &leftMatrix, &rightMatrix, paramBag ); 14.31 + 14.32 + 14.33 + printf("[reo] Settings: %i workers, %i iterations -- ", NUM_PROD, NUM_ITER); 14.34 + 14.35 + set_up_performance_counters(); 14.36 + 14.37 + PRProcess *matrixMultProcess; 14.38 + PR_Main__start(); 14.39 + PR_Main__set_app_info( "matrix multiply prod cons in Reo" ); 14.40 + 14.41 + PR_Main__set_input_info( getParamFromBag( "inputInfo", paramBag ) ); 14.42 + 14.43 + params->resultMatrix = malloc( numRows * numCols * sizeof(double) ); 14.44 + params->workUnits = divideWork( leftInput, rightInput, numUnitsToMake ); 14.45 + 14.46 + matrixMultProcess = PR_Main__create_process(&matrix_mult__seed_Fn, params); 14.47 + 14.48 + PR_Main__wait_for_process_to_end(matrixMultProcess); 14.49 + PR__Main__wait_for_all_activity_to_end(); 14.50 + fflush(stdout); 14.51 + PR_Main__shutdown(); 14.52 + 14.53 + exit(0); 14.54 + } 14.55 + 14.56 +// ============================================================================= 14.57 + 14.58 +/*Initializes the performance counters, and opens the file descriptors used 14.59 + * to read from the performance counters 14.60 + */ 14.61 +void set_up_performance_counters() { 14.62 + int i; 14.63 + 14.64 +#ifdef MEASURE_PERF 14.65 + //setup performance counters 14.66 + struct perf_event_attr hw_event; 14.67 + memset(&hw_event,0,sizeof(hw_event)); 14.68 + hw_event.type = PERF_TYPE_HARDWARE; 14.69 + hw_event.size = sizeof(hw_event); 14.70 + hw_event.disabled = 0; 14.71 + hw_event.freq = 0; 14.72 + hw_event.inherit = 1; /* children inherit it */ 14.73 + hw_event.pinned = 1; /* must always be on PMU */ 14.74 + hw_event.exclusive = 0; /* only group on PMU */ 14.75 + hw_event.exclude_user = 0; /* don't count user */ 14.76 + hw_event.exclude_kernel = 1; /* ditto kernel */ 14.77 + hw_event.exclude_hv = 1; /* ditto hypervisor */ 14.78 + hw_event.exclude_idle = 1; /* don't count when idle */ 14.79 + hw_event.mmap = 0; /* include mmap data */ 14.80 + hw_event.comm = 0; /* include comm data */ 14.81 + 14.82 + for( i = 0; i < NUM_CORES; i++ ) 14.83 + { 14.84 + hw_event.config = PERF_COUNT_HW_CPU_CYCLES; //cycles 14.85 + cycles_counter_fd[i] = syscall(__NR_perf_event_open, &hw_event, 14.86 + 0,//pid_t pid, 14.87 + i,//int cpu, 14.88 + -1,//int group_fd, 14.89 + 0//unsigned long flags 14.90 + ); 14.91 + if (cycles_counter_fd[i]<0) { 14.92 + fprintf(stderr,"On core %d: ",i); 14.93 + perror("Failed to open cycles counter"); 14.94 + } 14.95 + } 14.96 + 14.97 + int cycles_counter_main_fd; 14.98 + hw_event.config = PERF_COUNT_HW_CPU_CYCLES; //cycles 14.99 + hw_event.exclude_kernel=0; 14.100 + cycles_counter_main_fd = syscall(__NR_perf_event_open, &hw_event, 14.101 + 0,//pid_t pid, 14.102 + -1,//int cpu, 14.103 + -1,//int group_fd, 14.104 + 0//unsigned long flags 14.105 + ); 14.106 + if (cycles_counter_main_fd<0) { 14.107 + perror("Failed to open main cycles counter"); 14.108 + } 14.109 + 14.110 +#endif 14.111 +} 14.112 +
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/nb__Reo_matrix_mult/Makefile Sun Feb 02 17:58:41 2014 -0800 15.3 @@ -0,0 +1,128 @@ 15.4 +# 15.5 +# There exist several targets which are by default empty and which can be 15.6 +# used for execution of your targets. These targets are usually executed 15.7 +# before and after some main targets. They are: 15.8 +# 15.9 +# .build-pre: called before 'build' target 15.10 +# .build-post: called after 'build' target 15.11 +# .clean-pre: called before 'clean' target 15.12 +# .clean-post: called after 'clean' target 15.13 +# .clobber-pre: called before 'clobber' target 15.14 +# .clobber-post: called after 'clobber' target 15.15 +# .all-pre: called before 'all' target 15.16 +# .all-post: called after 'all' target 15.17 +# .help-pre: called before 'help' target 15.18 +# .help-post: called after 'help' target 15.19 +# 15.20 +# Targets beginning with '.' are not intended to be called on their own. 15.21 +# 15.22 +# Main targets can be executed directly, and they are: 15.23 +# 15.24 +# build build a specific configuration 15.25 +# clean remove built files from a configuration 15.26 +# clobber remove all built files 15.27 +# all build all configurations 15.28 +# help print help mesage 15.29 +# 15.30 +# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and 15.31 +# .help-impl are implemented in nbproject/makefile-impl.mk. 15.32 +# 15.33 +# Available make variables: 15.34 +# 15.35 +# CND_BASEDIR base directory for relative paths 15.36 +# CND_DISTDIR default top distribution directory (build artifacts) 15.37 +# CND_BUILDDIR default top build directory (object files, ...) 15.38 +# CONF name of current configuration 15.39 +# CND_PLATFORM_${CONF} platform name (current configuration) 15.40 +# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) 15.41 +# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) 15.42 +# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) 15.43 +# CND_PACKAGE_DIR_${CONF} directory of package (current configuration) 15.44 +# CND_PACKAGE_NAME_${CONF} name of package (current configuration) 15.45 +# CND_PACKAGE_PATH_${CONF} path to package (current configuration) 15.46 +# 15.47 +# NOCDDL 15.48 + 15.49 + 15.50 +# Environment 15.51 +MKDIR=mkdir 15.52 +CP=cp 15.53 +CCADMIN=CCadmin 15.54 + 15.55 + 15.56 +# build 15.57 +build: .build-post 15.58 + 15.59 +.build-pre: 15.60 +# Add your pre 'build' code here... 15.61 + 15.62 +.build-post: .build-impl 15.63 +# Add your post 'build' code here... 15.64 + 15.65 + 15.66 +# clean 15.67 +clean: .clean-post 15.68 + 15.69 +.clean-pre: 15.70 +# Add your pre 'clean' code here... 15.71 + 15.72 +.clean-post: .clean-impl 15.73 +# Add your post 'clean' code here... 15.74 + 15.75 + 15.76 +# clobber 15.77 +clobber: .clobber-post 15.78 + 15.79 +.clobber-pre: 15.80 +# Add your pre 'clobber' code here... 15.81 + 15.82 +.clobber-post: .clobber-impl 15.83 +# Add your post 'clobber' code here... 15.84 + 15.85 + 15.86 +# all 15.87 +all: .all-post 15.88 + 15.89 +.all-pre: 15.90 +# Add your pre 'all' code here... 15.91 + 15.92 +.all-post: .all-impl 15.93 +# Add your post 'all' code here... 15.94 + 15.95 + 15.96 +# build tests 15.97 +build-tests: .build-tests-post 15.98 + 15.99 +.build-tests-pre: 15.100 +# Add your pre 'build-tests' code here... 15.101 + 15.102 +.build-tests-post: .build-tests-impl 15.103 +# Add your post 'build-tests' code here... 15.104 + 15.105 + 15.106 +# run tests 15.107 +test: .test-post 15.108 + 15.109 +.test-pre: 15.110 +# Add your pre 'test' code here... 15.111 + 15.112 +.test-post: .test-impl 15.113 +# Add your post 'test' code here... 15.114 + 15.115 + 15.116 +# help 15.117 +help: .help-post 15.118 + 15.119 +.help-pre: 15.120 +# Add your pre 'help' code here... 15.121 + 15.122 +.help-post: .help-impl 15.123 +# Add your post 'help' code here... 15.124 + 15.125 + 15.126 + 15.127 +# include project implementation makefile 15.128 +include nbproject/Makefile-impl.mk 15.129 + 15.130 +# include project make variables 15.131 +include nbproject/Makefile-variables.mk
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/nb__Reo_matrix_mult/nbproject/Makefile-Debug.mk Sun Feb 02 17:58:41 2014 -0800 16.3 @@ -0,0 +1,143 @@ 16.4 +# 16.5 +# Generated Makefile - do not edit! 16.6 +# 16.7 +# Edit the Makefile in the project folder instead (../Makefile). Each target 16.8 +# has a -pre and a -post target defined where you can add customized code. 16.9 +# 16.10 +# This makefile implements configuration specific macros and targets. 16.11 + 16.12 + 16.13 +# Environment 16.14 +MKDIR=mkdir 16.15 +CP=cp 16.16 +GREP=grep 16.17 +NM=nm 16.18 +CCADMIN=CCadmin 16.19 +RANLIB=ranlib 16.20 +CC=gcc 16.21 +CCC=gcc-4.6 16.22 +CXX=gcc-4.6 16.23 +FC=gfortran 16.24 +AS=as 16.25 + 16.26 +# Macros 16.27 +CND_PLATFORM=GNU-Linux-x86 16.28 +CND_CONF=Debug 16.29 +CND_DISTDIR=dist 16.30 +CND_BUILDDIR=build 16.31 + 16.32 +# Include project Makefile 16.33 +include Makefile 16.34 + 16.35 +# Object Directory 16.36 +OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM} 16.37 + 16.38 +# Object Files 16.39 +OBJECTFILES= \ 16.40 + ${OBJECTDIR}/_ext/1702716545/Producer_and_Consumer.o \ 16.41 + ${OBJECTDIR}/_ext/1539317932/ParamBag.o \ 16.42 + ${OBJECTDIR}/_ext/1702716545/Circuit.o \ 16.43 + ${OBJECTDIR}/_ext/1472/main.o \ 16.44 + ${OBJECTDIR}/_ext/1702716545/Divide_Pr.o \ 16.45 + ${OBJECTDIR}/_ext/1472/Matrix_Mult.o \ 16.46 + ${OBJECTDIR}/_ext/1702716545/Vector_Pr.o \ 16.47 + ${OBJECTDIR}/_ext/1702716545/Result_Pr.o \ 16.48 + ${OBJECTDIR}/_ext/1702716545/EntryPoint.o \ 16.49 + ${OBJECTDIR}/_ext/1702716545/SeedVP.o \ 16.50 + ${OBJECTDIR}/_ext/1539317932/ReadParamsFromFile.o 16.51 + 16.52 + 16.53 +# C Compiler Flags 16.54 +CFLAGS= 16.55 + 16.56 +# CC Compiler Flags 16.57 +CCFLAGS= 16.58 +CXXFLAGS= 16.59 + 16.60 +# Fortran Compiler Flags 16.61 +FFLAGS= 16.62 + 16.63 +# Assembler Flags 16.64 +ASFLAGS= 16.65 + 16.66 +# Link Libraries and Options 16.67 +LDLIBSOPTIONS= 16.68 + 16.69 +# Build Targets 16.70 +.build-conf: ${BUILD_SUBPROJECTS} 16.71 + "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult 16.72 + 16.73 +${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult: ${OBJECTFILES} 16.74 + ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} 16.75 + ${LINK.c} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult ${OBJECTFILES} ${LDLIBSOPTIONS} 16.76 + 16.77 +${OBJECTDIR}/_ext/1702716545/Producer_and_Consumer.o: ../Reo__Matrix_Mult/Producer_and_Consumer.c 16.78 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 16.79 + ${RM} $@.d 16.80 + $(COMPILE.c) -g -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Producer_and_Consumer.o ../Reo__Matrix_Mult/Producer_and_Consumer.c 16.81 + 16.82 +${OBJECTDIR}/_ext/1539317932/ParamBag.o: ../ParamHelper/ParamBag.c 16.83 + ${MKDIR} -p ${OBJECTDIR}/_ext/1539317932 16.84 + ${RM} $@.d 16.85 + $(COMPILE.c) -g -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1539317932/ParamBag.o ../ParamHelper/ParamBag.c 16.86 + 16.87 +${OBJECTDIR}/_ext/1702716545/Circuit.o: ../Reo__Matrix_Mult/Circuit.c 16.88 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 16.89 + ${RM} $@.d 16.90 + $(COMPILE.c) -g -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Circuit.o ../Reo__Matrix_Mult/Circuit.c 16.91 + 16.92 +${OBJECTDIR}/_ext/1472/main.o: ../main.c 16.93 + ${MKDIR} -p ${OBJECTDIR}/_ext/1472 16.94 + ${RM} $@.d 16.95 + $(COMPILE.c) -g -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1472/main.o ../main.c 16.96 + 16.97 +${OBJECTDIR}/_ext/1702716545/Divide_Pr.o: ../Reo__Matrix_Mult/Divide_Pr.c 16.98 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 16.99 + ${RM} $@.d 16.100 + $(COMPILE.c) -g -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Divide_Pr.o ../Reo__Matrix_Mult/Divide_Pr.c 16.101 + 16.102 +${OBJECTDIR}/_ext/1472/Matrix_Mult.o: ../Matrix_Mult.c 16.103 + ${MKDIR} -p ${OBJECTDIR}/_ext/1472 16.104 + ${RM} $@.d 16.105 + $(COMPILE.c) -g -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1472/Matrix_Mult.o ../Matrix_Mult.c 16.106 + 16.107 +${OBJECTDIR}/_ext/1702716545/Vector_Pr.o: ../Reo__Matrix_Mult/Vector_Pr.c 16.108 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 16.109 + ${RM} $@.d 16.110 + $(COMPILE.c) -g -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Vector_Pr.o ../Reo__Matrix_Mult/Vector_Pr.c 16.111 + 16.112 +${OBJECTDIR}/_ext/1702716545/Result_Pr.o: ../Reo__Matrix_Mult/Result_Pr.c 16.113 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 16.114 + ${RM} $@.d 16.115 + $(COMPILE.c) -g -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Result_Pr.o ../Reo__Matrix_Mult/Result_Pr.c 16.116 + 16.117 +${OBJECTDIR}/_ext/1702716545/EntryPoint.o: ../Reo__Matrix_Mult/EntryPoint.c 16.118 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 16.119 + ${RM} $@.d 16.120 + $(COMPILE.c) -g -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/EntryPoint.o ../Reo__Matrix_Mult/EntryPoint.c 16.121 + 16.122 +${OBJECTDIR}/_ext/1702716545/SeedVP.o: ../Reo__Matrix_Mult/SeedVP.c 16.123 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 16.124 + ${RM} $@.d 16.125 + $(COMPILE.c) -g -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/SeedVP.o ../Reo__Matrix_Mult/SeedVP.c 16.126 + 16.127 +${OBJECTDIR}/_ext/1539317932/ReadParamsFromFile.o: ../ParamHelper/ReadParamsFromFile.c 16.128 + ${MKDIR} -p ${OBJECTDIR}/_ext/1539317932 16.129 + ${RM} $@.d 16.130 + $(COMPILE.c) -g -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1539317932/ReadParamsFromFile.o ../ParamHelper/ReadParamsFromFile.c 16.131 + 16.132 +# Subprojects 16.133 +.build-subprojects: 16.134 + 16.135 +# Clean Targets 16.136 +.clean-conf: ${CLEAN_SUBPROJECTS} 16.137 + ${RM} -r ${CND_BUILDDIR}/${CND_CONF} 16.138 + ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult 16.139 + 16.140 +# Subprojects 16.141 +.clean-subprojects: 16.142 + 16.143 +# Enable dependency checking 16.144 +.dep.inc: .depcheck-impl 16.145 + 16.146 +include .dep.inc
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/nb__Reo_matrix_mult/nbproject/Makefile-Debug_Sequential.mk Sun Feb 02 17:58:41 2014 -0800 17.3 @@ -0,0 +1,143 @@ 17.4 +# 17.5 +# Generated Makefile - do not edit! 17.6 +# 17.7 +# Edit the Makefile in the project folder instead (../Makefile). Each target 17.8 +# has a -pre and a -post target defined where you can add customized code. 17.9 +# 17.10 +# This makefile implements configuration specific macros and targets. 17.11 + 17.12 + 17.13 +# Environment 17.14 +MKDIR=mkdir 17.15 +CP=cp 17.16 +GREP=grep 17.17 +NM=nm 17.18 +CCADMIN=CCadmin 17.19 +RANLIB=ranlib 17.20 +CC=gcc 17.21 +CCC=gcc-4.6 17.22 +CXX=gcc-4.6 17.23 +FC=gfortran 17.24 +AS=as 17.25 + 17.26 +# Macros 17.27 +CND_PLATFORM=GNU-Linux-x86 17.28 +CND_CONF=Debug_Sequential 17.29 +CND_DISTDIR=dist 17.30 +CND_BUILDDIR=build 17.31 + 17.32 +# Include project Makefile 17.33 +include Makefile 17.34 + 17.35 +# Object Directory 17.36 +OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM} 17.37 + 17.38 +# Object Files 17.39 +OBJECTFILES= \ 17.40 + ${OBJECTDIR}/_ext/1702716545/Producer_and_Consumer.o \ 17.41 + ${OBJECTDIR}/_ext/1539317932/ParamBag.o \ 17.42 + ${OBJECTDIR}/_ext/1702716545/Circuit.o \ 17.43 + ${OBJECTDIR}/_ext/1472/main.o \ 17.44 + ${OBJECTDIR}/_ext/1702716545/Divide_Pr.o \ 17.45 + ${OBJECTDIR}/_ext/1472/Matrix_Mult.o \ 17.46 + ${OBJECTDIR}/_ext/1702716545/Vector_Pr.o \ 17.47 + ${OBJECTDIR}/_ext/1702716545/Result_Pr.o \ 17.48 + ${OBJECTDIR}/_ext/1702716545/EntryPoint.o \ 17.49 + ${OBJECTDIR}/_ext/1702716545/SeedVP.o \ 17.50 + ${OBJECTDIR}/_ext/1539317932/ReadParamsFromFile.o 17.51 + 17.52 + 17.53 +# C Compiler Flags 17.54 +CFLAGS= 17.55 + 17.56 +# CC Compiler Flags 17.57 +CCFLAGS= 17.58 +CXXFLAGS= 17.59 + 17.60 +# Fortran Compiler Flags 17.61 +FFLAGS= 17.62 + 17.63 +# Assembler Flags 17.64 +ASFLAGS= 17.65 + 17.66 +# Link Libraries and Options 17.67 +LDLIBSOPTIONS=-L../../PR__lib 17.68 + 17.69 +# Build Targets 17.70 +.build-conf: ${BUILD_SUBPROJECTS} 17.71 + "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult 17.72 + 17.73 +${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult: ${OBJECTFILES} 17.74 + ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} 17.75 + ${LINK.c} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult ${OBJECTFILES} ${LDLIBSOPTIONS} 17.76 + 17.77 +${OBJECTDIR}/_ext/1702716545/Producer_and_Consumer.o: ../Reo__Matrix_Mult/Producer_and_Consumer.c 17.78 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 17.79 + ${RM} $@.d 17.80 + $(COMPILE.c) -g -DDEBUG__SEQUENTIAL_MODE -I../.. -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Producer_and_Consumer.o ../Reo__Matrix_Mult/Producer_and_Consumer.c 17.81 + 17.82 +${OBJECTDIR}/_ext/1539317932/ParamBag.o: ../ParamHelper/ParamBag.c 17.83 + ${MKDIR} -p ${OBJECTDIR}/_ext/1539317932 17.84 + ${RM} $@.d 17.85 + $(COMPILE.c) -g -DDEBUG__SEQUENTIAL_MODE -I../.. -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1539317932/ParamBag.o ../ParamHelper/ParamBag.c 17.86 + 17.87 +${OBJECTDIR}/_ext/1702716545/Circuit.o: ../Reo__Matrix_Mult/Circuit.c 17.88 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 17.89 + ${RM} $@.d 17.90 + $(COMPILE.c) -g -DDEBUG__SEQUENTIAL_MODE -I../.. -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Circuit.o ../Reo__Matrix_Mult/Circuit.c 17.91 + 17.92 +${OBJECTDIR}/_ext/1472/main.o: ../main.c 17.93 + ${MKDIR} -p ${OBJECTDIR}/_ext/1472 17.94 + ${RM} $@.d 17.95 + $(COMPILE.c) -g -DDEBUG__SEQUENTIAL_MODE -I../.. -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1472/main.o ../main.c 17.96 + 17.97 +${OBJECTDIR}/_ext/1702716545/Divide_Pr.o: ../Reo__Matrix_Mult/Divide_Pr.c 17.98 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 17.99 + ${RM} $@.d 17.100 + $(COMPILE.c) -g -DDEBUG__SEQUENTIAL_MODE -I../.. -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Divide_Pr.o ../Reo__Matrix_Mult/Divide_Pr.c 17.101 + 17.102 +${OBJECTDIR}/_ext/1472/Matrix_Mult.o: ../Matrix_Mult.c 17.103 + ${MKDIR} -p ${OBJECTDIR}/_ext/1472 17.104 + ${RM} $@.d 17.105 + $(COMPILE.c) -g -DDEBUG__SEQUENTIAL_MODE -I../.. -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1472/Matrix_Mult.o ../Matrix_Mult.c 17.106 + 17.107 +${OBJECTDIR}/_ext/1702716545/Vector_Pr.o: ../Reo__Matrix_Mult/Vector_Pr.c 17.108 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 17.109 + ${RM} $@.d 17.110 + $(COMPILE.c) -g -DDEBUG__SEQUENTIAL_MODE -I../.. -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Vector_Pr.o ../Reo__Matrix_Mult/Vector_Pr.c 17.111 + 17.112 +${OBJECTDIR}/_ext/1702716545/Result_Pr.o: ../Reo__Matrix_Mult/Result_Pr.c 17.113 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 17.114 + ${RM} $@.d 17.115 + $(COMPILE.c) -g -DDEBUG__SEQUENTIAL_MODE -I../.. -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Result_Pr.o ../Reo__Matrix_Mult/Result_Pr.c 17.116 + 17.117 +${OBJECTDIR}/_ext/1702716545/EntryPoint.o: ../Reo__Matrix_Mult/EntryPoint.c 17.118 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 17.119 + ${RM} $@.d 17.120 + $(COMPILE.c) -g -DDEBUG__SEQUENTIAL_MODE -I../.. -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/EntryPoint.o ../Reo__Matrix_Mult/EntryPoint.c 17.121 + 17.122 +${OBJECTDIR}/_ext/1702716545/SeedVP.o: ../Reo__Matrix_Mult/SeedVP.c 17.123 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 17.124 + ${RM} $@.d 17.125 + $(COMPILE.c) -g -DDEBUG__SEQUENTIAL_MODE -I../.. -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/SeedVP.o ../Reo__Matrix_Mult/SeedVP.c 17.126 + 17.127 +${OBJECTDIR}/_ext/1539317932/ReadParamsFromFile.o: ../ParamHelper/ReadParamsFromFile.c 17.128 + ${MKDIR} -p ${OBJECTDIR}/_ext/1539317932 17.129 + ${RM} $@.d 17.130 + $(COMPILE.c) -g -DDEBUG__SEQUENTIAL_MODE -I../.. -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1539317932/ReadParamsFromFile.o ../ParamHelper/ReadParamsFromFile.c 17.131 + 17.132 +# Subprojects 17.133 +.build-subprojects: 17.134 + 17.135 +# Clean Targets 17.136 +.clean-conf: ${CLEAN_SUBPROJECTS} 17.137 + ${RM} -r ${CND_BUILDDIR}/${CND_CONF} 17.138 + ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult 17.139 + 17.140 +# Subprojects 17.141 +.clean-subprojects: 17.142 + 17.143 +# Enable dependency checking 17.144 +.dep.inc: .depcheck-impl 17.145 + 17.146 +include .dep.inc
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 18.2 +++ b/nb__Reo_matrix_mult/nbproject/Makefile-Release.mk Sun Feb 02 17:58:41 2014 -0800 18.3 @@ -0,0 +1,143 @@ 18.4 +# 18.5 +# Generated Makefile - do not edit! 18.6 +# 18.7 +# Edit the Makefile in the project folder instead (../Makefile). Each target 18.8 +# has a -pre and a -post target defined where you can add customized code. 18.9 +# 18.10 +# This makefile implements configuration specific macros and targets. 18.11 + 18.12 + 18.13 +# Environment 18.14 +MKDIR=mkdir 18.15 +CP=cp 18.16 +GREP=grep 18.17 +NM=nm 18.18 +CCADMIN=CCadmin 18.19 +RANLIB=ranlib 18.20 +CC=gcc 18.21 +CCC=gcc-4.6 18.22 +CXX=gcc-4.6 18.23 +FC=gfortran 18.24 +AS=as 18.25 + 18.26 +# Macros 18.27 +CND_PLATFORM=GNU-Linux-x86 18.28 +CND_CONF=Release 18.29 +CND_DISTDIR=dist 18.30 +CND_BUILDDIR=build 18.31 + 18.32 +# Include project Makefile 18.33 +include Makefile 18.34 + 18.35 +# Object Directory 18.36 +OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM} 18.37 + 18.38 +# Object Files 18.39 +OBJECTFILES= \ 18.40 + ${OBJECTDIR}/_ext/1702716545/Producer_and_Consumer.o \ 18.41 + ${OBJECTDIR}/_ext/1539317932/ParamBag.o \ 18.42 + ${OBJECTDIR}/_ext/1702716545/Circuit.o \ 18.43 + ${OBJECTDIR}/_ext/1472/main.o \ 18.44 + ${OBJECTDIR}/_ext/1702716545/Divide_Pr.o \ 18.45 + ${OBJECTDIR}/_ext/1472/Matrix_Mult.o \ 18.46 + ${OBJECTDIR}/_ext/1702716545/Vector_Pr.o \ 18.47 + ${OBJECTDIR}/_ext/1702716545/Result_Pr.o \ 18.48 + ${OBJECTDIR}/_ext/1702716545/EntryPoint.o \ 18.49 + ${OBJECTDIR}/_ext/1702716545/SeedVP.o \ 18.50 + ${OBJECTDIR}/_ext/1539317932/ReadParamsFromFile.o 18.51 + 18.52 + 18.53 +# C Compiler Flags 18.54 +CFLAGS= 18.55 + 18.56 +# CC Compiler Flags 18.57 +CCFLAGS= 18.58 +CXXFLAGS= 18.59 + 18.60 +# Fortran Compiler Flags 18.61 +FFLAGS= 18.62 + 18.63 +# Assembler Flags 18.64 +ASFLAGS= 18.65 + 18.66 +# Link Libraries and Options 18.67 +LDLIBSOPTIONS= 18.68 + 18.69 +# Build Targets 18.70 +.build-conf: ${BUILD_SUBPROJECTS} 18.71 + "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult 18.72 + 18.73 +${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult: ${OBJECTFILES} 18.74 + ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM} 18.75 + ${LINK.c} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult ${OBJECTFILES} ${LDLIBSOPTIONS} 18.76 + 18.77 +${OBJECTDIR}/_ext/1702716545/Producer_and_Consumer.o: ../Reo__Matrix_Mult/Producer_and_Consumer.c 18.78 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 18.79 + ${RM} $@.d 18.80 + $(COMPILE.c) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Producer_and_Consumer.o ../Reo__Matrix_Mult/Producer_and_Consumer.c 18.81 + 18.82 +${OBJECTDIR}/_ext/1539317932/ParamBag.o: ../ParamHelper/ParamBag.c 18.83 + ${MKDIR} -p ${OBJECTDIR}/_ext/1539317932 18.84 + ${RM} $@.d 18.85 + $(COMPILE.c) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1539317932/ParamBag.o ../ParamHelper/ParamBag.c 18.86 + 18.87 +${OBJECTDIR}/_ext/1702716545/Circuit.o: ../Reo__Matrix_Mult/Circuit.c 18.88 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 18.89 + ${RM} $@.d 18.90 + $(COMPILE.c) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Circuit.o ../Reo__Matrix_Mult/Circuit.c 18.91 + 18.92 +${OBJECTDIR}/_ext/1472/main.o: ../main.c 18.93 + ${MKDIR} -p ${OBJECTDIR}/_ext/1472 18.94 + ${RM} $@.d 18.95 + $(COMPILE.c) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1472/main.o ../main.c 18.96 + 18.97 +${OBJECTDIR}/_ext/1702716545/Divide_Pr.o: ../Reo__Matrix_Mult/Divide_Pr.c 18.98 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 18.99 + ${RM} $@.d 18.100 + $(COMPILE.c) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Divide_Pr.o ../Reo__Matrix_Mult/Divide_Pr.c 18.101 + 18.102 +${OBJECTDIR}/_ext/1472/Matrix_Mult.o: ../Matrix_Mult.c 18.103 + ${MKDIR} -p ${OBJECTDIR}/_ext/1472 18.104 + ${RM} $@.d 18.105 + $(COMPILE.c) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1472/Matrix_Mult.o ../Matrix_Mult.c 18.106 + 18.107 +${OBJECTDIR}/_ext/1702716545/Vector_Pr.o: ../Reo__Matrix_Mult/Vector_Pr.c 18.108 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 18.109 + ${RM} $@.d 18.110 + $(COMPILE.c) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Vector_Pr.o ../Reo__Matrix_Mult/Vector_Pr.c 18.111 + 18.112 +${OBJECTDIR}/_ext/1702716545/Result_Pr.o: ../Reo__Matrix_Mult/Result_Pr.c 18.113 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 18.114 + ${RM} $@.d 18.115 + $(COMPILE.c) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/Result_Pr.o ../Reo__Matrix_Mult/Result_Pr.c 18.116 + 18.117 +${OBJECTDIR}/_ext/1702716545/EntryPoint.o: ../Reo__Matrix_Mult/EntryPoint.c 18.118 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 18.119 + ${RM} $@.d 18.120 + $(COMPILE.c) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/EntryPoint.o ../Reo__Matrix_Mult/EntryPoint.c 18.121 + 18.122 +${OBJECTDIR}/_ext/1702716545/SeedVP.o: ../Reo__Matrix_Mult/SeedVP.c 18.123 + ${MKDIR} -p ${OBJECTDIR}/_ext/1702716545 18.124 + ${RM} $@.d 18.125 + $(COMPILE.c) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1702716545/SeedVP.o ../Reo__Matrix_Mult/SeedVP.c 18.126 + 18.127 +${OBJECTDIR}/_ext/1539317932/ReadParamsFromFile.o: ../ParamHelper/ReadParamsFromFile.c 18.128 + ${MKDIR} -p ${OBJECTDIR}/_ext/1539317932 18.129 + ${RM} $@.d 18.130 + $(COMPILE.c) -O2 -MMD -MP -MF $@.d -o ${OBJECTDIR}/_ext/1539317932/ReadParamsFromFile.o ../ParamHelper/ReadParamsFromFile.c 18.131 + 18.132 +# Subprojects 18.133 +.build-subprojects: 18.134 + 18.135 +# Clean Targets 18.136 +.clean-conf: ${CLEAN_SUBPROJECTS} 18.137 + ${RM} -r ${CND_BUILDDIR}/${CND_CONF} 18.138 + ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult 18.139 + 18.140 +# Subprojects 18.141 +.clean-subprojects: 18.142 + 18.143 +# Enable dependency checking 18.144 +.dep.inc: .depcheck-impl 18.145 + 18.146 +include .dep.inc
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 19.2 +++ b/nb__Reo_matrix_mult/nbproject/Makefile-impl.mk Sun Feb 02 17:58:41 2014 -0800 19.3 @@ -0,0 +1,133 @@ 19.4 +# 19.5 +# Generated Makefile - do not edit! 19.6 +# 19.7 +# Edit the Makefile in the project folder instead (../Makefile). Each target 19.8 +# has a pre- and a post- target defined where you can add customization code. 19.9 +# 19.10 +# This makefile implements macros and targets common to all configurations. 19.11 +# 19.12 +# NOCDDL 19.13 + 19.14 + 19.15 +# Building and Cleaning subprojects are done by default, but can be controlled with the SUB 19.16 +# macro. If SUB=no, subprojects will not be built or cleaned. The following macro 19.17 +# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf 19.18 +# and .clean-reqprojects-conf unless SUB has the value 'no' 19.19 +SUB_no=NO 19.20 +SUBPROJECTS=${SUB_${SUB}} 19.21 +BUILD_SUBPROJECTS_=.build-subprojects 19.22 +BUILD_SUBPROJECTS_NO= 19.23 +BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} 19.24 +CLEAN_SUBPROJECTS_=.clean-subprojects 19.25 +CLEAN_SUBPROJECTS_NO= 19.26 +CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} 19.27 + 19.28 + 19.29 +# Project Name 19.30 +PROJECTNAME=nb__Reo_matrix_mult 19.31 + 19.32 +# Active Configuration 19.33 +DEFAULTCONF=Debug 19.34 +CONF=${DEFAULTCONF} 19.35 + 19.36 +# All Configurations 19.37 +ALLCONFS=Debug Release Debug_Sequential 19.38 + 19.39 + 19.40 +# build 19.41 +.build-impl: .build-pre .validate-impl .depcheck-impl 19.42 + @#echo "=> Running $@... Configuration=$(CONF)" 19.43 + "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf 19.44 + 19.45 + 19.46 +# clean 19.47 +.clean-impl: .clean-pre .validate-impl .depcheck-impl 19.48 + @#echo "=> Running $@... Configuration=$(CONF)" 19.49 + "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf 19.50 + 19.51 + 19.52 +# clobber 19.53 +.clobber-impl: .clobber-pre .depcheck-impl 19.54 + @#echo "=> Running $@..." 19.55 + for CONF in ${ALLCONFS}; \ 19.56 + do \ 19.57 + "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf; \ 19.58 + done 19.59 + 19.60 +# all 19.61 +.all-impl: .all-pre .depcheck-impl 19.62 + @#echo "=> Running $@..." 19.63 + for CONF in ${ALLCONFS}; \ 19.64 + do \ 19.65 + "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf; \ 19.66 + done 19.67 + 19.68 +# build tests 19.69 +.build-tests-impl: .build-impl .build-tests-pre 19.70 + @#echo "=> Running $@... Configuration=$(CONF)" 19.71 + "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-tests-conf 19.72 + 19.73 +# run tests 19.74 +.test-impl: .build-tests-impl .test-pre 19.75 + @#echo "=> Running $@... Configuration=$(CONF)" 19.76 + "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .test-conf 19.77 + 19.78 +# dependency checking support 19.79 +.depcheck-impl: 19.80 + @echo "# This code depends on make tool being used" >.dep.inc 19.81 + @if [ -n "${MAKE_VERSION}" ]; then \ 19.82 + echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ 19.83 + echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ 19.84 + echo "include \$${DEPFILES}" >>.dep.inc; \ 19.85 + echo "endif" >>.dep.inc; \ 19.86 + else \ 19.87 + echo ".KEEP_STATE:" >>.dep.inc; \ 19.88 + echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ 19.89 + fi 19.90 + 19.91 +# configuration validation 19.92 +.validate-impl: 19.93 + @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \ 19.94 + then \ 19.95 + echo ""; \ 19.96 + echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \ 19.97 + echo "See 'make help' for details."; \ 19.98 + echo "Current directory: " `pwd`; \ 19.99 + echo ""; \ 19.100 + fi 19.101 + @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \ 19.102 + then \ 19.103 + exit 1; \ 19.104 + fi 19.105 + 19.106 + 19.107 +# help 19.108 +.help-impl: .help-pre 19.109 + @echo "This makefile supports the following configurations:" 19.110 + @echo " ${ALLCONFS}" 19.111 + @echo "" 19.112 + @echo "and the following targets:" 19.113 + @echo " build (default target)" 19.114 + @echo " clean" 19.115 + @echo " clobber" 19.116 + @echo " all" 19.117 + @echo " help" 19.118 + @echo "" 19.119 + @echo "Makefile Usage:" 19.120 + @echo " make [CONF=<CONFIGURATION>] [SUB=no] build" 19.121 + @echo " make [CONF=<CONFIGURATION>] [SUB=no] clean" 19.122 + @echo " make [SUB=no] clobber" 19.123 + @echo " make [SUB=no] all" 19.124 + @echo " make help" 19.125 + @echo "" 19.126 + @echo "Target 'build' will build a specific configuration and, unless 'SUB=no'," 19.127 + @echo " also build subprojects." 19.128 + @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no'," 19.129 + @echo " also clean subprojects." 19.130 + @echo "Target 'clobber' will remove all built files from all configurations and," 19.131 + @echo " unless 'SUB=no', also from subprojects." 19.132 + @echo "Target 'all' will will build all configurations and, unless 'SUB=no'," 19.133 + @echo " also build subprojects." 19.134 + @echo "Target 'help' prints this message." 19.135 + @echo "" 19.136 +
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/nb__Reo_matrix_mult/nbproject/Makefile-variables.mk Sun Feb 02 17:58:41 2014 -0800 20.3 @@ -0,0 +1,43 @@ 20.4 +# 20.5 +# Generated - do not edit! 20.6 +# 20.7 +# NOCDDL 20.8 +# 20.9 +CND_BASEDIR=`pwd` 20.10 +CND_BUILDDIR=build 20.11 +CND_DISTDIR=dist 20.12 +# Debug configuration 20.13 +CND_PLATFORM_Debug=GNU-Linux-x86 20.14 +CND_ARTIFACT_DIR_Debug=dist/Debug/GNU-Linux-x86 20.15 +CND_ARTIFACT_NAME_Debug=nb__reo_matrix_mult 20.16 +CND_ARTIFACT_PATH_Debug=dist/Debug/GNU-Linux-x86/nb__reo_matrix_mult 20.17 +CND_PACKAGE_DIR_Debug=dist/Debug/GNU-Linux-x86/package 20.18 +CND_PACKAGE_NAME_Debug=nbreomatrixmult.tar 20.19 +CND_PACKAGE_PATH_Debug=dist/Debug/GNU-Linux-x86/package/nbreomatrixmult.tar 20.20 +# Release configuration 20.21 +CND_PLATFORM_Release=GNU-Linux-x86 20.22 +CND_ARTIFACT_DIR_Release=dist/Release/GNU-Linux-x86 20.23 +CND_ARTIFACT_NAME_Release=nb__reo_matrix_mult 20.24 +CND_ARTIFACT_PATH_Release=dist/Release/GNU-Linux-x86/nb__reo_matrix_mult 20.25 +CND_PACKAGE_DIR_Release=dist/Release/GNU-Linux-x86/package 20.26 +CND_PACKAGE_NAME_Release=nbreomatrixmult.tar 20.27 +CND_PACKAGE_PATH_Release=dist/Release/GNU-Linux-x86/package/nbreomatrixmult.tar 20.28 +# Debug_Sequential configuration 20.29 +CND_PLATFORM_Debug_Sequential=GNU-Linux-x86 20.30 +CND_ARTIFACT_DIR_Debug_Sequential=dist/Debug_Sequential/GNU-Linux-x86 20.31 +CND_ARTIFACT_NAME_Debug_Sequential=nb__reo_matrix_mult 20.32 +CND_ARTIFACT_PATH_Debug_Sequential=dist/Debug_Sequential/GNU-Linux-x86/nb__reo_matrix_mult 20.33 +CND_PACKAGE_DIR_Debug_Sequential=dist/Debug_Sequential/GNU-Linux-x86/package 20.34 +CND_PACKAGE_NAME_Debug_Sequential=nbreomatrixmult.tar 20.35 +CND_PACKAGE_PATH_Debug_Sequential=dist/Debug_Sequential/GNU-Linux-x86/package/nbreomatrixmult.tar 20.36 +# 20.37 +# include compiler specific variables 20.38 +# 20.39 +# dmake command 20.40 +ROOT:sh = test -f nbproject/private/Makefile-variables.mk || \ 20.41 + (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk) 20.42 +# 20.43 +# gmake command 20.44 +.PHONY: $(shell test -f nbproject/private/Makefile-variables.mk || (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk)) 20.45 +# 20.46 +include nbproject/private/Makefile-variables.mk
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/nb__Reo_matrix_mult/nbproject/Package-Debug.bash Sun Feb 02 17:58:41 2014 -0800 21.3 @@ -0,0 +1,75 @@ 21.4 +#!/bin/bash -x 21.5 + 21.6 +# 21.7 +# Generated - do not edit! 21.8 +# 21.9 + 21.10 +# Macros 21.11 +TOP=`pwd` 21.12 +CND_PLATFORM=GNU-Linux-x86 21.13 +CND_CONF=Debug 21.14 +CND_DISTDIR=dist 21.15 +CND_BUILDDIR=build 21.16 +NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging 21.17 +TMPDIRNAME=tmp-packaging 21.18 +OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult 21.19 +OUTPUT_BASENAME=nb__reo_matrix_mult 21.20 +PACKAGE_TOP_DIR=nbreomatrixmult/ 21.21 + 21.22 +# Functions 21.23 +function checkReturnCode 21.24 +{ 21.25 + rc=$? 21.26 + if [ $rc != 0 ] 21.27 + then 21.28 + exit $rc 21.29 + fi 21.30 +} 21.31 +function makeDirectory 21.32 +# $1 directory path 21.33 +# $2 permission (optional) 21.34 +{ 21.35 + mkdir -p "$1" 21.36 + checkReturnCode 21.37 + if [ "$2" != "" ] 21.38 + then 21.39 + chmod $2 "$1" 21.40 + checkReturnCode 21.41 + fi 21.42 +} 21.43 +function copyFileToTmpDir 21.44 +# $1 from-file path 21.45 +# $2 to-file path 21.46 +# $3 permission 21.47 +{ 21.48 + cp "$1" "$2" 21.49 + checkReturnCode 21.50 + if [ "$3" != "" ] 21.51 + then 21.52 + chmod $3 "$2" 21.53 + checkReturnCode 21.54 + fi 21.55 +} 21.56 + 21.57 +# Setup 21.58 +cd "${TOP}" 21.59 +mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package 21.60 +rm -rf ${NBTMPDIR} 21.61 +mkdir -p ${NBTMPDIR} 21.62 + 21.63 +# Copy files and create directories and links 21.64 +cd "${TOP}" 21.65 +makeDirectory "${NBTMPDIR}/nbreomatrixmult/bin" 21.66 +copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 21.67 + 21.68 + 21.69 +# Generate tar file 21.70 +cd "${TOP}" 21.71 +rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/nbreomatrixmult.tar 21.72 +cd ${NBTMPDIR} 21.73 +tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/nbreomatrixmult.tar * 21.74 +checkReturnCode 21.75 + 21.76 +# Cleanup 21.77 +cd "${TOP}" 21.78 +rm -rf ${NBTMPDIR}
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 22.2 +++ b/nb__Reo_matrix_mult/nbproject/Package-Debug_Sequential.bash Sun Feb 02 17:58:41 2014 -0800 22.3 @@ -0,0 +1,75 @@ 22.4 +#!/bin/bash -x 22.5 + 22.6 +# 22.7 +# Generated - do not edit! 22.8 +# 22.9 + 22.10 +# Macros 22.11 +TOP=`pwd` 22.12 +CND_PLATFORM=GNU-Linux-x86 22.13 +CND_CONF=Debug_Sequential 22.14 +CND_DISTDIR=dist 22.15 +CND_BUILDDIR=build 22.16 +NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging 22.17 +TMPDIRNAME=tmp-packaging 22.18 +OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult 22.19 +OUTPUT_BASENAME=nb__reo_matrix_mult 22.20 +PACKAGE_TOP_DIR=nbreomatrixmult/ 22.21 + 22.22 +# Functions 22.23 +function checkReturnCode 22.24 +{ 22.25 + rc=$? 22.26 + if [ $rc != 0 ] 22.27 + then 22.28 + exit $rc 22.29 + fi 22.30 +} 22.31 +function makeDirectory 22.32 +# $1 directory path 22.33 +# $2 permission (optional) 22.34 +{ 22.35 + mkdir -p "$1" 22.36 + checkReturnCode 22.37 + if [ "$2" != "" ] 22.38 + then 22.39 + chmod $2 "$1" 22.40 + checkReturnCode 22.41 + fi 22.42 +} 22.43 +function copyFileToTmpDir 22.44 +# $1 from-file path 22.45 +# $2 to-file path 22.46 +# $3 permission 22.47 +{ 22.48 + cp "$1" "$2" 22.49 + checkReturnCode 22.50 + if [ "$3" != "" ] 22.51 + then 22.52 + chmod $3 "$2" 22.53 + checkReturnCode 22.54 + fi 22.55 +} 22.56 + 22.57 +# Setup 22.58 +cd "${TOP}" 22.59 +mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package 22.60 +rm -rf ${NBTMPDIR} 22.61 +mkdir -p ${NBTMPDIR} 22.62 + 22.63 +# Copy files and create directories and links 22.64 +cd "${TOP}" 22.65 +makeDirectory "${NBTMPDIR}/nbreomatrixmult/bin" 22.66 +copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 22.67 + 22.68 + 22.69 +# Generate tar file 22.70 +cd "${TOP}" 22.71 +rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/nbreomatrixmult.tar 22.72 +cd ${NBTMPDIR} 22.73 +tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/nbreomatrixmult.tar * 22.74 +checkReturnCode 22.75 + 22.76 +# Cleanup 22.77 +cd "${TOP}" 22.78 +rm -rf ${NBTMPDIR}
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/nb__Reo_matrix_mult/nbproject/Package-Release.bash Sun Feb 02 17:58:41 2014 -0800 23.3 @@ -0,0 +1,75 @@ 23.4 +#!/bin/bash -x 23.5 + 23.6 +# 23.7 +# Generated - do not edit! 23.8 +# 23.9 + 23.10 +# Macros 23.11 +TOP=`pwd` 23.12 +CND_PLATFORM=GNU-Linux-x86 23.13 +CND_CONF=Release 23.14 +CND_DISTDIR=dist 23.15 +CND_BUILDDIR=build 23.16 +NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging 23.17 +TMPDIRNAME=tmp-packaging 23.18 +OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/nb__reo_matrix_mult 23.19 +OUTPUT_BASENAME=nb__reo_matrix_mult 23.20 +PACKAGE_TOP_DIR=nbreomatrixmult/ 23.21 + 23.22 +# Functions 23.23 +function checkReturnCode 23.24 +{ 23.25 + rc=$? 23.26 + if [ $rc != 0 ] 23.27 + then 23.28 + exit $rc 23.29 + fi 23.30 +} 23.31 +function makeDirectory 23.32 +# $1 directory path 23.33 +# $2 permission (optional) 23.34 +{ 23.35 + mkdir -p "$1" 23.36 + checkReturnCode 23.37 + if [ "$2" != "" ] 23.38 + then 23.39 + chmod $2 "$1" 23.40 + checkReturnCode 23.41 + fi 23.42 +} 23.43 +function copyFileToTmpDir 23.44 +# $1 from-file path 23.45 +# $2 to-file path 23.46 +# $3 permission 23.47 +{ 23.48 + cp "$1" "$2" 23.49 + checkReturnCode 23.50 + if [ "$3" != "" ] 23.51 + then 23.52 + chmod $3 "$2" 23.53 + checkReturnCode 23.54 + fi 23.55 +} 23.56 + 23.57 +# Setup 23.58 +cd "${TOP}" 23.59 +mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package 23.60 +rm -rf ${NBTMPDIR} 23.61 +mkdir -p ${NBTMPDIR} 23.62 + 23.63 +# Copy files and create directories and links 23.64 +cd "${TOP}" 23.65 +makeDirectory "${NBTMPDIR}/nbreomatrixmult/bin" 23.66 +copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 23.67 + 23.68 + 23.69 +# Generate tar file 23.70 +cd "${TOP}" 23.71 +rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/nbreomatrixmult.tar 23.72 +cd ${NBTMPDIR} 23.73 +tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/nbreomatrixmult.tar * 23.74 +checkReturnCode 23.75 + 23.76 +# Cleanup 23.77 +cd "${TOP}" 23.78 +rm -rf ${NBTMPDIR}
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 24.2 +++ b/nb__Reo_matrix_mult/nbproject/configurations.xml Sun Feb 02 17:58:41 2014 -0800 24.3 @@ -0,0 +1,107 @@ 24.4 +<?xml version="1.0" encoding="UTF-8"?> 24.5 +<configurationDescriptor version="80"> 24.6 + <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT"> 24.7 + <logicalFolder name="HeaderFiles" 24.8 + displayName="Header Files" 24.9 + projectFiles="true"> 24.10 + </logicalFolder> 24.11 + <logicalFolder name="ResourceFiles" 24.12 + displayName="Resource Files" 24.13 + projectFiles="true"> 24.14 + </logicalFolder> 24.15 + <logicalFolder name="SourceFiles" 24.16 + displayName="Source Files" 24.17 + projectFiles="true"> 24.18 + <logicalFolder name="ParamHelper" displayName="ParamHelper" projectFiles="true"> 24.19 + <itemPath>../ParamHelper/Param.h</itemPath> 24.20 + <itemPath>../ParamHelper/ParamBag.c</itemPath> 24.21 + <itemPath>../ParamHelper/ReadParamsFromFile.c</itemPath> 24.22 + </logicalFolder> 24.23 + <logicalFolder name="Reo__Matrix_Mult" 24.24 + displayName="Reo__Matrix_Mult" 24.25 + projectFiles="true"> 24.26 + <itemPath>../Reo__Matrix_Mult/Circuit.c</itemPath> 24.27 + <itemPath>../Reo__Matrix_Mult/Circuit.h</itemPath> 24.28 + <itemPath>../Reo__Matrix_Mult/Divide_Pr.c</itemPath> 24.29 + <itemPath>../Reo__Matrix_Mult/EntryPoint.c</itemPath> 24.30 + <itemPath>../Reo__Matrix_Mult/PThread__Matrix_Mult.h</itemPath> 24.31 + <itemPath>../Reo__Matrix_Mult/Producer_and_Consumer.c</itemPath> 24.32 + <itemPath>../Reo__Matrix_Mult/Result_Pr.c</itemPath> 24.33 + <itemPath>../Reo__Matrix_Mult/SeedVP.c</itemPath> 24.34 + <itemPath>../Reo__Matrix_Mult/VMS_primitive_data_types.h</itemPath> 24.35 + <itemPath>../Reo__Matrix_Mult/VReo__Test_App.h</itemPath> 24.36 + <itemPath>../Reo__Matrix_Mult/Vector_Pr.c</itemPath> 24.37 + </logicalFolder> 24.38 + <itemPath>../Matrix_Mult.c</itemPath> 24.39 + <itemPath>../Matrix_Mult.h</itemPath> 24.40 + <itemPath>../main.c</itemPath> 24.41 + </logicalFolder> 24.42 + <logicalFolder name="TestFiles" 24.43 + displayName="Test Files" 24.44 + projectFiles="false" 24.45 + kind="TEST_LOGICAL_FOLDER"> 24.46 + </logicalFolder> 24.47 + <logicalFolder name="ExternalFiles" 24.48 + displayName="Important Files" 24.49 + projectFiles="false" 24.50 + kind="IMPORTANT_FILES_FOLDER"> 24.51 + <itemPath>Makefile</itemPath> 24.52 + </logicalFolder> 24.53 + </logicalFolder> 24.54 + <sourceRootList> 24.55 + <Elem>../ParamHelper</Elem> 24.56 + <Elem>../Reo__Matrix_Mult</Elem> 24.57 + </sourceRootList> 24.58 + <projectmakefile>Makefile</projectmakefile> 24.59 + <confs> 24.60 + <conf name="Debug" type="1"> 24.61 + <toolsSet> 24.62 + <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode> 24.63 + <compilerSet>default</compilerSet> 24.64 + </toolsSet> 24.65 + <compileType> 24.66 + </compileType> 24.67 + </conf> 24.68 + <conf name="Release" type="1"> 24.69 + <toolsSet> 24.70 + <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode> 24.71 + <compilerSet>default</compilerSet> 24.72 + </toolsSet> 24.73 + <compileType> 24.74 + <cTool> 24.75 + <developmentMode>5</developmentMode> 24.76 + </cTool> 24.77 + <ccTool> 24.78 + <developmentMode>5</developmentMode> 24.79 + </ccTool> 24.80 + <fortranCompilerTool> 24.81 + <developmentMode>5</developmentMode> 24.82 + </fortranCompilerTool> 24.83 + <asmTool> 24.84 + <developmentMode>5</developmentMode> 24.85 + </asmTool> 24.86 + </compileType> 24.87 + </conf> 24.88 + <conf name="Debug_Sequential" type="1"> 24.89 + <toolsSet> 24.90 + <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode> 24.91 + <compilerSet>default</compilerSet> 24.92 + </toolsSet> 24.93 + <compileType> 24.94 + <cTool> 24.95 + <incDir> 24.96 + <pElem>../..</pElem> 24.97 + </incDir> 24.98 + <preprocessorList> 24.99 + <Elem>DEBUG__SEQUENTIAL_MODE</Elem> 24.100 + </preprocessorList> 24.101 + </cTool> 24.102 + <linkerTool> 24.103 + <linkerAddLib> 24.104 + <pElem>../../PR__lib</pElem> 24.105 + </linkerAddLib> 24.106 + </linkerTool> 24.107 + </compileType> 24.108 + </conf> 24.109 + </confs> 24.110 +</configurationDescriptor>
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 25.2 +++ b/nb__Reo_matrix_mult/nbproject/private/Makefile-variables.mk Sun Feb 02 17:58:41 2014 -0800 25.3 @@ -0,0 +1,8 @@ 25.4 +# 25.5 +# Generated - do not edit! 25.6 +# 25.7 +# NOCDDL 25.8 +# 25.9 +# Debug configuration 25.10 +# Release configuration 25.11 +# Debug_Sequential configuration
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 26.2 +++ b/nb__Reo_matrix_mult/nbproject/private/configurations.xml Sun Feb 02 17:58:41 2014 -0800 26.3 @@ -0,0 +1,115 @@ 26.4 +<?xml version="1.0" encoding="UTF-8"?> 26.5 +<configurationDescriptor version="80"> 26.6 + <projectmakefile>Makefile</projectmakefile> 26.7 + <confs> 26.8 + <conf name="Debug" type="1"> 26.9 + <toolsSet> 26.10 + <developmentServer>localhost</developmentServer> 26.11 + <platform>2</platform> 26.12 + </toolsSet> 26.13 + <dbx_gdbdebugger version="1"> 26.14 + <gdb_pathmaps> 26.15 + </gdb_pathmaps> 26.16 + <gdb_interceptlist> 26.17 + <gdbinterceptoptions gdb_all="false" gdb_unhandled="true" gdb_unexpected="true"/> 26.18 + </gdb_interceptlist> 26.19 + <gdb_options> 26.20 + <DebugOptions> 26.21 + </DebugOptions> 26.22 + </gdb_options> 26.23 + <gdb_buildfirst gdb_buildfirst_overriden="false" gdb_buildfirst_old="false"/> 26.24 + </dbx_gdbdebugger> 26.25 + <gizmo_options version="3"> 26.26 + <configurationname>GizmoSimple</configurationname> 26.27 + </gizmo_options> 26.28 + <nativedebugger version="1"> 26.29 + <engine>gdb</engine> 26.30 + </nativedebugger> 26.31 + <runprofile version="9"> 26.32 + <runcommandpicklist> 26.33 + <runcommandpicklistitem>"${OUTPUT_PATH}"</runcommandpicklistitem> 26.34 + </runcommandpicklist> 26.35 + <runcommand>"${OUTPUT_PATH}"</runcommand> 26.36 + <rundir></rundir> 26.37 + <buildfirst>true</buildfirst> 26.38 + <terminal-type>0</terminal-type> 26.39 + <remove-instrumentation>0</remove-instrumentation> 26.40 + <environment> 26.41 + </environment> 26.42 + </runprofile> 26.43 + </conf> 26.44 + <conf name="Release" type="1"> 26.45 + <toolsSet> 26.46 + <developmentServer>localhost</developmentServer> 26.47 + <platform>2</platform> 26.48 + </toolsSet> 26.49 + <dbx_gdbdebugger version="1"> 26.50 + <gdb_pathmaps> 26.51 + </gdb_pathmaps> 26.52 + <gdb_interceptlist> 26.53 + <gdbinterceptoptions gdb_all="false" gdb_unhandled="true" gdb_unexpected="true"/> 26.54 + </gdb_interceptlist> 26.55 + <gdb_options> 26.56 + <DebugOptions> 26.57 + </DebugOptions> 26.58 + </gdb_options> 26.59 + <gdb_buildfirst gdb_buildfirst_overriden="false" gdb_buildfirst_old="false"/> 26.60 + </dbx_gdbdebugger> 26.61 + <gizmo_options version="3"> 26.62 + <configurationname>GizmoSimple</configurationname> 26.63 + </gizmo_options> 26.64 + <nativedebugger version="1"> 26.65 + <engine>gdb</engine> 26.66 + </nativedebugger> 26.67 + <runprofile version="9"> 26.68 + <runcommandpicklist> 26.69 + <runcommandpicklistitem>"${OUTPUT_PATH}"</runcommandpicklistitem> 26.70 + </runcommandpicklist> 26.71 + <runcommand>"${OUTPUT_PATH}"</runcommand> 26.72 + <rundir></rundir> 26.73 + <buildfirst>true</buildfirst> 26.74 + <terminal-type>0</terminal-type> 26.75 + <remove-instrumentation>0</remove-instrumentation> 26.76 + <environment> 26.77 + </environment> 26.78 + </runprofile> 26.79 + </conf> 26.80 + <conf name="Debug_Sequential" type="1"> 26.81 + <toolsSet> 26.82 + <developmentServer>localhost</developmentServer> 26.83 + <platform>2</platform> 26.84 + </toolsSet> 26.85 + <dbx_gdbdebugger version="1"> 26.86 + <gdb_pathmaps> 26.87 + </gdb_pathmaps> 26.88 + <gdb_interceptlist> 26.89 + <gdbinterceptoptions gdb_all="false" gdb_unhandled="true" gdb_unexpected="true"/> 26.90 + </gdb_interceptlist> 26.91 + <gdb_options> 26.92 + <DebugOptions> 26.93 + </DebugOptions> 26.94 + </gdb_options> 26.95 + <gdb_buildfirst gdb_buildfirst_overriden="false" gdb_buildfirst_old="false"/> 26.96 + </dbx_gdbdebugger> 26.97 + <gizmo_options version="3"> 26.98 + <configurationname>GizmoSimple</configurationname> 26.99 + </gizmo_options> 26.100 + <nativedebugger version="1"> 26.101 + <engine>gdb</engine> 26.102 + </nativedebugger> 26.103 + <runprofile version="9"> 26.104 + <runcommandpicklist> 26.105 + <runcommandpicklistitem>"${OUTPUT_PATH}"</runcommandpicklistitem> 26.106 + </runcommandpicklist> 26.107 + <runcommand>"${OUTPUT_PATH}"</runcommand> 26.108 + <rundir>/home/kshalle/D/2__Work/1__Development/0__Code/PR/PR__ML_lib__sharedMem/Projects/Reo_Opt1__matrix_mult/dist</rundir> 26.109 + <buildfirst>true</buildfirst> 26.110 + <terminal-type>0</terminal-type> 26.111 + <remove-instrumentation>0</remove-instrumentation> 26.112 + <environment> 26.113 + <variable name="LD_LIBRARY_PATH" value="../PR__lib"/> 26.114 + </environment> 26.115 + </runprofile> 26.116 + </conf> 26.117 + </confs> 26.118 +</configurationDescriptor>
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 27.2 +++ b/nb__Reo_matrix_mult/nbproject/private/private.xml Sun Feb 02 17:58:41 2014 -0800 27.3 @@ -0,0 +1,7 @@ 27.4 +<?xml version="1.0" encoding="UTF-8"?> 27.5 +<project-private xmlns="http://www.netbeans.org/ns/project-private/1"> 27.6 + <data xmlns="http://www.netbeans.org/ns/make-project-private/1"> 27.7 + <activeConfTypeElem>1</activeConfTypeElem> 27.8 + <activeConfIndexElem>2</activeConfIndexElem> 27.9 + </data> 27.10 +</project-private>
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 28.2 +++ b/nb__Reo_matrix_mult/nbproject/project.xml Sun Feb 02 17:58:41 2014 -0800 28.3 @@ -0,0 +1,32 @@ 28.4 +<?xml version="1.0" encoding="UTF-8"?> 28.5 +<project xmlns="http://www.netbeans.org/ns/project/1"> 28.6 + <type>org.netbeans.modules.cnd.makeproject</type> 28.7 + <configuration> 28.8 + <data xmlns="http://www.netbeans.org/ns/make-project/1"> 28.9 + <name>nb__Reo_matrix_mult</name> 28.10 + <c-extensions>c</c-extensions> 28.11 + <cpp-extensions/> 28.12 + <header-extensions>h</header-extensions> 28.13 + <sourceEncoding>UTF-8</sourceEncoding> 28.14 + <make-dep-projects/> 28.15 + <sourceRootList> 28.16 + <sourceRootElem>../ParamHelper</sourceRootElem> 28.17 + <sourceRootElem>../Reo__Matrix_Mult</sourceRootElem> 28.18 + </sourceRootList> 28.19 + <confList> 28.20 + <confElem> 28.21 + <name>Debug</name> 28.22 + <type>1</type> 28.23 + </confElem> 28.24 + <confElem> 28.25 + <name>Release</name> 28.26 + <type>1</type> 28.27 + </confElem> 28.28 + <confElem> 28.29 + <name>Debug_Sequential</name> 28.30 + <type>1</type> 28.31 + </confElem> 28.32 + </confList> 28.33 + </data> 28.34 + </configuration> 28.35 +</project>
