Changeset 50be8af5 for tests/concurrency/examples
- Timestamp:
- Sep 17, 2023, 11:19:08 AM (16 months ago)
- Branches:
- master
- Children:
- 7edf912
- Parents:
- 697c957
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrency/examples/matrixSum.cfa
r697c957 r50be8af5 10 10 // Created On : Mon Oct 9 08:29:28 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 20 08:37:53 201913 // Update Count : 1 612 // Last Modified On : Fri Sep 8 19:05:34 2023 13 // Update Count : 19 14 14 // 15 15 16 16 #include <fstream.hfa> 17 #include <kernel.hfa>18 17 #include <thread.hfa> 19 18 … … 35 34 36 35 int main() { 37 /* const */int rows = 10, cols = 1000;36 const int rows = 10, cols = 1000; 38 37 int matrix[rows][cols], subtotals[rows], total = 0; 39 38 processor p; // add kernel thread 40 39 41 for ( r; rows ) { 40 for ( r; rows ) { // initialize 42 41 for ( c; cols ) { 43 42 matrix[r][c] = 1; 44 43 } // for 45 44 } // for 45 46 46 Adder * adders[rows]; 47 47 for ( r; rows ) { // start threads to sum rows 48 48 adders[r] = &(*malloc()){ matrix[r], cols, subtotals[r] }; 49 // adders[r] = new( matrix[r], cols, &subtotals[r] );49 // adders[r] = new( matrix[r], cols, subtotals[r] ); 50 50 } // for 51 51 52 for ( r; rows ) { // wait for threads to finish 52 53 delete( adders[r] ); … … 57 58 58 59 // Local Variables: // 59 // tab-width: 4 //60 60 // compile-command: "cfa matrixSum.cfa" // 61 61 // End: //
Note: See TracChangeset
for help on using the changeset viewer.