- Timestamp:
- Nov 23, 2024, 8:28:37 PM (14 months ago)
- 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. - Location:
- tests
- Files:
-
- 4 added
- 10 edited
-
.expect/poly-member.txt (added)
-
.expect/tuplearray.txt (added)
-
concurrency/actors/dynamic.cfa (modified) (2 diffs)
-
concurrency/actors/executor.cfa (modified) (1 diff)
-
concurrency/actors/inherit.cfa (modified) (3 diffs)
-
concurrency/actors/inline.cfa (modified) (2 diffs)
-
concurrency/actors/matrixMultiply.cfa (modified) (3 diffs)
-
concurrency/actors/pingpong.cfa (modified) (2 diffs)
-
concurrency/actors/poison.cfa (modified) (2 diffs)
-
concurrency/actors/static.cfa (modified) (1 diff)
-
concurrency/actors/types.cfa (modified) (9 diffs)
-
concurrency/barrier/order.cfa (modified) (2 diffs)
-
poly-member.cfa (added)
-
tuplearray.cfa (added)
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrency/actors/dynamic.cfa
rb006c51e r10a9479d 48 48 49 49 executor e{ 0, 1, 1, false }; 50 start_actor_system( e ); 51 50 actor_start( e ); 52 51 sout | "started"; 53 52 … … 58 57 *d_actor | *d_msg; 59 58 60 stop_actor_system(); 61 59 actor_stop(); 62 60 sout | "stopped"; 63 61 } -
tests/concurrency/actors/executor.cfa
rb006c51e r10a9479d 84 84 85 85 sout | "starting"; 86 87 start_actor_system( e ); 88 86 actor_start( e ); 89 87 sout | "started"; 90 91 88 d_actor actors[ Actors ]; 92 93 89 for ( i; Actors ) { 94 90 actors[i] | shared_msg; 95 91 } // for 96 97 92 sout | "stopping"; 98 99 stop_actor_system(); 100 93 actor_stop(); 101 94 sout | "stopped"; 102 95 } -
tests/concurrency/actors/inherit.cfa
rb006c51e r10a9479d 29 29 sout | "Start"; 30 30 { 31 start_actor_system();31 actor_start(); 32 32 D_msg * dm = alloc(); 33 33 (*dm){}; … … 40 40 *s | *dm; 41 41 *s2 | *dm2; 42 stop_actor_system();42 actor_stop(); 43 43 } 44 44 { 45 start_actor_system();45 actor_start(); 46 46 Server s[2]; 47 47 D_msg * dm = alloc(); … … 51 51 s[0] | *dm; 52 52 s[1] | *dm2; 53 stop_actor_system();53 actor_stop(); 54 54 } 55 55 sout | "Finished"; -
tests/concurrency/actors/inline.cfa
rb006c51e r10a9479d 38 38 processor p; 39 39 { 40 start_actor_system(); // sets up executor40 actor_start(); // sets up executor 41 41 d_actor da; 42 42 d_msg * dm = alloc(); 43 43 (*dm){ 42, 2423 }; 44 44 da | *dm; 45 stop_actor_system(); // waits until actors finish45 actor_stop(); // waits until actors finish 46 46 } 47 47 { 48 start_actor_system(); // sets up executor48 actor_start(); // sets up executor 49 49 d_actor da; 50 50 d_msg2 dm{ 29079 }; … … 54 54 virtual_dtor * v = &dm; 55 55 da | dm; 56 stop_actor_system(); // waits until actors finish56 actor_stop(); // waits until actors finish 57 57 } 58 58 } -
tests/concurrency/actors/matrixMultiply.cfa
rb006c51e r10a9479d 88 88 89 89 sout | "starting"; 90 91 start_actor_system( e ); 92 90 actor_start( e ); 93 91 sout | "started"; 94 95 92 derived_msg messages[xr]; 96 97 93 derived_actor actors[xr]; 98 94 … … 100 96 messages[r]{ Z[r], X[r], Y }; 101 97 } // for 102 103 98 for ( r; xr ) { 104 99 actors[r] | messages[r]; … … 106 101 107 102 sout | "stopping"; 108 109 stop_actor_system(); 110 103 actor_stop(); 111 104 sout | "stopped"; 112 105 -
tests/concurrency/actors/pingpong.cfa
rb006c51e r10a9479d 47 47 processor p[Processors - 1]; 48 48 49 start_actor_system( Processors ); // test passing number of processors49 actor_start( Processors ); // test passing number of processors 50 50 ping pi_actor; 51 51 pong po_actor; … … 54 54 p_msg m; 55 55 pi_actor | m; 56 stop_actor_system();56 actor_stop(); 57 57 58 58 sout | "end"; -
tests/concurrency/actors/poison.cfa
rb006c51e r10a9479d 15 15 sout | "Finished"; 16 16 { 17 start_actor_system();17 actor_start(); 18 18 Server s[10]; 19 19 for ( i; 10 ) { 20 20 s[i] | finished_msg; 21 21 } 22 stop_actor_system();22 actor_stop(); 23 23 } 24 24 25 25 sout | "Delete"; 26 26 { 27 start_actor_system();27 actor_start(); 28 28 for ( i; 10 ) { 29 29 Server * s = alloc(); … … 31 31 (*s) | delete_msg; 32 32 } 33 stop_actor_system();33 actor_stop(); 34 34 } 35 35 36 36 sout | "Destroy"; 37 37 { 38 start_actor_system();38 actor_start(); 39 39 Server s[10]; 40 40 for ( i; 10 ) 41 41 s[i] | destroy_msg; 42 stop_actor_system();42 actor_stop(); 43 43 for ( i; 10 ) 44 44 if (s[i].val != 777) -
tests/concurrency/actors/static.cfa
rb006c51e r10a9479d 45 45 46 46 executor e{ 0, 1, 1, false }; 47 start_actor_system( e ); 48 47 actor_start( e ); 49 48 sout | "started"; 50 51 49 derived_msg msg; 52 53 50 derived_actor actor; 54 55 51 actor | msg; 56 57 stop_actor_system(); 58 52 actor_stop(); 59 53 sout | "stopped"; 60 54 } -
tests/concurrency/actors/types.cfa
rb006c51e r10a9479d 67 67 68 68 sout | "basic test"; 69 start_actor_system( Processors ); // test passing number of processors69 actor_start( Processors ); // test passing number of processors 70 70 derived_actor a; 71 71 d_msg b, c; … … 73 73 c.num = 2; 74 74 a | b | c; 75 stop_actor_system();75 actor_stop(); 76 76 77 77 sout | "same message and different actors test"; 78 start_actor_system(); // let system detect # of processors78 actor_start(); // let system detect # of processors 79 79 derived_actor2 d_ac2_0, d_ac2_1; 80 80 d_msg d_ac2_msg; … … 82 82 d_ac2_0 | d_ac2_msg; 83 83 d_ac2_1 | d_ac2_msg; 84 stop_actor_system();84 actor_stop(); 85 85 86 86 … … 88 88 sout | "same message and different actor types test"; 89 89 executor e{ 0, Processors, Processors == 1 ? 1 : Processors * 4, false }; 90 start_actor_system( e ); // pass an explicit executor90 actor_start( e ); // pass an explicit executor 91 91 derived_actor2 d_ac2_2; 92 92 derived_actor3 d_ac3_0; … … 95 95 d_ac3_0 | d_ac23_msg; 96 96 d_ac2_2 | d_ac23_msg; 97 stop_actor_system();97 actor_stop(); 98 98 } // RAII to clean up executor 99 99 … … 101 101 sout | "different message types, one actor test"; 102 102 executor e{ 1, Processors, Processors == 1 ? 1 : Processors * 4, true }; 103 start_actor_system( Processors );103 actor_start( Processors ); 104 104 derived_actor3 a3; 105 105 d_msg b1; … … 108 108 c2.num = 5; 109 109 a3 | b1 | c2; 110 stop_actor_system();110 actor_stop(); 111 111 } // RAII to clean up executor 112 112 … … 114 114 sout | "nested inheritance actor test"; 115 115 executor e{ 1, Processors, Processors == 1 ? 1 : Processors * 4, true }; 116 start_actor_system( Processors );116 actor_start( Processors ); 117 117 derived_actor4 a4; 118 118 d_msg b1; … … 121 121 c2.num = 5; 122 122 a4 | b1 | c2; 123 stop_actor_system();123 actor_stop(); 124 124 } // RAII to clean up executor 125 125 -
tests/concurrency/barrier/order.cfa
rb006c51e r10a9479d 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // order.cfa -- validates barriers the return value of 8 // barrier block 7 // order.cfa -- validates barrier return value from barrier block 9 8 // 10 9 // Author : Thierry Delisle 11 10 // 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 15 14 // 16 17 // Test validates barrier and block return value by checking18 // that no more than one thread gets the same return value19 15 20 16 #include <concurrency/barrier.hfa> … … 23 19 #include <thread.hfa> 24 20 25 const unsigned NUM_LAPS = 173; 26 const unsigned NUM_THREADS = 11; 21 enum { NUM_LAPS = 173, NUM_THREADS = 11 }; 27 22 28 // The barrier we are testing29 23 barrier bar = { NUM_THREADS }; 30 24 31 // The return values of the previous generation. 32 volatile unsigned * generation; 25 volatile unsigned generation = 0; // count laps 26 void last() { 27 generation += 1; // last thread at barrier advances 28 } 29 volatile unsigned * generations; // global array pointer 33 30 34 31 thread Tester {}; 35 32 void 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 40 36 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 56 43 } 57 44 58 45 int main() { 59 // Create the data ans zero it.60 46 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 63 49 64 generation = gen_data; 65 66 // Run the experiment 67 processor p[4]; 68 { 50 processor p[4]; // parallelism 51 { // run experiment 69 52 Tester testers[NUM_THREADS]; 70 53 }
Note:
See TracChangeset
for help on using the changeset viewer.