Changeset b110bcc for tests/concurrent
- Timestamp:
- Apr 21, 2023, 5:36:12 PM (3 years ago)
- Branches:
- ADT, master, stuck-waitfor-destruct
- Children:
- 28f8f15, 6e4c44d
- Parents:
- 2ed94a9 (diff), 699a97d (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/concurrent
- Files:
-
- 17 added
- 1 deleted
- 12 edited
-
actors/.expect/inherit.txt (added)
-
actors/.expect/poison.txt (added)
-
actors/.expect/types.txt (modified) (1 diff)
-
actors/dynamic.cfa (modified) (4 diffs)
-
actors/executor.cfa (modified) (5 diffs)
-
actors/inherit.cfa (added)
-
actors/matrix.cfa (modified) (3 diffs)
-
actors/pingpong.cfa (modified) (4 diffs)
-
actors/poison.cfa (added)
-
actors/static.cfa (modified) (4 diffs)
-
actors/types.cfa (modified) (7 diffs)
-
channels/.expect/churn.txt (added)
-
channels/.expect/contend.txt (added)
-
channels/.expect/daisy_chain.txt (added)
-
channels/.expect/hot_potato.txt (added)
-
channels/.expect/ping_pong.txt (added)
-
channels/.expect/pub_sub.txt (added)
-
channels/barrier.cfa (added)
-
channels/churn.cfa (added)
-
channels/contend.cfa (added)
-
channels/daisy_chain.cfa (added)
-
channels/hot_potato.cfa (added)
-
channels/parallel_harness.hfa (modified) (4 diffs)
-
channels/ping_pong.cfa (added)
-
channels/pub_sub.cfa (added)
-
pthread/.expect/bounded_buffer.x64.txt (modified) (1 diff)
-
pthread/.expect/bounded_buffer.x86.txt (modified) (1 diff)
-
signal/disjoint.cfa (modified) (1 diff)
-
waitfor/parse.cfa (modified) (2 diffs)
-
waitfor/parse2.cfa (deleted)
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/actors/.expect/types.txt
r2ed94a9 rb110bcc 12 12 -1 13 13 5 14 nested inheritance actor test 15 -1 16 5 14 17 end -
tests/concurrent/actors/dynamic.cfa
r2ed94a9 rb110bcc 7 7 int Times = 1000000; // default values 8 8 9 struct derived_actor { 10 inline actor; 11 }; 12 void ?{}( derived_actor & this ) { ((actor &)this){}; } 13 9 struct derived_actor { inline actor; }; 14 10 struct derived_msg { 15 11 inline message; … … 23 19 void ?{}( derived_msg & this ) { ((derived_msg &)this){ 0 }; } 24 20 25 26 21 Allocation receive( derived_actor & receiver, derived_msg & msg ) { 27 22 if ( msg.cnt >= Times ) { … … 33 28 derived_actor * d_actor = alloc(); 34 29 (*d_actor){}; 35 *d_actor |*d_msg;30 *d_actor << *d_msg; 36 31 return Delete; 37 32 } … … 63 58 derived_actor * d_actor = alloc(); 64 59 (*d_actor){}; 65 *d_actor |*d_msg;60 *d_actor << *d_msg; 66 61 67 62 printf("stopping\n"); -
tests/concurrent/actors/executor.cfa
r2ed94a9 rb110bcc 15 15 }; 16 16 void ?{}( d_actor & this ) with(this) { 17 ((actor &)this){};18 17 id = ids++; 19 18 gstart = (&this + (id / Set * Set - id)); // remember group-start array-element … … 24 23 25 24 struct d_msg { inline message; } shared_msg; 26 void ?{}( d_msg & this ) { ((message &) this){ Nodelete }; }27 25 28 26 Allocation receive( d_actor & this, d_msg & msg ) with( this ) { … … 30 28 if ( recs % Batch == 0 ) { 31 29 for ( i; Batch ) { 32 gstart[sends % Set] |shared_msg;30 gstart[sends % Set] << shared_msg; 33 31 sends += 1; 34 32 } … … 85 83 } // switch 86 84 87 88 85 executor e{ Processors, Processors, Processors == 1 ? 1 : Processors * 512, true }; 89 86 … … 97 94 98 95 for ( i; Actors ) { 99 actors[i] |shared_msg;96 actors[i] << shared_msg; 100 97 } // for 101 98 -
tests/concurrent/actors/matrix.cfa
r2ed94a9 rb110bcc 7 7 unsigned int xr = 500, xc = 500, yc = 500, Processors = 1; // default values 8 8 9 struct derived_actor { 10 inline actor; 11 }; 12 void ?{}( derived_actor & this ) { ((actor &)this){}; } 9 struct derived_actor { inline actor; }; 13 10 14 11 struct derived_msg { … … 21 18 void ?{}( derived_msg & this ) {} 22 19 void ?{}( derived_msg & this, int * Z, int * X, int ** Y ) { 23 ((message &) this){ Finished};20 ((message &) this){ Nodelete }; 24 21 this.Z = Z; 25 22 this.X = X; … … 108 105 109 106 for ( unsigned int r = 0; r < xr; r += 1 ) { 110 actors[r] |messages[r];107 actors[r] << messages[r]; 111 108 } // for 112 109 -
tests/concurrent/actors/pingpong.cfa
r2ed94a9 rb110bcc 6 6 #include <actor.hfa> 7 7 8 struct ping { 9 inline actor; 10 }; 11 static inline void ?{}( ping & this ) { ((actor &)this){}; } 12 13 struct pong { 14 inline actor; 15 }; 16 static inline void ?{}( pong & this ) { ((actor &)this){}; } 8 struct ping { inline actor; }; 9 struct pong { inline actor; }; 17 10 18 11 struct p_msg { … … 32 25 Allocation retval = Nodelete; 33 26 if ( msg.count == times ) retval = Finished; 34 *po |msg;27 *po << msg; 35 28 return retval; 36 29 } … … 42 35 Allocation retval = Nodelete; 43 36 if ( msg.count == times ) retval = Finished; 44 *pi |msg;37 *pi << msg; 45 38 return retval; 46 39 } … … 60 53 pi = &pi_actor; 61 54 p_msg m; 62 pi_actor |m;55 pi_actor << m; 63 56 stop_actor_system(); 64 57 -
tests/concurrent/actors/static.cfa
r2ed94a9 rb110bcc 7 7 int Times = 1000000; // default values 8 8 9 struct derived_actor { 10 inline actor; 11 }; 12 void ?{}( derived_actor & this ) { ((actor &)this){}; } 13 9 struct derived_actor { inline actor; }; 14 10 struct derived_msg { 15 11 inline message; … … 23 19 void ?{}( derived_msg & this ) { ((derived_msg &)this){ 0 }; } 24 20 25 26 21 Allocation receive( derived_actor & receiver, derived_msg & msg ) { 27 22 if ( msg.cnt >= Times ) { … … 30 25 } 31 26 msg.cnt++; 32 receiver |msg;27 receiver << msg; 33 28 return Nodelete; 34 29 } … … 60 55 derived_actor actor; 61 56 62 actor |msg;57 actor << msg; 63 58 64 59 printf("stopping\n"); -
tests/concurrent/actors/types.cfa
r2ed94a9 rb110bcc 18 18 int num; 19 19 }; 20 static inline void ?{}( d_msg & this ) { ((message &)this){}; }21 20 22 21 // this isn't a valid receive routine since int is not a message type … … 36 35 inline actor; 37 36 }; 38 static inline void ?{}( derived_actor2 & this ) { ((actor &)this){}; }39 37 40 38 Allocation receive( derived_actor2 & receiver, d_msg & msg ) { … … 43 41 } 44 42 45 struct derived_actor3 { 46 inline actor; 47 }; 48 static inline void ?{}( derived_actor3 & this ) { ((actor &)this){}; } 49 43 struct derived_actor3 { inline actor; }; 44 struct derived_actor4 { inline derived_actor3; }; 50 45 struct d_msg2 { 51 46 inline message; 52 47 int num; 53 48 }; 54 static inline void ?{}( d_msg2 & this ) { ((message &)this){}; }55 49 56 50 Allocation receive( derived_actor3 & receiver, d_msg & msg ) { … … 78 72 b.num = 1; 79 73 c.num = 2; 80 a | b |c;74 a << b << c; 81 75 stop_actor_system(); 82 76 … … 86 80 d_msg d_ac2_msg; 87 81 d_ac2_msg.num = 3; 88 d_ac2_0 |d_ac2_msg;89 d_ac2_1 |d_ac2_msg;82 d_ac2_0 << d_ac2_msg; 83 d_ac2_1 << d_ac2_msg; 90 84 stop_actor_system(); 91 85 … … 99 93 d_msg d_ac23_msg; 100 94 d_ac23_msg.num = 4; 101 d_ac3_0 |d_ac23_msg;102 d_ac2_2 |d_ac23_msg;95 d_ac3_0 << d_ac23_msg; 96 d_ac2_2 << d_ac23_msg; 103 97 stop_actor_system(); 104 98 } // RAII to clean up executor … … 113 107 b1.num = -1; 114 108 c2.num = 5; 115 a3 | b1 | c2; 109 a3 << b1 << c2; 110 stop_actor_system(); 111 } // RAII to clean up executor 112 113 { 114 printf("nested inheritance actor test\n"); 115 executor e{ 1, Processors, Processors == 1 ? 1 : Processors * 4, true }; 116 start_actor_system( Processors ); 117 derived_actor4 a4; 118 d_msg b1; 119 d_msg2 c2; 120 b1.num = -1; 121 c2.num = 5; 122 a4 << b1 << c2; 116 123 stop_actor_system(); 117 124 } // RAII to clean up executor -
tests/concurrent/channels/parallel_harness.hfa
r2ed94a9 rb110bcc 100 100 101 101 int test( size_t Processors, size_t Channels, size_t Producers, size_t Consumers, size_t ChannelSize ) { 102 size_t Clusters = 1;102 size_t Clusters = Processors; 103 103 // create a cluster 104 104 cluster clus[Clusters]; … … 108 108 } 109 109 110 channels = a new( Channels );110 channels = aalloc( Channels ); 111 111 112 112 // sout | "Processors: " | Processors | " ProdsPerChan: " | Producers | " ConsPerChan: " | Consumers | "Channels: " | Channels | " Channel Size: " | ChannelSize; … … 139 139 while( cons_done_count != Consumers * Channels ) { 140 140 for ( i; Channels ) { 141 if ( has_wait ing_consumers( channels[i] ) ){141 if ( has_waiters( channels[i] ) ){ 142 142 #ifdef BIG 143 143 bigObject b{0}; … … 150 150 151 151 } 152 // for ( i; Channels ) { 153 // // sout | get_count( channels[i] ); 154 // if ( get_count( channels[i] ) < Consumers ){ 155 // #ifdef BIG 156 // bigObject b{0}; 157 // #endif 158 // for ( j; Consumers ) { 159 // #ifdef BIG 160 // insert( channels[i], b ); 161 // #else 162 // insert( channels[i], 0 ); 163 // #endif 164 // } 165 // } 166 // } 152 167 153 sout | "cons"; 168 154 for ( i; Consumers * Channels ) { -
tests/concurrent/pthread/.expect/bounded_buffer.x64.txt
r2ed94a9 rb110bcc 1 producer total value is 442802 consumer total value is 442801 producer total value is 39780 2 consumer total value is 39780 -
tests/concurrent/pthread/.expect/bounded_buffer.x86.txt
r2ed94a9 rb110bcc 1 producer total value is 450602 consumer total value is 450601 producer total value is 1770 2 consumer total value is 1770 -
tests/concurrent/signal/disjoint.cfa
r2ed94a9 rb110bcc 38 38 39 39 // Use a global struct because the order needs to match with Signaller thread 40 st ruct {40 static struct { 41 41 global_t mut; 42 42 global_data_t data; -
tests/concurrent/waitfor/parse.cfa
r2ed94a9 rb110bcc 1 // ----------------------------------------------------------------------------------------2 // ----------------------------------------------------------------------------------------1 // 2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo 3 3 // 4 // DEPRECATED TEST 5 // DIFFERS BETWEEN DEBUG AND RELEASE 6 // 7 //---------------------------------------------------------------------------------------- 8 //---------------------------------------------------------------------------------------- 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // waitfor.c -- 8 // 9 // Author : Peter A. Buhr 10 // Created On : Wed Aug 30 17:53:29 2017 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Apr 10 22:52:18 2023 13 // Update Count : 64 14 // 9 15 10 16 #include <monitor.hfa> … … 12 18 monitor M {}; 13 19 14 M a; 15 16 void f1( M & mutex a ); 17 void f2( M & mutex a ); 18 void f2( M & mutex a, M & mutex b ); 19 void f3( M & mutex a ); 20 void f3( M & mutex a, M & mutex b ); 21 void f3( M & mutex a, M & mutex b, M & mutex c ); 22 23 void foo() { 24 25 //--------------------------------------- 26 waitfor( f1 : a ) { 27 1; 28 } 29 30 //--------------------------------------- 31 waitfor( f1 : a ) { 32 2; 33 } 34 waitfor( f2 : a ) { 35 3; 36 } 37 38 //--------------------------------------- 39 when( 1 < 3 ) waitfor( f2 : a, a ) { 40 4; 41 } 42 or timeout( 100 ) { 43 5; 44 } 45 46 //--------------------------------------- 47 when( 2 < 3 ) waitfor( f3 : a ) { 48 5; 49 } 20 void notcalled( M & mutex m1, M & mutex m2 ) { 21 abort(); 22 } 23 void or( M & mutex m ) { 24 abort(); 25 } 26 void timeout( M & mutex m ) { 27 abort(); 28 } 29 30 void fred( M & mutex m, M & mutex or, M & mutex timeout ) { 31 // test waitfor and when 32 33 waitfor( notcalled : m, m ); 34 35 waitfor( notcalled : m, m ) { 36 } 37 38 waitfor( notcalled : m, m ) { 39 } 40 41 when( true ) waitfor( notcalled : m, m ); 42 43 when( true ) waitfor( notcalled : m, m ) { 44 } 45 46 waitfor( notcalled : m, m ); 47 or waitfor( notcalled : m, m ); 48 49 when( true ) waitfor( notcalled : m, m ); 50 or when( true ) waitfor( notcalled : m, m ); 51 52 waitfor( notcalled : m, m ) { 53 } or waitfor( notcalled : m, m ) { 54 } 55 56 waitfor( notcalled : m, m ) { 57 } or waitfor( notcalled : m, m ) { 58 } 59 60 when( true ) waitfor( notcalled : m, m ) { 61 } or when( true ) waitfor( notcalled : m, m ) { 62 } 63 64 waitfor( notcalled : m, m ); 65 or waitfor( notcalled : m, m ) { 66 } 67 68 when( true ) waitfor( notcalled : m, m ); 69 or when( true ) waitfor( notcalled : m, m ) { 70 } 71 72 waitfor( notcalled : m, m ) { 73 } or waitfor( notcalled : m, m ); 74 75 when( true ) waitfor( notcalled : m, m ) { 76 } or when( true ) waitfor( notcalled : m, m ); 77 78 // test when, waitfor and else 79 80 waitfor( notcalled : m, m ); 81 or else; 82 83 when( true ) waitfor( notcalled : m, m ); 84 or else; 85 86 when( true ) waitfor( notcalled : m, m ); 87 or else; 88 89 waitfor( notcalled : m, m ) { 90 } or else { 91 } 92 93 when( true ) waitfor( notcalled : m, m ) { 94 } or else { 95 } 96 97 waitfor( notcalled : m, m ); 50 98 or else { 51 6; 52 } 53 54 //--------------------------------------- 55 when( 3 < 3 ) waitfor( f3 : a, a ) { 56 7; 57 } 58 or when( 4 < 3 ) timeout( 101 ) { 59 8; 60 } 61 or when( 5 < 3 ) else { 62 9; 63 } 64 65 //--------------------------------------- 66 when( 6 < 3 ) waitfor( f3 : a, a, a ) { 67 10; 68 } 69 or when( 7 < 3 ) waitfor( f1 : a ) { 70 11; 71 } 99 } 100 101 when( true ) waitfor( notcalled : m, m ); 72 102 or else { 73 12; 74 } 75 76 //--------------------------------------- 77 when( 8 < 3 ) waitfor( f3 : a, a ) { 78 13; 79 } 80 or waitfor( f1 : a ) { 81 14; 82 } 83 or when( 9 < 3 ) timeout( 102 ) { 84 15; 85 } 86 87 //--------------------------------------- 88 when( 10 < 3 ) waitfor( f1 : a ) { 89 16; 90 } 91 or waitfor( f2 : a, a ) { 92 17; 93 } 94 or timeout( 103 ) { 95 18; 96 } 97 or when( 11 < 3 ) else { 98 19; 99 } 100 } 101 102 int main() {} 103 } 104 105 when( true ) waitfor( notcalled : m, m ); 106 or else { 107 } 108 109 waitfor( notcalled : m, m ) { 110 } or else; 111 112 when( true ) waitfor( notcalled : m, m ) { 113 } or else; 114 115 waitfor( notcalled : m, m ); 116 or when( true ) else; 117 118 when( true ) waitfor( notcalled : m, m ); 119 or when( true ) else; 120 121 when( true ) waitfor( notcalled : m, m ); 122 or when( true ) else; 123 124 waitfor( notcalled : m, m ) { 125 } or when( true ) else { 126 } 127 128 when( true ) waitfor( notcalled : m, m ) { 129 } or when( true ) else { 130 } 131 132 waitfor( notcalled : m, m ); 133 or when( true ) else { 134 } 135 136 when( true ) waitfor( notcalled : m, m ); 137 or when( true ) else { 138 } 139 140 when( true ) waitfor( notcalled : m, m ); 141 or when( true ) else { 142 } 143 144 waitfor( notcalled : m, m ) { 145 } or when( true ) else; 146 147 when( true ) waitfor( notcalled : m, m ) { 148 } or when( true ) else; 149 150 // test when, waitfor and timeout 151 152 waitfor( notcalled : m, m ); 153 or timeout( 3 ); 154 155 waitfor( notcalled : m, m ); 156 or timeout( 3 ); 157 158 when( true ) waitfor( notcalled : m, m ); 159 or timeout( 3 ); 160 161 waitfor( notcalled : m, m ) { 162 } or timeout( 3 ) { 163 } 164 165 when( true ) waitfor( notcalled : m, m ) { 166 } or timeout( 3 ) { 167 } 168 169 when( true ) waitfor( notcalled : m, m ) { 170 } or timeout( 3 ) { 171 } 172 173 when( true ) waitfor( notcalled : m, m ) { 174 } or when ( true ) timeout( 3 ) { 175 } 176 177 when( true ) waitfor( notcalled : m, m ) { 178 } or when ( true ) timeout( 3 ) { 179 } 180 181 waitfor( notcalled : m, m ); 182 or timeout( 3 ) { 183 } 184 185 when( true ) waitfor( notcalled : m, m ); 186 or timeout( 3 ) { 187 } 188 189 when( true ) waitfor( notcalled : m, m ); 190 or when( true ) timeout( 3 ) { 191 } 192 193 waitfor( notcalled : m, m ) { 194 } or timeout( 3 ); 195 196 when( true ) waitfor( notcalled : m, m ) { 197 } or timeout( 3 ); 198 199 when( true ) waitfor( notcalled : m, m ) { 200 } or when( true ) timeout( 3 ); 201 202 // test when, waitfor, timeout and else 203 204 waitfor( notcalled : m, m ) { 205 } or timeout( 3 ) { 206 } or when( true ) else {} 207 208 when( true ) waitfor( notcalled : m, m ) { 209 } or timeout( 3 ) { 210 } or when( true ) else {} 211 212 waitfor( notcalled : m, m ) { 213 } or timeout( 3 ) { 214 } or when( true ) else {} 215 216 waitfor( notcalled : m, m ) { 217 } or when( true ) timeout( 3 ) { 218 } or when( true ) else {} 219 220 when( true ) waitfor( notcalled : m, m ) { 221 } or timeout( 3 ) { 222 } or when( true ) else {} 223 224 waitfor( notcalled : m, m ) { 225 } or when( true ) timeout( 3 ) { 226 } or when( true ) else {} 227 228 when( true ) waitfor( notcalled : m, m ) { 229 } or when( true ) timeout( 3 ) { 230 } or when( true ) else {} 231 232 // test quasi-keywords "or" and "timeout" 233 234 int or = 0, timeout = 0; 235 waitfor( timeout : timeout ) timeout += 1; or timeout( timeout ); 236 waitfor( notcalled : or, or ) or += 1; or timeout( or ) 3; 237 when( or ) waitfor( or : m ) { 4; } or timeout( or ) or += 1; 238 when( timeout ) waitfor( notcalled : timeout, timeout ) or += 1; or else timeout += 1; 239 when( or + timeout ) waitfor( or : m ) 4; or when( or ) timeout( or ) 4; or when( or ) else timeout += 1; 240 when( 3 ) waitfor( or : or ) 3; or when( or ) waitfor( notcalled : or, or ) 4; or else 4; 241 when( timeout ) waitfor( or : timeout ) 3; or waitfor( notcalled : timeout, or ) 4; or when( or ) timeout( timeout ) 4; 242 when( 3 ) waitfor( or : timeout ) or += 1; 243 or waitfor( or : or ) timeout += 1; 244 or timeout( timeout ) or += 1; 245 or when( 3 ) else or += 1; 246 247 // test else selection 248 249 if ( or > timeout ) waitfor( or : or ) 3; 250 else waitfor( timeout : timeout ) 4; 251 } 252 253 //Dummy main 254 int main( int argc, char const * argv[] ) { 255 #pragma GCC warning "Compiled" // force non-empty .expect file, NO TABS!!! 256 } 257 258 // Local Variables: // 259 // tab-width: 4 // 260 // compile-command: "cfa waitfor.cfa" // 261 // End: //
Note:
See TracChangeset
for help on using the changeset viewer.