Changeset 0e0f128 for tests/concurrent


Ignore:
Timestamp:
Aug 14, 2018, 1:20:59 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer
Children:
7b3a6e6
Parents:
0c827019 (diff), 26f4dbe (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/concurrent/examples/matrixSum.c

    r0c827019 r0e0f128  
    1111// Created On       : Mon Oct  9 08:29:28 2017
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Fri May 25 09:34:27 2018
    14 // Update Count     : 10
     13// Last Modified On : Thu Aug  9 09:17:30 2018
     14// Update Count     : 13
    1515//
    1616
     
    3030void main( Adder & adder ) with( adder ) {                              // thread starts here
    3131        subtotal = 0;
    32         for ( int c = 0; c < cols; c += 1 ) {
     32        for ( c; cols ) {
    3333                subtotal += row[c];
    3434        } // for
     
    3636
    3737int main() {
    38         const int rows = 10, cols = 1000;
     38        /* const */ int rows = 10, cols = 1000;
    3939        int matrix[rows][cols], subtotals[rows], total = 0;
    4040        processor p;                                                                            // add kernel thread
    4141
    42         for ( int r = 0; r < rows; r += 1 ) {
    43                 for ( int c = 0; c < cols; c += 1 ) {
     42        for ( r; rows ) {
     43                for ( c; cols ) {
    4444                        matrix[r][c] = 1;
    4545                } // for
    4646        } // for
    4747        Adder * adders[rows];
    48         for ( int r = 0; r < rows; r += 1 ) {                           // start threads to sum rows
     48        for ( r; rows ) {                                                                       // start threads to sum rows
    4949                adders[r] = &(*malloc()){ matrix[r], cols, subtotals[r] };
    5050//              adders[r] = new( matrix[r], cols, &subtotals[r] );
    5151        } // for
    52         for ( int r = 0; r < rows; r += 1 ) {                           // wait for threads to finish
     52        for ( r; rows ) {                                                                       // wait for threads to finish
    5353                delete( adders[r] );
    5454                total += subtotals[r];                                                  // total subtotals
Note: See TracChangeset for help on using the changeset viewer.