# HG changeset patch # User Me # Date 1288147028 25200 # Node ID 103a5f3b74cf8ae1ee122f87d85e9632218eb342 # Parent 3b0e43240104dc642b9ee0a9aa4deda19873b520 Works on small matrices -- too many threads, dies on large matrices diff -r 3b0e43240104 -r 103a5f3b74cf .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Tue Oct 26 19:37:08 2010 -0700 @@ -0,0 +1,6 @@ +Makefile +.dep.inc +nbproject +dist +build + diff -r 3b0e43240104 -r 103a5f3b74cf src/Application/Matrix_Mult.c --- a/src/Application/Matrix_Mult.c Fri Sep 17 11:28:28 2010 -0700 +++ b/src/Application/Matrix_Mult.c Tue Oct 26 19:37:08 2010 -0700 @@ -51,7 +51,7 @@ read_Matrix_From_File( Matrix *matrixStruc, char *matrixFileName ) { int row, maxRead, numRows, numCols; float32 *matrixStart; - size_t lineSz = 0; + int32 lineSz = 0; FILE *file; char *line = NULL; @@ -148,16 +148,18 @@ void printMatrix( Matrix *matrix ) - { int r, c, numRows, numCols; + { int r, c, numRows, numCols, rowsToPrint, colsToPrint, rowIncr, colIncr; float32 *matrixArray; - numRows = matrix->numRows; - numCols = matrix->numCols; + numRows = rowsToPrint = matrix->numRows; + numCols = colsToPrint = matrix->numCols; matrixArray = matrix->matrix; - for( r = 0; r < numRows; r++ ) - { for( c = 0; c < numCols; c++ ) - { printf( "%f | ", *(matrixArray + r*numCols + c) ); + rowIncr = numRows/20; if(rowIncr == 0) rowIncr = 1;//20 to 39 rows printed + colIncr = numCols/20; if(colIncr == 0) colIncr = 1;//20 to 39 cols printed + for( r = 0; r < numRows; r += rowIncr ) + { for( c = 0; c < numCols; c += colIncr ) + { printf( "%3.1f | ", matrixArray[ r * numCols + c ] ); } printf("\n"); } diff -r 3b0e43240104 -r 103a5f3b74cf src/Application/VPThread__Matrix_Mult/Result_Pr.c --- a/src/Application/VPThread__Matrix_Mult/Result_Pr.c Fri Sep 17 11:28:28 2010 -0700 +++ b/src/Application/VPThread__Matrix_Mult/Result_Pr.c Tue Oct 26 19:37:08 2010 -0700 @@ -32,6 +32,9 @@ //Tell divider that have the vector lock -- so it's sure won't miss any // signals from the vector-threads it's about to create + //Don't need a signal variable -- this thd can't be created until + // divider thd already has the start lock + VPThread__mutex_lock( globals->start_mutex, animatingPr );//finish wait VPThread__cond_signal( globals->start_cond, animatingPr ); VPThread__mutex_unlock( globals->start_mutex, animatingPr );//finish wait diff -r 3b0e43240104 -r 103a5f3b74cf src/Application/main.c --- a/src/Application/main.c Fri Sep 17 11:28:28 2010 -0700 +++ b/src/Application/main.c Tue Oct 26 19:37:08 2010 -0700 @@ -27,7 +27,7 @@ printf("\nresult matrix: \n"); -// printMatrix( resultMatrix ); + printMatrix( resultMatrix ); // VPThread__print_stats();