Changeset 10a9479d for tests


Ignore:
Timestamp:
Nov 23, 2024, 8:28:37 PM (14 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
956b389
Parents:
b006c51e (diff), de7b7a5 (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

Location:
tests
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • tests/concurrency/actors/dynamic.cfa

    rb006c51e r10a9479d  
    4848
    4949        executor e{ 0, 1, 1, false };
    50         start_actor_system( e );
    51 
     50        actor_start( e );
    5251        sout | "started";
    5352
     
    5857        *d_actor | *d_msg;
    5958
    60         stop_actor_system();
    61 
     59        actor_stop();
    6260        sout | "stopped";
    6361}
  • tests/concurrency/actors/executor.cfa

    rb006c51e r10a9479d  
    8484
    8585        sout | "starting";
    86 
    87         start_actor_system( e );
    88 
     86        actor_start( e );
    8987        sout | "started";
    90 
    9188        d_actor actors[ Actors ];
    92 
    9389        for ( i; Actors ) {
    9490                actors[i] | shared_msg;
    9591        } // for
    96 
    9792        sout | "stopping";
    98 
    99         stop_actor_system();
    100 
     93        actor_stop();
    10194        sout | "stopped";
    10295}
  • tests/concurrency/actors/inherit.cfa

    rb006c51e r10a9479d  
    2929        sout | "Start";
    3030        {
    31                 start_actor_system();
     31                actor_start();
    3232                D_msg * dm = alloc();
    3333                (*dm){};
     
    4040                *s | *dm;
    4141                *s2 | *dm2;
    42                 stop_actor_system();
     42                actor_stop();
    4343        }
    4444        {
    45                 start_actor_system();
     45                actor_start();
    4646                Server s[2];
    4747                D_msg * dm = alloc();
     
    5151                s[0] | *dm;
    5252                s[1] | *dm2;
    53                 stop_actor_system();
     53                actor_stop();
    5454        }
    5555        sout | "Finished";
  • tests/concurrency/actors/inline.cfa

    rb006c51e r10a9479d  
    3838        processor p;
    3939        {
    40                 start_actor_system();                                                           // sets up executor
     40                actor_start();                                                          // sets up executor
    4141                d_actor da;
    4242                d_msg * dm = alloc();
    4343                (*dm){ 42, 2423 };
    4444                da | *dm;
    45                 stop_actor_system();                                                            // waits until actors finish
     45                actor_stop();                                                           // waits until actors finish
    4646        }
    4747        {
    48                 start_actor_system();                                                           // sets up executor
     48                actor_start();                                                          // sets up executor
    4949                d_actor da;
    5050                d_msg2 dm{ 29079 };
     
    5454                virtual_dtor * v = &dm;
    5555                da | dm;
    56                 stop_actor_system();                                                            // waits until actors finish
     56                actor_stop();                                                           // waits until actors finish
    5757        }
    5858}
  • tests/concurrency/actors/matrixMultiply.cfa

    rb006c51e r10a9479d  
    8888
    8989        sout | "starting";
    90 
    91         start_actor_system( e );
    92 
     90        actor_start( e );
    9391        sout | "started";
    94 
    9592        derived_msg messages[xr];
    96 
    9793        derived_actor actors[xr];
    9894
     
    10096                messages[r]{ Z[r], X[r], Y };
    10197        } // for
    102 
    10398        for ( r; xr ) {
    10499                actors[r] | messages[r];
     
    106101
    107102        sout | "stopping";
    108 
    109         stop_actor_system();
    110 
     103        actor_stop();
    111104        sout | "stopped";
    112105
  • tests/concurrency/actors/pingpong.cfa

    rb006c51e r10a9479d  
    4747        processor p[Processors - 1];
    4848
    49         start_actor_system( Processors ); // test passing number of processors
     49        actor_start( Processors ); // test passing number of processors
    5050        ping pi_actor;
    5151        pong po_actor;
     
    5454        p_msg m;
    5555        pi_actor | m;
    56         stop_actor_system();
     56        actor_stop();
    5757
    5858        sout | "end";
  • tests/concurrency/actors/poison.cfa

    rb006c51e r10a9479d  
    1515        sout | "Finished";
    1616        {
    17                 start_actor_system();
     17                actor_start();
    1818                Server s[10];
    1919                for ( i; 10 ) {
    2020                        s[i] | finished_msg;
    2121                }
    22                 stop_actor_system();
     22                actor_stop();
    2323        }
    2424
    2525        sout | "Delete";
    2626        {
    27                 start_actor_system();
     27                actor_start();
    2828                for ( i; 10 ) {
    2929                        Server * s = alloc();
     
    3131                        (*s) | delete_msg;
    3232                }
    33                 stop_actor_system();
     33                actor_stop();
    3434        }
    3535
    3636        sout | "Destroy";
    3737        {
    38                 start_actor_system();
     38                actor_start();
    3939                Server s[10];
    4040                for ( i; 10 )
    4141                        s[i] | destroy_msg;
    42                 stop_actor_system();
     42                actor_stop();
    4343                for ( i; 10 )
    4444                        if (s[i].val != 777)
  • tests/concurrency/actors/static.cfa

    rb006c51e r10a9479d  
    4545
    4646        executor e{ 0, 1, 1, false };
    47         start_actor_system( e );
    48 
     47        actor_start( e );
    4948        sout | "started";
    50 
    5149        derived_msg msg;
    52 
    5350        derived_actor actor;
    54 
    5551        actor | msg;
    56 
    57         stop_actor_system();
    58 
     52        actor_stop();
    5953        sout | "stopped";
    6054}
  • tests/concurrency/actors/types.cfa

    rb006c51e r10a9479d  
    6767
    6868        sout | "basic test";
    69         start_actor_system( Processors ); // test passing number of processors
     69        actor_start( Processors ); // test passing number of processors
    7070        derived_actor a;
    7171        d_msg b, c;
     
    7373        c.num = 2;
    7474        a | b | c;
    75         stop_actor_system();
     75        actor_stop();
    7676
    7777        sout | "same message and different actors test";
    78         start_actor_system(); // let system detect # of processors
     78        actor_start(); // let system detect # of processors
    7979        derived_actor2 d_ac2_0, d_ac2_1;
    8080        d_msg d_ac2_msg;
     
    8282        d_ac2_0 | d_ac2_msg;
    8383        d_ac2_1 | d_ac2_msg;
    84         stop_actor_system();
     84        actor_stop();
    8585
    8686       
     
    8888                sout | "same message and different actor types test";
    8989                executor e{ 0, Processors, Processors == 1 ? 1 : Processors * 4, false };
    90                 start_actor_system( e ); // pass an explicit executor
     90                actor_start( e ); // pass an explicit executor
    9191                derived_actor2 d_ac2_2;
    9292                derived_actor3 d_ac3_0;
     
    9595                d_ac3_0 | d_ac23_msg;
    9696                d_ac2_2 | d_ac23_msg;
    97                 stop_actor_system();
     97                actor_stop();
    9898        } // RAII to clean up executor
    9999
     
    101101                sout | "different message types, one actor test";
    102102                executor e{ 1, Processors, Processors == 1 ? 1 : Processors * 4, true };
    103                 start_actor_system( Processors );
     103                actor_start( Processors );
    104104                derived_actor3 a3;
    105105                d_msg b1;
     
    108108                c2.num = 5;
    109109                a3 | b1 | c2;
    110                 stop_actor_system();
     110                actor_stop();
    111111        } // RAII to clean up executor
    112112
     
    114114                sout | "nested inheritance actor test";
    115115                executor e{ 1, Processors, Processors == 1 ? 1 : Processors * 4, true };
    116                 start_actor_system( Processors );
     116                actor_start( Processors );
    117117                derived_actor4 a4;
    118118                d_msg b1;
     
    121121                c2.num = 5;
    122122                a4 | b1 | c2;
    123                 stop_actor_system();
     123                actor_stop();
    124124        } // RAII to clean up executor
    125125
  • tests/concurrency/barrier/order.cfa

    rb006c51e r10a9479d  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // order.cfa -- validates barriers the return value of
    8 //                                 barrier block
     7// order.cfa -- validates barrier return value from barrier block
    98//
    109// Author           : Thierry Delisle
    1110// Created On       : Fri Apr 01 11:39:09 2022
    12 // Last Modified By :
    13 // Last Modified On :
    14 // Update Count     :
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sun Nov 10 11:22:56 2024
     13// Update Count     : 20
    1514//
    16 
    17 // Test validates barrier and block return value by checking
    18 // that no more than one thread gets the same return value
    1915
    2016#include <concurrency/barrier.hfa>
     
    2319#include <thread.hfa>
    2420
    25 const unsigned NUM_LAPS = 173;
    26 const unsigned NUM_THREADS = 11;
     21enum { NUM_LAPS = 173, NUM_THREADS = 11 };
    2722
    28 // The barrier we are testing
    2923barrier bar = { NUM_THREADS };
    3024
    31 // The return values of the previous generation.
    32 volatile unsigned * generation;
     25volatile unsigned generation = 0;                                               // count laps
     26void last() {
     27        generation += 1;                                                                        // last thread at barrier advances
     28}
     29volatile unsigned * generations;                                                // global array pointer
    3330
    3431thread Tester {};
    3532void main( Tester & this ) {
    36         // Repeat a few times
    37         for(l; NUM_LAPS) {
    38                 // Yield for chaos
    39                 yield( prng(this, 10) );
     33        for ( l; NUM_LAPS ) {
     34                yield( prng( this, 10 ) );                                              // yield for chaos
     35                unsigned int order = block( bar, last );                // block at barrier
    4036
    41                 // Block and what order we arrived
    42                 unsigned ret = block(bar);
    43 
    44                 // Check what was the last generation of that last thread in this position
    45                 unsigned g = generation[ret];
    46 
    47                 // Is it what we expect?
    48                 if(g != l) {
    49                         // Complain that they are different
    50                         sout | "Gen" | l | ": Expeced generation at" | ret | "to be" | l | "was" | g;
    51                 }
    52 
    53                 // Mark the expected next generation
    54                 generation[ret] = l+1;
    55         }
     37                // For G == T, no thread should be able to advance generation until current generation finishes.
     38                if ( generation - 1 != l || generations[order] != l ) { // generation advanced in block
     39                        mutex( sout ) sout | "mismatched generation, expected" | l | "got" | generation;
     40                } // if
     41                generations[order] = l + 1;                                             // every thread advances their current order generation
     42        } // for
    5643}
    5744
    5845int main() {
    59         // Create the data ans zero it.
    6046        volatile unsigned gen_data[NUM_THREADS];
    61         for(t; NUM_THREADS)
    62                 gen_data[t] = 0;
     47        for( t; NUM_THREADS ) gen_data[t] = 0;
     48        generations = gen_data;                                                         // global points at local
    6349
    64         generation = gen_data;
    65 
    66         // Run the experiment
    67         processor p[4];
    68         {
     50        processor p[4];                                                                         // parallelism
     51        {                                                                                                       // run experiment
    6952                Tester testers[NUM_THREADS];
    7053        }
Note: See TracChangeset for help on using the changeset viewer.