~gcrosswhite/charon/projects-BLACS

« back to all changes in this revision

Viewing changes to Charon.leo

  • Committer: Gregory Crosswhite
  • Date: 2009-01-21 02:26:10 UTC
  • Revision ID: gcross@phys.washington.edu-20090121022610-ajg6jrye2m7ao375
Modified array to use HPF data layout rather than Global Arrays layout.  Currently working through the regression tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?xml version="1.0" encoding="utf-8"?>
 
1
<?xml version="1.0" encoding="UTF-8"?>
2
2
<?xml-stylesheet ekr_test?>
3
3
<leo_file>
4
4
<leo_header file_format="2" tnodes="0" max_tnode_index="0" clone_windows="0"/>
5
5
<globals body_outline_ratio="0.5">
6
 
        <global_window_position top="25" left="10" height="845" width="1420"/>
 
6
        <global_window_position top="0" left="0" height="845" width="1420"/>
7
7
        <global_log_window_position top="0" left="0" height="0" width="0"/>
8
8
</globals>
9
9
<preferences/>
10
10
<find_panel_settings/>
11
11
<vnodes>
12
 
<v t="gmc.20080913210250.2" str_leo_pos="9,4,5,0"><vh>@chapters</vh></v>
 
12
<v t="gmc.20080913210250.2" str_leo_pos="17,2,1,4,1,3"><vh>@chapters</vh></v>
13
13
<v t="gmc.20080831173941.16"
14
14
marks="gcross.20081016111538.7,gcross.20081103140450.2,"><vh>@thin Makefile</vh></v>
15
15
<v t="gmc.20080927101647.32"><vh>Array Message Project</vh>
175
175
<v t="gcross.20081013161056.13" a="M"><vh>Operation Class Declaration</vh></v>
176
176
</v>
177
177
<v t="gcross.20081024124516.3"><vh>Distributed Array Controller Classes</vh>
178
 
<v t="gmc.20080831173941.24" a="E"><vh>Abstract D.A. Class Declaration</vh>
 
178
<v t="gmc.20080831173941.24"><vh>Abstract D.A. Class Declaration</vh>
179
179
<v t="gmc.20080831173941.27" a="E"><vh>Public methods</vh>
180
180
<v t="gmc.20080907163416.49"><vh>Constructors</vh></v>
181
181
<v t="gmc.20080907163416.3"><vh>Destructor</vh></v>
189
189
</v>
190
190
<v t="gmc.20080831173941.31"><vh>Fields</vh></v>
191
191
</v>
192
 
<v t="gmc.20080907163416.46" a="E"><vh>Standard D.A. Class Declaration</vh>
 
192
<v t="gmc.20080907163416.46"><vh>Standard D.A. Class Declaration</vh>
193
193
<v t="gmc.20080907163416.48"><vh>Public methods</vh>
194
194
<v t="gmc.20080831173941.25"><vh>Constructors</vh></v>
195
195
<v t="gmc.20080907163416.20"><vh>Scatter</vh></v>
196
196
<v t="gmc.20080907163416.27"><vh>Retrieve</vh></v>
197
197
<v t="gmc.20080907163416.51"><vh>Virtual element location methods</vh></v>
198
198
</v>
199
 
<v t="gmc.20080831173941.28" a="E"><vh>Protected methods</vh>
 
199
<v t="gmc.20080831173941.28"><vh>Protected methods</vh>
200
200
<v t="gmc.20080831173941.29"><vh>setupStorage</vh></v>
201
201
</v>
202
202
</v>
203
 
<v t="gmc.20080927101647.5" a="E"><vh>Block-Cyclic D.A. Class Declaration</vh>
 
203
<v t="gmc.20080927101647.5"><vh>Block-Cyclic D.A. Class Declaration</vh>
204
204
<v t="gmc.20080927101647.7" a="E"><vh>Public methods</vh>
205
205
<v t="gmc.20080927101647.11" a="M"><vh>Constructors</vh></v>
206
206
<v t="gmc.20080927101647.8"><vh>Virtual element location methods</vh></v>
216
216
<v t="gcross.20081030170932.5"><vh>(fields)</vh></v>
217
217
</v>
218
218
</v>
219
 
<v t="gcross.20081024124516.4" a="E"><vh>Iterator Classes</vh>
 
219
<v t="gcross.20081024124516.4"><vh>Iterator Classes</vh>
220
220
<v t="gmc.20080906211303.5"><vh>Coordinate Iterator</vh></v>
221
221
<v t="gmc.20080907163416.52"><vh>Domain Iterator</vh></v>
222
222
</v>
242
242
<v t="gcross.20081102101609.2"><vh>SolveOperation</vh></v>
243
243
</v>
244
244
</v>
245
 
<v t="gmc.20080905163534.2" a="E"><vh>Operations</vh>
 
245
<v t="gmc.20080905163534.2"><vh>Operations</vh>
246
246
<v t="gmc.20080831173941.44"><vh>Base Operation Class</vh></v>
247
247
<v t="gcross.20080930150516.14"><vh>Single Element Operation Base Class</vh></v>
248
248
<v t="gcross.20080930150516.11"><vh>Two argument operations</vh>
259
259
<v t="gmc.20080907163416.26"><vh>Full Data Retrieve Operation Class</vh></v>
260
260
<v t="gmc.20080927101647.36"><vh>Full Array Reduction Operation Class</vh></v>
261
261
<v t="gmc.20080905163534.5"><vh>Single Element Fetch Operation Class</vh></v>
262
 
<v t="gcross.20090120001539.4" a="E"><vh>Randomization Operations</vh>
 
262
<v t="gcross.20090120001539.4"><vh>Randomization Operations</vh>
263
263
<v t="gcross.20090120001539.3"><vh>Randomization Operation Class (0 args)</vh></v>
264
264
<v t="gcross.20090120001539.5"><vh>Randomization Operation Class (1 args)</vh></v>
265
265
<v t="gcross.20090120001539.6"><vh>Randomization Operation Class (2 args)</vh></v>
266
266
</v>
267
267
</v>
268
268
<v t="gmc.20080905163534.6"><vh>Messages Charm Interface</vh></v>
269
 
<v t="gmc.20080905163534.3" a="E"><vh>Data Messages</vh>
 
269
<v t="gmc.20080905163534.3"><vh>Data Messages</vh>
270
270
<v t="gmc.20080905163534.4"><vh>Single Element Message</vh></v>
271
271
<v t="gmc.20080927101647.21" a="E"><vh>Array Message</vh>
272
272
<v t="gmc.20080927101647.26" a="E"><vh>public</vh>
282
282
</v>
283
283
</v>
284
284
</v>
285
 
<v t="gmc.20080927101647.12" a="E"><vh>Tests</vh>
286
 
<v t="gcross.20081117135700.2"><vh>MatrixMultiplierTests</vh>
287
 
<v t="gcross.20081117135700.3"><vh>MM1x1x1_lowlevel</vh></v>
288
 
<v t="gcross.20081118105204.12"><vh>MM1x1x1_mediumlevel</vh></v>
289
 
<v t="gcross.20081118105204.2"><vh>MM1x2x1_lowlevel</vh></v>
290
 
<v t="gcross.20081119204334.2"><vh>MM1x2x1_mediumlevel</vh></v>
291
 
<v t="gcross.20081119205342.2"><vh>MM2x2x2_mediumlevel</vh></v>
292
 
<v t="gcross.20081119205342.3"><vh>MM3x3x3_mediumlevel</vh>
293
 
<v t="gcross.20081119205342.4"><vh>&lt;&lt; A data &gt;&gt;</vh></v>
294
 
<v t="gcross.20081119205342.5"><vh>&lt;&lt; B data &gt;&gt;</vh></v>
295
 
<v t="gcross.20081119205342.6"><vh>&lt;&lt; C data &gt;&gt;</vh></v>
296
 
</v>
297
 
<v t="gcross.20081119205342.7"><vh>MM3x5x7_mediumlevel</vh>
298
 
<v t="gcross.20081119205342.8"><vh>&lt;&lt; A data &gt;&gt;</vh></v>
299
 
<v t="gcross.20081119205342.9"><vh>&lt;&lt; B data &gt;&gt;</vh></v>
300
 
<v t="gcross.20081119205342.10"><vh>&lt;&lt; C data &gt;&gt;</vh></v>
301
 
</v>
302
 
<v t="gcross.20081119205342.15"><vh>MM9x10x11_mediumlevel</vh>
303
 
<v t="gcross.20081119205342.16"><vh>&lt;&lt; A data &gt;&gt;</vh></v>
304
 
<v t="gcross.20081119205342.17"><vh>&lt;&lt; B data &gt;&gt;</vh></v>
305
 
<v t="gcross.20081119205342.18"><vh>&lt;&lt; C data &gt;&gt;</vh></v>
306
 
</v>
307
 
</v>
308
 
<v t="gmc.20080927101647.31"><vh>ArrayMessageTests</vh>
309
 
<v t="gmc.20080927101647.33"><vh>SerializeDeserialize_1D_Trivial</vh></v>
310
 
<v t="gcross.20081117194405.10"><vh>SerializeDeserialize_1D_List</vh></v>
311
 
<v t="gcross.20081114181412.6"><vh>ArrayMessageProductReduction_1D</vh></v>
312
 
<v t="gcross.20081115013213.2"><vh>ArrayMessageSumReduction_1D</vh></v>
313
 
</v>
314
 
<v t="gcross.20081106211237.15"><vh>ProcessorCoordinatesTests</vh>
315
 
<v t="gcross.20081106211237.16"><vh>ProcessorCoordinatesToIndex</vh></v>
316
 
<v t="gcross.20081106211237.17"><vh>IndexToProcessorCoordinates</vh></v>
317
 
<v t="gcross.20081106211237.18"><vh>SingleElementIndex</vh></v>
318
 
<v t="gcross.20081106211237.19"><vh>CoordinateIterator</vh></v>
319
 
</v>
320
 
<v t="gmc.20080927101647.13"><vh>BlockCyclicTests</vh>
321
 
<v t="gmc.20080927101647.14"><vh>1D</vh>
322
 
<v t="gmc.20080927101647.15"><vh>Compute element location tests</vh></v>
323
 
<v t="gmc.20080927101647.19"><vh>Sequence scatter</vh></v>
324
 
</v>
325
 
<v t="gmc.20080927101647.17"><vh>2D</vh>
326
 
<v t="gmc.20080927101647.18"><vh>Compute element location tests</vh></v>
327
 
</v>
328
 
</v>
329
 
<v t="gmc.20080907163416.10" a="E"><vh>VectorTests</vh>
330
 
<v t="gmc.20080907163416.41"><vh>Informational</vh>
331
 
<v t="gmc.20080907163416.42"><vh>StandardStorage</vh></v>
332
 
<v t="gmc.20080907163416.45"><vh>fortranStorage</vh></v>
333
 
</v>
334
 
<v t="gmc.20080907163416.16"><vh>ElementReference</vh>
335
 
<v t="gmc.20080907163416.17"><vh>ComparisonOperator</vh></v>
336
 
</v>
337
 
<v t="gmc.20080907163416.11"><vh>Operations</vh>
338
 
<v t="gmc.20080907163416.12"><vh>MultipleArithmeticOperations</vh></v>
339
 
</v>
340
 
<v t="gmc.20080907163416.8" a="E"><vh>Scattering/Retrieving</vh>
341
 
<v t="gmc.20080907163416.9"><vh>ScatterSmallVector</vh></v>
342
 
<v t="gmc.20080907163416.43"><vh>ScatterTensor</vh></v>
343
 
<v t="gmc.20080907163416.39"><vh>GatherSmallVector</vh></v>
344
 
<v t="gmc.20080907163416.44"><vh>GatherTensor</vh></v>
345
 
</v>
346
 
<v t="gmc.20080927101647.47" a="E"><vh>Reductions</vh>
347
 
<v t="gmc.20080927101647.54"><vh>AllReduction</vh></v>
348
 
<v t="gcross.20080930150516.6"><vh>AnyReduction</vh></v>
349
 
<v t="gcross.20080930150516.5"><vh>ProductReduction</vh></v>
350
 
<v t="gmc.20080927101647.48"><vh>SumReduction_1D</vh></v>
351
 
<v t="gmc.20080927101647.51"><vh>SumReduction_3D</vh></v>
352
 
</v>
353
 
<v t="gcross.20090120130405.3" a="E"><vh>Randomization</vh>
354
 
<v t="gcross.20090120130405.4"><vh>UniformRandomization</vh></v>
355
 
</v>
356
 
</v>
357
 
</v>
358
285
<v t="gmc.20080927101647.20"><vh>Functions</vh>
359
286
<v t="gmc.20080831173941.40"><vh>Blitz PUPers</vh></v>
360
287
<v t="gmc.20080930225830.3"><vh>Stash callback</vh></v>
378
305
<v t="gmc.20080907163416.26"><vh>Full Data Retrieve Operation Class</vh></v>
379
306
<v t="gmc.20080927101647.36"><vh>Full Array Reduction Operation Class</vh></v>
380
307
<v t="gmc.20080905163534.5"><vh>Single Element Fetch Operation Class</vh></v>
381
 
<v t="gcross.20090120001539.4" a="E"><vh>Randomization Operations</vh>
 
308
<v t="gcross.20090120001539.4"><vh>Randomization Operations</vh>
382
309
<v t="gcross.20090120001539.3"><vh>Randomization Operation Class (0 args)</vh></v>
383
310
<v t="gcross.20090120001539.5"><vh>Randomization Operation Class (1 args)</vh></v>
384
311
<v t="gcross.20090120001539.6"><vh>Randomization Operation Class (2 args)</vh></v>
425
352
<v t="gcross.20081014125825.3"><vh>@thin controller.C</vh></v>
426
353
</v>
427
354
<v t="gmc.20080907163416.18" a="E"><vh>Charon</vh>
428
 
<v t="gmc.20080831173941.8" a="E"
 
355
<v t="gmc.20080831173941.8"
429
356
marks="gmc.20080927101647.11,gmc.20080927101647.9,"
430
 
expanded="gcross.20081106211237.21,gmc.20080831173941.24,gmc.20080831173941.27,gmc.20080907163416.46,gmc.20080831173941.28,gmc.20080927101647.5,gmc.20080927101647.7,gmc.20080927101647.10,gmc.20080927101647.38,gmc.20080927101647.21,gmc.20080927101647.26,gcross.20081106211237.4,gmc.20080905163534.2,gcross.20090120001539.4,"><vh>@thin charon.h</vh></v>
431
 
<v t="gmc.20080831173941.18"><vh>@thin charon.ci</vh></v>
 
357
expanded="gcross.20081106211237.20,gmc.20080831173941.43,gmc.20080831173941.24,gmc.20080831173941.27,gmc.20080907163416.46,gmc.20080927101647.5,gmc.20080927101647.7,gmc.20080927101647.10,gmc.20080831173941.20,gmc.20080927101647.38,gmc.20080927101647.21,gmc.20080927101647.26,gcross.20081106211237.4,gmc.20080905163534.2,"><vh>@thin charon.h</vh></v>
 
358
<v t="gmc.20080831173941.18" a="E"><vh>@thin charon.ci</vh></v>
432
359
<v t="gmc.20080831173941.19"><vh>@thin charon.C</vh></v>
433
360
<v t="gcross.20081013161056.14"><vh>@thin charon_macros.h</vh></v>
434
361
</v>
445
372
</v>
446
373
<v t="gmc.20080907163416.19" a="E"><vh>Regression Testing</vh>
447
374
<v t="gmc.20080831173941.9"><vh>@thin test.ci</vh></v>
448
 
<v t="gmc.20080831173941.15" a="E"
 
375
<v t="gmc.20080831173941.15"
449
376
expanded="gcross.20081114181412.7,"><vh>@thin test.h</vh></v>
450
 
<v t="gcross.20090120130405.2" a="E"
451
 
expanded="gmc.20080907163416.10,gmc.20080907163416.8,gmc.20080927101647.47,gcross.20090120130405.3,"><vh>@thin test.C</vh></v>
 
377
<v t="gcross.20090120154450.2" a="E"
 
378
expanded="gmc.20080927101647.12,gmc.20080907163416.10,gmc.20080927101647.47,gmc.20080907163416.8,gmc.20080907163416.16,"><vh>@thin test.C</vh></v>
452
379
</v>
453
 
<v t="gcross.20081019105739.2" a="E"><vh>BLACS Grid</vh>
 
380
<v t="gcross.20081019105739.2"><vh>BLACS Grid</vh>
454
381
<v t="gcross.20081016111538.7" a="M"><vh>BLACS Grid Test Makefile</vh></v>
455
382
<v t="gcross.20081024124516.5"><vh>BLACS Grid Classes</vh>
456
383
<v t="gcross.20081205110513.19"><vh>BLACSGridSlave</vh>
482
409
<v t="gcross.20090119145903.2"><vh>@thin blacs_test.h</vh></v>
483
410
<v t="gcross.20090119145903.3"><vh>@thin blacs_test.ci</vh></v>
484
411
<v t="gcross.20090119145903.4" a="E"
485
 
expanded="gmc.20080927101647.12,gcross.20081108185724.10,"><vh>@thin blacs_test.C</vh></v>
 
412
expanded="gcross.20081108185724.10,"><vh>@thin blacs_test.C</vh></v>
486
413
</v>
487
414
<v t="gcross.20081103140450.6"><vh>Scalapack Test</vh>
488
415
<v t="gcross.20081103140450.2" a="M"><vh>Scalapack test</vh></v>
571
498
    return allType;
572
499
}
573
500
</t>
574
 
<t tx="gcross.20080930150516.5">testCase(ProductReduction,ReductionTests) {
575
 
    DistributedArray&lt;int,1&gt; x(3,7);
576
 
 
577
 
    int prod = 1;
578
 
 
579
 
    for(int i = 1; i &lt;= 7; i++) {
580
 
        x(i-1) = i;
581
 
        prod *= i;
582
 
    }
583
 
 
584
 
    assertEqual(x.product(),prod);
585
 
}
586
 
</t>
587
 
<t tx="gcross.20080930150516.6">testCase(AnyReduction,ReductionTests) {
588
 
    DistributedArray&lt;bool,1&gt; x(3,7);
589
 
 
590
 
    x = true;
591
 
 
592
 
    assertTrue(x.any());
593
 
 
594
 
    x = false;
595
 
 
596
 
    assertTrue(!x.any());
597
 
 
598
 
    x = false;
599
 
 
600
 
    x(0) = true;
601
 
    assertTrue(x.any());
602
 
 
603
 
    x = true;
604
 
 
605
 
    x(4) = false;
606
 
 
607
 
    assertTrue( (bool)x(0));
608
 
    assertTrue( (bool)x(1));
609
 
    assertTrue( (bool)x(2));
610
 
    assertTrue( (bool)x(3));
611
 
    assertTrue(!(bool)x(4));
612
 
    assertTrue( (bool)x(5));
613
 
    assertTrue( (bool)x(6));
614
 
 
615
 
    assertTrue(x.any());
616
 
 
617
 
}
618
 
</t>
619
501
<t tx="gcross.20080930150516.7">static CkReductionMsg *any (int nMsg,CkReductionMsg **msgs) {
620
502
    bool result = false;
621
503
    for (int i = 0; i &lt; nMsg; i++) 
1231
1113
 
1232
1114
ArrayMessage(const TinyVector&lt;int,N_rank&gt; shape, long tag_) : ArrayType(rawdata,shape), tag(tag_) { }
1233
1115
</t>
1234
 
<t tx="gcross.20081106211237.15">testSuite(ProcessorCoordinatesTests)
1235
 
</t>
1236
 
<t tx="gcross.20081106211237.16">testCase(ProcessorCoordinatesToIndex,ProcessorCoordinatesTests) {
1237
 
 
1238
 
    typedef TinyVector&lt;int,1&gt; TV1;
1239
 
    TV1 pe1 = 5;
1240
 
    TV1 c1 = 0;
1241
 
    for(int i = 0; i &lt; 5; i++) {
1242
 
        c1 = i;
1243
 
        assertEqual(processor_coordinates_to_index(pe1,c1),i)
1244
 
    }
1245
 
 
1246
 
    typedef TinyVector&lt;int,2&gt; TV2;
1247
 
    TV2 pe2, c2;
1248
 
    pe2 = 3, 5;
1249
 
    c2 = 0, 0;
1250
 
    for(int i = 0; i &lt; 5; i++) {
1251
 
        c2[1] = i;
1252
 
        assertEqual(processor_coordinates_to_index(pe2,c2),i)
1253
 
    }
1254
 
    c2[1] = 3;
1255
 
    for(int i = 0; i &lt; 3; i++) {
1256
 
        c2[0] = i;
1257
 
        assertEqual(processor_coordinates_to_index(pe2,c2),3+i*5)
1258
 
    }
1259
 
 
1260
 
    TinyVector&lt;int,5&gt; pe5, c5;
1261
 
    pe5 = 3, 1, 7, 2, 4;
1262
 
    c5  = 1, 0, 4, 0, 2;
1263
 
    assertEqual(processor_coordinates_to_index(pe5,c5),2+4*2*4+1*7*2*4);
1264
 
 
1265
 
 
1266
 
}
1267
 
</t>
1268
 
<t tx="gcross.20081106211237.17">testCase(IndexToProcessorCoordinates,ProcessorCoordinatesTests) {
1269
 
 
1270
 
    typedef TinyVector&lt;int,1&gt; TV1;
1271
 
    TV1 pe1 = 5;
1272
 
    TV1 c1 = 0;
1273
 
    for(int i = 0; i &lt; 5; i++) {
1274
 
        c1 = i;
1275
 
        assertArraysEqual(1, index_to_processor_coordinates(pe1,i), c1);
1276
 
    }
1277
 
 
1278
 
    typedef TinyVector&lt;int,2&gt; TV2;
1279
 
    TV2 pe2, c2;
1280
 
    pe2 = 3, 5;
1281
 
    c2 = 0, 0;
1282
 
    for(int i = 0; i &lt; 5; i++) {
1283
 
        c2[1] = i;
1284
 
        assertArraysEqual(2, index_to_processor_coordinates(pe2,i), c2);
1285
 
    }
1286
 
    c2[1] = 3;
1287
 
    for(int i = 0; i &lt; 3; i++) {
1288
 
        c2[0] = i;
1289
 
        assertArraysEqual(2, index_to_processor_coordinates(pe2,3+i*5), c2);
1290
 
    }
1291
 
 
1292
 
    TinyVector&lt;int,5&gt; pe5, c5;
1293
 
    pe5 = 3, 1, 7, 2, 4;
1294
 
    c5  = 1, 0, 4, 0, 2;
1295
 
    assertArraysEqual(5, index_to_processor_coordinates(pe5,2+4*2*4+1*7*2*4),c5);
1296
 
 
1297
 
 
1298
 
}
1299
 
</t>
1300
 
<t tx="gcross.20081106211237.18">testCase(SingleElementIndex,ProcessorCoordinatesTests) {
1301
 
 
1302
 
    DistributedArray&lt;int,3&gt; arr(120,4,5,6);
1303
 
 
1304
 
    TinyVector&lt;int,3&gt; dimensions;
1305
 
    dimensions = 4, 5, 6;
1306
 
 
1307
 
    assertArraysEqual(3,dimensions,arr.processor_dimensions());
1308
 
 
1309
 
    TinyVector&lt;int,3&gt; coordinates;
1310
 
    coordinates = 1,1,1;
1311
 
    assertEqual(arr(coordinates).index,processor_coordinates_to_index(dimensions,coordinates));
1312
 
 
1313
 
}
1314
 
</t>
1315
 
<t tx="gcross.20081106211237.19">testCase(CoordinateIteratorTest,ProcessorCoordinatesTests) {
1316
 
 
1317
 
    TinyVector&lt;int,3&gt; PE_dimensions(4,5,6);
1318
 
 
1319
 
    CoordinateIterator&lt;int,3&gt; iterator(PE_dimensions);
1320
 
 
1321
 
    for(int i = 0; i &lt; 120; i++, iterator++) {
1322
 
        assertArraysEqual(3,index_to_processor_coordinates(PE_dimensions,i),*iterator)
1323
 
    }
1324
 
 
1325
 
}
1326
 
</t>
1327
1116
<t tx="gcross.20081107155539.6">from time import clock
1328
1117
 
1329
1118
def crand(*shape):
1494
1283
    return arrays;
1495
1284
}
1496
1285
</t>
1497
 
<t tx="gcross.20081114181412.6">testCase(ArrayMessageProductReduction_1D,ArrayMessageTests) {
1498
 
    DistributedArray&lt;int,1&gt; remote(4,8);
1499
 
    remote = 0;
1500
 
 
1501
 
    Array&lt;int,1&gt; local(8);
1502
 
    local = 1, 1, 2, 3, 4, 5, 6, 7;
1503
 
    remote = local;
1504
 
 
1505
 
    CkReductionMsg* msg = remote.performReduction&lt;Testing_ArrayMessageReductionOperation&lt;int,1&gt; &gt;(Product);
1506
 
 
1507
 
    ArrayMessage&lt;int,1&gt;* result_message = ArrayMessage&lt;int,1&gt;::from_reduction(msg);
1508
 
 
1509
 
    assertEqual(48,(*result_message)(0));
1510
 
    assertEqual(105,(*result_message)(1));
1511
 
}
1512
 
</t>
1513
1286
<t tx="gcross.20081114181412.8">template&lt;typename T_numtype, int N_rank&gt; class Testing_ArrayMessageReductionOperation : public AbstractOperation&lt;T_numtype,N_rank&gt; {
1514
1287
 
1515
1288
PUPable_decl_template(Testing_ArrayMessageReductionOperation)
1576
1349
}
1577
1350
</t>
1578
1351
<t tx="gcross.20081114181412.11">@language cplusplus</t>
1579
 
<t tx="gcross.20081115013213.2">testCase(ArrayMessageSumReduction_1D,ArrayMessageTests) {
1580
 
    DistributedArray&lt;int,1&gt; remote(4,8);
1581
 
    remote = 0;
1582
 
 
1583
 
    Array&lt;int,1&gt; local(8);
1584
 
    local = 0, 1, 2, 3, 4, 5, 6, 7;
1585
 
    remote = local;
1586
 
 
1587
 
    CkReductionMsg* msg = remote.performReduction&lt;Testing_ArrayMessageReductionOperation&lt;int,1&gt; &gt;(Sum);
1588
 
 
1589
 
    ArrayMessage&lt;int,1&gt;* result_message = ArrayMessage&lt;int,1&gt;::from_reduction(msg);
1590
 
 
1591
 
    assertEqual(12,(*result_message)(0));
1592
 
    assertEqual(16,(*result_message)(1));
1593
 
 
1594
 
}
1595
 
</t>
1596
1352
<t tx="gcross.20081117012757.2">void receiveDestinationInformation(ResultSectionAnnouncementMessage* message) {
1597
1353
    if(message-&gt;gpe() == -1)
1598
1354
        CkAbort("Result destination information must be broadcast using CkMulticast so that it can contain the section information!");
1606
1362
    process_chunks();
1607
1363
}
1608
1364
</t>
1609
 
<t tx="gcross.20081117135700.2">testSuite(MatrixMultiplierTests)
1610
 
 
1611
 
@others
1612
 
 
1613
 
</t>
1614
 
<t tx="gcross.20081117135700.3">testCase(MM1x1x1_lowlevel,MatrixMultiplierTests) {
1615
 
 
1616
 
    CProxy_MatrixMultiplier&lt;float&gt; multiplier = CProxy_MatrixMultiplier&lt;float&gt;::ckNew(1,1,1);
1617
 
 
1618
 
    CkGroupID mCastGrpId = CProxy_CkMulticastMgr::ckNew();
1619
 
    CkMulticastMgr *mCastGrp = CProxy_CkMulticastMgr(mCastGrpId).ckLocalBranch();
1620
 
 
1621
 
    CkArrayIndex3D index(0,0,0);
1622
 
    CProxySection_MatrixMultiplier&lt;float&gt; section = CProxySection_MatrixMultiplier&lt;float&gt;::ckNew(multiplier, &amp;index, 1);
1623
 
    section.ckSectionDelegate(mCastGrp);
1624
 
 
1625
 
    CkCallback result_callback(CkCallback::resumeThread);
1626
 
 
1627
 
    section.receiveDestinationInformation(new ResultSectionAnnouncementMessage(mCastGrpId,result_callback));
1628
 
 
1629
 
    ArrayMessage&lt;float,2&gt;* result_message;
1630
 
 
1631
 
    CkReductionMsg* msg;
1632
 
 
1633
 
    {
1634
 
        Array&lt;float,2&gt; A_data(1,1);
1635
 
        Array&lt;float,2&gt; B_data(1,1);
1636
 
        Array&lt;float,2&gt; C_data(1,1);
1637
 
 
1638
 
        A_data = 1;
1639
 
        B_data = 1;
1640
 
        C_data = 1;
1641
 
 
1642
 
        section.receiveA(ArrayMessage&lt;float,2&gt;::copy_from(A_data));
1643
 
        section.receiveB(ArrayMessage&lt;float,2&gt;::copy_from(B_data));
1644
 
        msg = (CkReductionMsg*) result_callback.thread_delay();
1645
 
        result_message = ArrayMessage&lt;float,2&gt;::from_reduction(msg);
1646
 
        assertTrue(all(C_data==*result_message));
1647
 
        delete msg;
1648
 
        result_callback.impl_thread_init();
1649
 
 
1650
 
        A_data = 1;
1651
 
        B_data = -1;
1652
 
        C_data = -1;
1653
 
 
1654
 
        section.receiveA(ArrayMessage&lt;float,2&gt;::copy_from(A_data,1));
1655
 
        section.receiveB(ArrayMessage&lt;float,2&gt;::copy_from(B_data,1));
1656
 
        msg = (CkReductionMsg*) result_callback.thread_delay();
1657
 
        result_message = ArrayMessage&lt;float,2&gt;::from_reduction(msg);
1658
 
        assertTrue(all(C_data==*result_message));
1659
 
        delete msg;
1660
 
        result_callback.impl_thread_init();
1661
 
    }
1662
 
 
1663
 
    {
1664
 
        Array&lt;float,2&gt; A_data(2,2);
1665
 
        Array&lt;float,2&gt; B_data(2,2);
1666
 
        Array&lt;float,2&gt; C_data(2,2);
1667
 
 
1668
 
        A_data =
1669
 
            0, 1,
1670
 
            1, 0;
1671
 
        B_data =
1672
 
            1, 2,
1673
 
            3, 4;
1674
 
        C_data = 
1675
 
            3, 4,
1676
 
            1, 2;
1677
 
 
1678
 
        section.receiveA(ArrayMessage&lt;float,2&gt;::copy_from(A_data,2));
1679
 
        section.receiveB(ArrayMessage&lt;float,2&gt;::copy_from(B_data,2));
1680
 
        msg = (CkReductionMsg*) result_callback.thread_delay();
1681
 
        result_message = ArrayMessage&lt;float,2&gt;::from_reduction(msg);
1682
 
        assertTrue(all(C_data==*result_message));
1683
 
        delete msg;
1684
 
        result_callback.impl_thread_init();
1685
 
    }
1686
 
 
1687
 
    multiplier.ckDestroy();
1688
 
 
1689
 
 
1690
 
}
1691
 
</t>
1692
1365
<t tx="gcross.20081117194405.4"></t>
1693
1366
<t tx="gcross.20081117194405.5"></t>
1694
1367
<t tx="gcross.20081117194405.6"></t>
1720
1393
    CkFreeMsg(result);
1721
1394
}
1722
1395
</t>
1723
 
<t tx="gcross.20081117194405.10">testCase(SerializeDeserialize_1D_List,ArrayMessageTests) {   
1724
 
    typedef Array&lt;int,1&gt; ArrayType;
1725
 
    typedef ArrayMessage&lt;int,1&gt; ArrayMessageType;
1726
 
 
1727
 
    ArrayType arr(5);
1728
 
    arr = 1,2,3,4,5;
1729
 
 
1730
 
    ArrayMessageType* msg = ArrayMessageType::copy_from(arr);
1731
 
 
1732
 
    for(int i = 1; i &lt;= 5; i++)
1733
 
        assertEqual((*msg)(i-1),i);
1734
 
 
1735
 
    msg = ArrayMessageType::unpack(ArrayMessageType::pack(msg));
1736
 
 
1737
 
    for(int i = 1; i &lt;= 5; i++)
1738
 
        assertEqual((*msg)(i-1),i);
1739
 
 
1740
 
}
1741
 
 
1742
 
</t>
1743
1396
<t tx="gcross.20081117194405.11">envelope* to_envelope() { return UsrToEnv(ArrayMessage::pack(this)); }
1744
1397
</t>
1745
 
<t tx="gcross.20081118105204.2">testCase(MM1x2x1_lowlevel,MatrixMultiplierTests) {
1746
 
 
1747
 
    typedef Array&lt;float,2&gt; Matrix;
1748
 
 
1749
 
    CProxy_MatrixMultiplier&lt;float&gt; multiplier = CProxy_MatrixMultiplier&lt;float&gt;::ckNew(1,2,1);
1750
 
 
1751
 
    CkGroupID mCastGrpId = CProxy_CkMulticastMgr::ckNew();
1752
 
    CkMulticastMgr *mCastGrp = CProxy_CkMulticastMgr(mCastGrpId).ckLocalBranch();
1753
 
 
1754
 
    CkArrayIndex3D indices[2] = {CkArrayIndex3D(0,0,0),CkArrayIndex3D(0,1,0)};
1755
 
    CProxySection_MatrixMultiplier&lt;float&gt; section = CProxySection_MatrixMultiplier&lt;float&gt;::ckNew(multiplier, indices, 2);
1756
 
    section.ckSectionDelegate(mCastGrp);
1757
 
 
1758
 
    CkCallback result_callback(CkCallback::resumeThread);
1759
 
 
1760
 
    section.receiveDestinationInformation(new ResultSectionAnnouncementMessage(mCastGrpId,result_callback));
1761
 
 
1762
 
    ArrayMessage&lt;float,2&gt;* result_message;
1763
 
    CkReductionMsg* msg;
1764
 
 
1765
 
    {
1766
 
        Matrix A_data(1,1);
1767
 
        Matrix B_data(1,1);
1768
 
        Matrix C_data(1,1);
1769
 
 
1770
 
        A_data = 1;
1771
 
        B_data = 1;
1772
 
        C_data = 2;
1773
 
        section.receiveA(ArrayMessage&lt;float,2&gt;::copy_from(A_data));
1774
 
        section.receiveB(ArrayMessage&lt;float,2&gt;::copy_from(B_data));
1775
 
        msg = (CkReductionMsg*)result_callback.thread_delay();
1776
 
        result_message = ArrayMessage&lt;float,2&gt;::from_reduction(msg);
1777
 
        assertTrue(all(C_data==*result_message));
1778
 
        delete msg;
1779
 
        result_callback.impl_thread_init();
1780
 
 
1781
 
    }
1782
 
 
1783
 
    {
1784
 
        Matrix A_data[2] = { Matrix(1,1), Matrix(1,1) };
1785
 
        Matrix B_data[2] = { Matrix(1,1), Matrix(1,1) };
1786
 
        Matrix C_data(1,1);
1787
 
 
1788
 
        A_data[0] = 1;
1789
 
        A_data[1] = 2;
1790
 
        B_data[0] = 3;
1791
 
        B_data[1] = -4;
1792
 
        C_data = -5;
1793
 
 
1794
 
        for(int i = 0; i &lt; 2; i++) {
1795
 
            multiplier(0,i,0).receiveA(ArrayMessage&lt;float,2&gt;::copy_from(A_data[i],1));
1796
 
            multiplier(0,i,0).receiveB(ArrayMessage&lt;float,2&gt;::copy_from(B_data[i],1));
1797
 
        }
1798
 
        msg = (CkReductionMsg*)result_callback.thread_delay();
1799
 
        result_message = ArrayMessage&lt;float,2&gt;::from_reduction(msg);
1800
 
        assertTrue(all(C_data==*result_message));
1801
 
        delete msg;
1802
 
        result_callback.impl_thread_init();
1803
 
    }
1804
 
 
1805
 
    {
1806
 
        Matrix A_data[2] = { Matrix(2,2), Matrix(2,2) };
1807
 
        Matrix B_data[2] = { Matrix(2,2), Matrix(2,2) };
1808
 
        Matrix C_data(2,2);
1809
 
 
1810
 
 
1811
 
        A_data[0] =
1812
 
            0, 1,
1813
 
            1, 0;
1814
 
        B_data[0] =
1815
 
            1, 2,
1816
 
            3, 4;
1817
 
 
1818
 
        A_data[1] =
1819
 
            4, 3,
1820
 
            2, 1;
1821
 
        B_data[1] =
1822
 
            1, 1,
1823
 
            1, -1;
1824
 
 
1825
 
        C_data = 
1826
 
            10, 5,
1827
 
            4, 3;
1828
 
 
1829
 
        for(int i = 0; i &lt; 2; i++) {
1830
 
            multiplier(0,i,0).receiveA(ArrayMessage&lt;float,2&gt;::copy_from(A_data[i],2));
1831
 
            multiplier(0,i,0).receiveB(ArrayMessage&lt;float,2&gt;::copy_from(B_data[i],2));
1832
 
        }
1833
 
        msg = (CkReductionMsg*)result_callback.thread_delay();
1834
 
        result_message = ArrayMessage&lt;float,2&gt;::from_reduction(msg);
1835
 
        assertTrue(all(C_data==*result_message));
1836
 
        delete msg;
1837
 
        result_callback.impl_thread_init();
1838
 
    }
1839
 
 
1840
 
    multiplier.ckDestroy();
1841
 
 
1842
 
}
1843
 
</t>
1844
1398
<t tx="gcross.20081118105204.5">public:
1845
1399
 
1846
1400
    @others
1947
1501
    doStuffToData(callback_matrix,data_matrix,callback_retrieveData&lt;T_numtype&gt;());
1948
1502
}
1949
1503
</t>
1950
 
<t tx="gcross.20081118105204.12">testCase(MM1x1x1_mediumlevel,MatrixMultiplierTests) {
1951
 
 
1952
 
    int I = 1, J = 1, K = 1;
1953
 
 
1954
 
    CProxy_MatrixMultiplier&lt;float&gt; multiplier = CProxy_MatrixMultiplier&lt;float&gt;::ckNew(I,J,K);
1955
 
    CkGroupID mCastGrpId = CProxy_CkMulticastMgr::ckNew();
1956
 
    Array&lt;CProxySection_MatrixMultiplier&lt;float&gt;,2&gt; A_section_matrix(I,J), B_section_matrix(J,K), C_section_matrix(I,K);
1957
 
    MatrixMultiplier&lt;float&gt;::build_section_matrices(
1958
 
        multiplier,
1959
 
        I,J,K,
1960
 
        mCastGrpId,
1961
 
        A_section_matrix,
1962
 
        B_section_matrix,
1963
 
        C_section_matrix
1964
 
    );
1965
 
    Array&lt;CkCallback,2&gt; C_callback_matrix(I,K);
1966
 
    MatrixMultiplier&lt;float&gt;::build_thread_delay_callback_matrix(mCastGrpId,C_section_matrix,C_callback_matrix);
1967
 
 
1968
 
    {
1969
 
        Array&lt;float,2&gt; A_data(1,1);
1970
 
        Array&lt;float,2&gt; B_data(1,1);
1971
 
        Array&lt;float,2&gt; C_data(1,1);
1972
 
        Array&lt;float,2&gt; correct_C_data(1,1);
1973
 
 
1974
 
        A_data = 1;
1975
 
        B_data = 1;
1976
 
        correct_C_data = 1;
1977
 
        C_data = 0;
1978
 
 
1979
 
        MatrixMultiplier&lt;float&gt;::broadcast_A_data(0,A_section_matrix,A_data);
1980
 
        MatrixMultiplier&lt;float&gt;::broadcast_B_data(0,B_section_matrix,B_data);
1981
 
        MatrixMultiplier&lt;float&gt;::gather_results(C_callback_matrix,C_data);
1982
 
        assertTrue(all(C_data==correct_C_data));
1983
 
 
1984
 
        A_data = 1;
1985
 
        B_data = -1;
1986
 
        correct_C_data = -1;
1987
 
 
1988
 
        MatrixMultiplier&lt;float&gt;::broadcast_A_data(1,A_section_matrix,A_data);
1989
 
        MatrixMultiplier&lt;float&gt;::broadcast_B_data(1,B_section_matrix,B_data);
1990
 
        MatrixMultiplier&lt;float&gt;::gather_results(C_callback_matrix,C_data);
1991
 
        assertTrue(all(C_data==correct_C_data));
1992
 
    }
1993
 
 
1994
 
    {
1995
 
        Array&lt;float,2&gt; A_data(2,2);
1996
 
        Array&lt;float,2&gt; B_data(2,2);
1997
 
        Array&lt;float,2&gt; C_data(2,2);
1998
 
        Array&lt;float,2&gt; correct_C_data(2,2);
1999
 
 
2000
 
        A_data =
2001
 
            0, 1,
2002
 
            1, 0;
2003
 
        B_data =
2004
 
            1, 2,
2005
 
            3, 4;
2006
 
        correct_C_data = 
2007
 
            3, 4,
2008
 
            1, 2;
2009
 
 
2010
 
        MatrixMultiplier&lt;float&gt;::broadcast_A_data(2,A_section_matrix,A_data);
2011
 
        MatrixMultiplier&lt;float&gt;::broadcast_B_data(2,B_section_matrix,B_data);
2012
 
        MatrixMultiplier&lt;float&gt;::gather_results(C_callback_matrix,C_data);
2013
 
        assertTrue(all(C_data==correct_C_data));
2014
 
    }
2015
 
 
2016
 
    multiplier.ckDestroy();
2017
 
 
2018
 
 
2019
 
}
2020
 
</t>
2021
1504
<t tx="gcross.20081118105204.13">protected:
2022
1505
 
2023
1506
    @others
2064
1547
};
2065
1548
 
2066
1549
</t>
2067
 
<t tx="gcross.20081119204334.2">testCase(MM1x2x1_mediumlevel,MatrixMultiplierTests) {
2068
 
 
2069
 
    typedef Array&lt;float,2&gt; Matrix;
2070
 
 
2071
 
    int I = 1, J = 2, K = 1;
2072
 
 
2073
 
    CProxy_MatrixMultiplier&lt;float&gt; multiplier = CProxy_MatrixMultiplier&lt;float&gt;::ckNew(I,J,K);
2074
 
    CkGroupID mCastGrpId = CProxy_CkMulticastMgr::ckNew();
2075
 
    Array&lt;CProxySection_MatrixMultiplier&lt;float&gt;,2&gt; A_section_matrix(I,J), B_section_matrix(J,K), C_section_matrix(I,K);
2076
 
    MatrixMultiplier&lt;float&gt;::build_section_matrices(
2077
 
        multiplier,
2078
 
        I,J,K,
2079
 
        mCastGrpId,
2080
 
        A_section_matrix,
2081
 
        B_section_matrix,
2082
 
        C_section_matrix
2083
 
    );
2084
 
    Array&lt;CkCallback,2&gt; C_callback_matrix(I,K);
2085
 
    MatrixMultiplier&lt;float&gt;::build_thread_delay_callback_matrix(mCastGrpId,C_section_matrix,C_callback_matrix);
2086
 
 
2087
 
    {
2088
 
        Matrix A_data(2,4);
2089
 
        Matrix B_data(4,2);
2090
 
        Matrix C_data(2,2), correct_C_data(2,2);
2091
 
 
2092
 
 
2093
 
        A_data =
2094
 
            0, 1, 4, 3,
2095
 
            1, 0, 2, 1;
2096
 
        B_data =
2097
 
            1, 2,
2098
 
            3, 4,
2099
 
            1, 1,
2100
 
            1, -1;
2101
 
 
2102
 
        correct_C_data = 
2103
 
            10, 5,
2104
 
            4, 3;
2105
 
 
2106
 
 
2107
 
        MatrixMultiplier&lt;float&gt;::broadcast_A_data(0,A_section_matrix,A_data);
2108
 
        MatrixMultiplier&lt;float&gt;::broadcast_B_data(0,B_section_matrix,B_data);
2109
 
        MatrixMultiplier&lt;float&gt;::gather_results(C_callback_matrix,C_data);
2110
 
        assertTrue(all(C_data==correct_C_data));
2111
 
    }
2112
 
 
2113
 
    {
2114
 
        Matrix A_data(3,5);
2115
 
        Matrix B_data(5,3);
2116
 
        Matrix C_data(3,3), correct_C_data(3,3);
2117
 
 
2118
 
 
2119
 
        A_data =
2120
 
            0.127764833566,0.895385553445,0.84219862626,0.802958441991,0.248950345431,
2121
 
            0.70459464403,0.889923629647,0.786650904792,0.536201242653,0.354616263865,
2122
 
            0.0203439811731,0.257875825771,0.945103940903,0.171736390081,0.220236463943;
2123
 
 
2124
 
        B_data =
2125
 
            0.792611499585,0.613120251251,0.931379767255,
2126
 
            0.541683178571,0.583090577153,0.965973018146,
2127
 
            0.125656090874,0.406462288666,0.0669359314281,
2128
 
            0.496243647861,0.599131362563,0.258425222495,
2129
 
            0.446161420577,0.478176105036,0.927927387316;
2130
 
 
2131
 
        correct_C_data = 
2132
 
            1.20164562218,1.54286775909,1.47880177354,
2133
 
            1.56367651206,1.76147526011,2.0361686897,
2134
 
            0.458054043388,0.755191853684,0.580054936153;
2135
 
 
2136
 
        MatrixMultiplier&lt;float&gt;::broadcast_A_data(1,A_section_matrix,A_data);
2137
 
        MatrixMultiplier&lt;float&gt;::broadcast_B_data(1,B_section_matrix,B_data);
2138
 
        MatrixMultiplier&lt;float&gt;::gather_results(C_callback_matrix,C_data);
2139
 
        assertTrue(sum(abs(C_data-correct_C_data))&lt;1e-5);
2140
 
    }
2141
 
 
2142
 
    multiplier.ckDestroy();
2143
 
 
2144
 
}
2145
 
</t>
2146
1550
<t tx="gcross.20081119204334.3">@language python
2147
1551
 
2148
1552
A = rand(71,21)
2169
1573
print_matrix(X,f)
2170
1574
f.close()
2171
1575
</t>
2172
 
<t tx="gcross.20081119205342.2">testCase(MM2x2x2_mediumlevel,MatrixMultiplierTests) {
2173
 
 
2174
 
    typedef Array&lt;double,2&gt; Matrix;
2175
 
 
2176
 
    int I = 2, J = 2, K = 2;
2177
 
 
2178
 
    CProxy_MatrixMultiplier&lt;double&gt; multiplier = CProxy_MatrixMultiplier&lt;double&gt;::ckNew(I,J,K);
2179
 
    CkGroupID mCastGrpId = CProxy_CkMulticastMgr::ckNew();
2180
 
    Array&lt;CProxySection_MatrixMultiplier&lt;double&gt;,2&gt; A_section_matrix(I,J), B_section_matrix(J,K), C_section_matrix(I,K);
2181
 
    MatrixMultiplier&lt;double&gt;::build_section_matrices(
2182
 
        multiplier,
2183
 
        I,J,K,
2184
 
        mCastGrpId,
2185
 
        A_section_matrix,
2186
 
        B_section_matrix,
2187
 
        C_section_matrix
2188
 
    );
2189
 
    Array&lt;CkCallback,2&gt; C_callback_matrix(I,K);
2190
 
    MatrixMultiplier&lt;double&gt;::build_thread_delay_callback_matrix(mCastGrpId,C_section_matrix,C_callback_matrix);
2191
 
 
2192
 
    {
2193
 
        Matrix A_data(2,4);
2194
 
        Matrix B_data(4,2);
2195
 
        Matrix C_data(2,2), correct_C_data(2,2);
2196
 
 
2197
 
 
2198
 
        A_data =
2199
 
            0, 1, 4, 3,
2200
 
            1, 0, 2, 1;
2201
 
        B_data =
2202
 
            1, 2,
2203
 
            3, 4,
2204
 
            1, 1,
2205
 
            1, -1;
2206
 
 
2207
 
        correct_C_data = 
2208
 
            10, 5,
2209
 
            4, 3;
2210
 
 
2211
 
 
2212
 
        MatrixMultiplier&lt;double&gt;::broadcast_A_data(0,A_section_matrix,A_data);
2213
 
        MatrixMultiplier&lt;double&gt;::broadcast_B_data(0,B_section_matrix,B_data);
2214
 
        MatrixMultiplier&lt;double&gt;::gather_results(C_callback_matrix,C_data);
2215
 
        assertTrue(all(C_data==correct_C_data));
2216
 
    }
2217
 
 
2218
 
    {
2219
 
        Matrix A_data(3,5);
2220
 
        Matrix B_data(5,3);
2221
 
        Matrix C_data(3,3), correct_C_data(3,3);
2222
 
 
2223
 
 
2224
 
        A_data =
2225
 
            0.127764833566,0.895385553445,0.84219862626,0.802958441991,0.248950345431,
2226
 
            0.70459464403,0.889923629647,0.786650904792,0.536201242653,0.354616263865,
2227
 
            0.0203439811731,0.257875825771,0.945103940903,0.171736390081,0.220236463943;
2228
 
 
2229
 
        B_data =
2230
 
            0.792611499585,0.613120251251,0.931379767255,
2231
 
            0.541683178571,0.583090577153,0.965973018146,
2232
 
            0.125656090874,0.406462288666,0.0669359314281,
2233
 
            0.496243647861,0.599131362563,0.258425222495,
2234
 
            0.446161420577,0.478176105036,0.927927387316;
2235
 
 
2236
 
        correct_C_data = 
2237
 
            1.20164562218,1.54286775909,1.47880177354,
2238
 
            1.56367651206,1.76147526011,2.0361686897,
2239
 
            0.458054043388,0.755191853684,0.580054936153;
2240
 
 
2241
 
        MatrixMultiplier&lt;double&gt;::broadcast_A_data(1,A_section_matrix,A_data);
2242
 
        MatrixMultiplier&lt;double&gt;::broadcast_B_data(1,B_section_matrix,B_data);
2243
 
        MatrixMultiplier&lt;double&gt;::gather_results(C_callback_matrix,C_data);
2244
 
        assertTrue(sum(abs(C_data-correct_C_data))&lt;1e-8);
2245
 
    }
2246
 
 
2247
 
    multiplier.ckDestroy();
2248
 
 
2249
 
}
2250
 
</t>
2251
 
<t tx="gcross.20081119205342.3">testCase(MM3x3x3_mediumlevel,MatrixMultiplierTests) {
2252
 
 
2253
 
    typedef Array&lt;double,2&gt; Matrix;
2254
 
 
2255
 
    int I = 3, J = 3, K = 3;
2256
 
 
2257
 
    CProxy_MatrixMultiplier&lt;double&gt; multiplier = CProxy_MatrixMultiplier&lt;double&gt;::ckNew(I,J,K);
2258
 
    CkGroupID mCastGrpId = CProxy_CkMulticastMgr::ckNew();
2259
 
    Array&lt;CProxySection_MatrixMultiplier&lt;double&gt;,2&gt; A_section_matrix(I,J), B_section_matrix(J,K), C_section_matrix(I,K);
2260
 
    MatrixMultiplier&lt;double&gt;::build_section_matrices(
2261
 
        multiplier,
2262
 
        I,J,K,
2263
 
        mCastGrpId,
2264
 
        A_section_matrix,
2265
 
        B_section_matrix,
2266
 
        C_section_matrix
2267
 
    );
2268
 
    Array&lt;CkCallback,2&gt; C_callback_matrix(I,K);
2269
 
    MatrixMultiplier&lt;double&gt;::build_thread_delay_callback_matrix(mCastGrpId,C_section_matrix,C_callback_matrix);
2270
 
 
2271
 
    {
2272
 
        Matrix A_data(3,5);
2273
 
        Matrix B_data(5,3);
2274
 
        Matrix C_data(3,3), correct_C_data(3,3);
2275
 
 
2276
 
 
2277
 
        A_data =
2278
 
            0.127764833566,0.895385553445,0.84219862626,0.802958441991,0.248950345431,
2279
 
            0.70459464403,0.889923629647,0.786650904792,0.536201242653,0.354616263865,
2280
 
            0.0203439811731,0.257875825771,0.945103940903,0.171736390081,0.220236463943;
2281
 
 
2282
 
        B_data =
2283
 
            0.792611499585,0.613120251251,0.931379767255,
2284
 
            0.541683178571,0.583090577153,0.965973018146,
2285
 
            0.125656090874,0.406462288666,0.0669359314281,
2286
 
            0.496243647861,0.599131362563,0.258425222495,
2287
 
            0.446161420577,0.478176105036,0.927927387316;
2288
 
 
2289
 
        correct_C_data = 
2290
 
            1.20164562218,1.54286775909,1.47880177354,
2291
 
            1.56367651206,1.76147526011,2.0361686897,
2292
 
            0.458054043388,0.755191853684,0.580054936153;
2293
 
 
2294
 
        MatrixMultiplier&lt;double&gt;::broadcast_A_data(0,A_section_matrix,A_data);
2295
 
        MatrixMultiplier&lt;double&gt;::broadcast_B_data(0,B_section_matrix,B_data);
2296
 
        MatrixMultiplier&lt;double&gt;::gather_results(C_callback_matrix,C_data);
2297
 
        assertTrue(sum(abs(C_data-correct_C_data))&lt;1e-8);
2298
 
    }
2299
 
 
2300
 
    {
2301
 
        Matrix A_data(23,11);
2302
 
        Matrix B_data(11,13);
2303
 
        Matrix C_data(23,13), correct_C_data(23,13);
2304
 
 
2305
 
 
2306
 
        &lt;&lt; A data &gt;&gt;
2307
 
        &lt;&lt; B data &gt;&gt;
2308
 
        &lt;&lt; C data &gt;&gt;
2309
 
 
2310
 
        MatrixMultiplier&lt;double&gt;::broadcast_A_data(1,A_section_matrix,A_data);
2311
 
        MatrixMultiplier&lt;double&gt;::broadcast_B_data(1,B_section_matrix,B_data);
2312
 
        MatrixMultiplier&lt;double&gt;::gather_results(C_callback_matrix,C_data);
2313
 
        assertTrue(sum(abs(C_data-correct_C_data))&lt;1e-8);
2314
 
    }
2315
 
 
2316
 
    multiplier.ckDestroy();
2317
 
 
2318
 
}
2319
 
</t>
2320
 
<t tx="gcross.20081119205342.4">A_data =
2321
 
0.261866504012,0.236878231696,0.380017632472,0.593987204289,0.576522290572,0.686579179271,0.117057531975,0.0807189706706,0.524975647917,0.85348478089,0.32784113737,
2322
 
0.137307045661,0.721936270775,0.497272066704,0.00662990346833,0.934311820255,0.502196682797,0.609445178422,0.667736158144,0.798899583748,0.264161595828,0.104879945885,
2323
 
0.319679294935,0.636055286206,0.202729143402,0.207783865394,0.207354412515,0.335238700104,0.332923346186,0.189648385055,0.564489673834,0.309237115548,0.0589418897135,
2324
 
0.999552611389,0.207128209479,0.247170553961,0.249903696288,0.154265191093,0.792262871179,0.072877133596,0.817728566028,0.402116231499,0.607123140639,0.650708802013,
2325
 
0.853262567001,0.406558437323,0.462162950196,0.327946206801,0.264524424748,0.313971710267,0.633660743369,0.182623441676,0.136914584174,0.450341797727,0.0196506606282,
2326
 
0.850488263174,0.392463174662,0.735361834236,0.127493420602,0.332147016106,0.0300456280638,0.590630855646,0.414666471259,0.703663964187,0.923810792082,0.229049012856,
2327
 
0.995381059916,0.0428851257525,0.331077528949,0.78942945132,0.0834955598012,0.562198320834,0.936545350473,0.203572807047,0.892898850112,0.444973460656,0.0353533980962,
2328
 
0.788296011328,0.386833544193,0.891491850101,0.720879441372,0.742939842246,0.0510329573871,0.543584321238,0.149015778982,0.225329893599,0.40366551859,0.0315998155218,
2329
 
0.117003592342,0.237838001157,0.626057726921,0.508260895763,0.251743407826,0.190431967605,0.181848316198,0.50718214391,0.253622652508,0.450387478269,0.316331657775,
2330
 
0.515321437577,0.18875157865,0.632103577772,0.583705912732,0.841264070191,0.762791813602,0.0774012127148,0.670523177977,0.789176322828,0.1022102638,0.280725419529,
2331
 
0.331632772234,0.234608677795,0.946428173367,0.137036736073,0.777750220575,0.51776744907,0.46393810078,0.887574374768,0.957032697844,0.0171661939031,0.908509457721,
2332
 
0.0772033681099,0.460392995892,0.0999736374282,0.124643265136,0.978162973761,0.627270091518,0.0918355267612,0.542172490245,0.147837745177,0.818201023204,0.441658037386,
2333
 
0.304822197347,0.258127731465,0.952000877532,0.0956031274,0.925584101293,0.223408891998,0.722190228738,0.470058193836,0.309569888912,0.729637739648,0.81879995657,
2334
 
0.869796694677,0.291586527602,0.66192336729,0.75163303431,0.0105178952743,0.00831692641014,0.0768833949029,0.479968396166,0.0335657059737,0.698932952358,0.653429929735,
2335
 
0.32174317456,0.648326493503,0.84967268436,0.656475965688,0.233985674544,0.641282854781,0.161111230474,0.244099484477,0.963960208219,0.738368804128,0.716742533635,
2336
 
0.743825752552,0.956786997119,0.982975918727,0.332842770646,0.396636089193,0.678692624518,0.88678704315,0.271125786829,0.98314504261,0.883802487105,0.928988477637,
2337
 
0.568245202433,0.826197364222,0.688841426927,0.413868882819,0.436794442184,0.874196234122,0.284235074501,0.297373711938,0.254977644551,0.649149256866,0.606234019467,
2338
 
0.398292442086,0.230579511912,0.734614155349,0.852451092972,0.270141827812,0.88315782443,0.460339544548,0.0757437091179,0.527865725712,0.387833359001,0.56126945855,
2339
 
0.560272465525,0.733386233656,0.120197299603,0.531059891155,0.840337422591,0.63321258362,0.95969901644,0.925321288462,0.0441286085524,0.470060673073,0.912808667526,
2340
 
0.275027079982,0.760436571123,0.250187713192,0.0515411291099,0.477228325956,0.74090147845,0.765654219776,0.928727520985,0.423168694547,0.970202875799,0.503643520798,
2341
 
0.702490884601,0.276432745893,0.391797180964,0.0200279887029,0.795195910365,0.0640564369366,0.376991533787,0.907223629813,0.960200927608,0.166900303993,0.52333355076,
2342
 
0.120646470018,0.579610926073,0.319190579385,0.509717478291,0.756912045055,0.693859810094,0.955367185739,0.440628477158,0.362813479607,0.135191898404,0.237680156013,
2343
 
0.271258720902,0.806695911736,0.529901417966,0.513610843064,0.254644600733,0.944565840039,0.714090517383,0.868523248131,0.635095196522,0.43880840514,0.447541464633;
2344
 
</t>
2345
 
<t tx="gcross.20081119205342.5">B_data=
2346
 
0.338519448043,0.577445183289,0.714344727323,0.658301919056,0.793882195017,0.921157722106,0.0577648914639,0.687847024532,0.221618396668,0.170520402727,0.8984799562,0.668947955869,0.577999351541,
2347
 
0.653005818577,0.0777651307304,0.711003764864,0.310151984884,0.914902614143,0.794477586671,0.773372230331,0.947623242984,0.436268073833,0.115415900853,0.405067181246,0.308730012857,0.894462112134,
2348
 
0.685594167421,0.735907517741,0.183719988621,0.666037511439,0.83002130814,0.239093384013,0.604118187996,0.537144978572,0.279110396519,0.503183430236,0.958675711569,0.0113832056294,0.356667594252,
2349
 
0.515346650749,0.909519285222,0.361015245685,0.250015226661,0.643764662855,0.596689458656,0.639496226552,0.818496603303,0.700322559662,0.173394856186,0.101736041896,0.746345700845,0.301758606997,
2350
 
0.114771039479,0.608565873708,0.0155564484873,0.0176004576729,0.146978067832,0.963790424666,0.941671038922,0.710537197538,0.360260687003,0.488077184582,0.567896265204,0.710638567666,0.657722169854,
2351
 
0.955411872403,0.469631027096,0.538684684305,0.155027174568,0.0847980450302,0.942753117215,0.0145723259252,0.07679558772,0.885385875752,0.384913773723,0.34411140759,0.940314506079,0.321729030911,
2352
 
0.796731457201,0.342200403242,0.877966175523,0.380792077741,0.0513280264837,0.388143887869,0.472304007402,0.571411313158,0.0435416803201,0.655414843166,0.559857494826,0.924098840128,0.61060334532,
2353
 
0.891355837223,0.259171606051,0.542057917249,0.296033351049,0.910216386014,0.965320698874,0.382805153784,0.394092102599,0.853425291667,0.842133338027,0.557750047891,0.299478767031,0.713239273885,
2354
 
0.0414586701968,0.0126832723749,0.121381949536,0.556698529383,0.360770654669,0.416265722879,0.976527683174,0.0947413944391,0.96366821334,0.547672954636,0.565537572823,0.345727946086,0.02620734045,
2355
 
0.897827854819,0.546836317787,0.521642028451,0.217358529231,0.866370833193,0.476831978805,0.213789572269,0.0602385864117,0.452237648572,0.885551918228,0.7593062306,0.187170341416,0.809114719133,
2356
 
0.795928215029,0.460802836536,0.651159141431,0.477902630548,0.465155904725,0.0699897504759,0.529268026702,0.800777123722,0.0634700119732,0.91668143046,0.264076065876,0.974929169956,0.72910092266;</t>
2357
 
<t tx="gcross.20081119205342.6">correct_C_data =
2358
 
2.74630887563,2.34824795471,1.88749763459,1.46696440406,2.42618650929,2.8494203107,2.31547088645,2.01963930175,2.48568504913,2.40041046928,2.46172287712,2.54446545946,2.35050419565,
2359
 
2.88381435847,1.89636790137,2.19028375931,1.72348780374,2.57136311684,3.54381004672,3.19362884375,2.54051383117,2.76245193383,2.73679223432,2.99031715743,2.65258028199,2.84008538833,
2360
 
1.89597831248,1.22236107094,1.63997744186,1.24286548798,1.88534576127,2.18700473539,1.84425487982,1.65895739017,1.78587145472,1.51114860069,1.85525338942,1.70514210737,1.77947232828,
2361
 
3.41314357877,2.34224905431,2.7225684684,2.0115129485,3.16071823751,3.50918668137,1.89819559072,2.35122919671,2.71733227959,2.83306152092,2.9617225615,2.97581785227,2.88687322163,
2362
 
2.46381138372,1.99236704105,2.1947942171,1.6097910975,2.35702987655,2.66146432988,1.71587075023,2.19080239746,1.61870872183,1.7927020798,2.54719971163,2.22058142042,2.29509609954,
2363
 
3.06196962174,2.3242184069,2.54884964027,2.26341160987,3.34658062993,3.07455756425,2.63520711969,2.50121438308,2.29052041042,2.90586684945,3.56186832667,2.36738924172,2.96081159144,
2364
 
2.93778623805,2.49878500407,2.68762758571,2.20265030859,2.62985943893,3.25802587465,2.3883746404,2.40688014142,2.69085803275,2.43604092065,3.04033600607,3.21291163735,2.33204800744,
2365
 
2.59901999753,2.73587730256,2.11775694551,1.91328823757,2.90653948824,3.08424264137,2.681463071,2.94980765817,1.96251673132,2.12650849928,3.06215286197,2.50209551157,2.6359619265,
2366
 
2.3605300934,1.84063484445,1.56398014958,1.33844531682,2.31030149055,2.07450439719,1.92519584978,1.85990944876,1.82860398153,2.02074378416,2.01549527863,1.69644711625,1.95835542841,
2367
 
2.86447816225,2.57403302663,2.01649227605,1.9214588997,2.78869189932,3.72820557165,2.96851500958,2.62114770943,3.16035629705,2.62860290483,2.9604340175,2.99892942935,2.50057014648,
2368
 
3.50787298252,2.57630020603,2.52321434403,2.45975810165,3.12435220489,3.54466590989,3.57788720407,3.09745301423,3.03996023436,3.58619824544,3.48307990672,3.3612421795,3.07626960208,
2369
 
2.81981383874,1.98193838831,1.90583370063,1.07250880414,2.30853498234,3.11088115492,2.23483480691,2.07140142638,2.24815064073,2.58424076716,2.31104046775,2.45497281858,2.80554759615,
2370
 
3.60739012899,2.80101122303,2.58565178766,2.12601351281,3.07448027243,3.14137320402,3.14103823659,3.04558254805,2.1569545936,3.55056799062,3.51515136115,3.08363522025,3.4278209239,
2371
 
2.97324083415,2.54041473628,2.34808279686,1.94752907913,3.35523863872,2.54375424472,1.91440936235,2.65508952741,1.84512898397,2.34460425562,2.65246823604,2.24993829597,2.6681375693,
2372
 
3.71197473245,2.76679235419,2.67563833617,2.41973188812,3.61653418302,3.33807975298,3.3308566137,2.94291803336,3.22680775532,3.18208582924,3.30801987425,3.07653135596,3.04497763201,
2373
 
4.93786345433,3.38771616266,3.99497120347,3.23784987999,4.45670414797,4.40268597104,4.13631711029,4.05655342404,3.50958954092,4.22664236344,4.61098742563,4.28431977818,4.36904808611,
2374
 
3.87021305755,2.76399585849,2.92210100741,2.10483500742,3.40517585471,3.69210574976,2.73336360074,3.08836757224,2.74376609144,2.86725301558,3.21876386544,3.23675928141,3.36614499086,
2375
 
3.35424242099,2.79757928588,2.4481975096,2.02189521948,2.68036861204,3.02307209336,2.59938603482,2.66027607841,2.67453913652,2.59632482852,2.74075755356,3.25499819263,2.48948667867,
2376
 
4.46588650727,3.00725593652,3.67875053826,2.12441752137,3.47388514978,4.42337628884,3.24651236043,3.9018061952,2.85747918453,3.67205924769,3.34116258093,4.34866165224,4.23236717835,
2377
 
4.27772913177,2.35801305817,3.26930361625,1.97332274016,3.40001269977,3.9742288443,2.85264034622,2.78769279955,3.03100114892,3.62413619831,3.38184968341,3.30046665156,3.78940564902,
2378
 
2.56493240515,1.95643360563,2.19159367672,2.07111845441,2.85056719548,3.33714156529,3.02928329632,2.63498565823,2.56752902929,2.92957977068,3.11944672685,2.69350259607,2.76173825905,
2379
 
3.13016537508,2.22890041969,2.47344732538,1.55929623113,2.19790861852,3.36401833337,2.82578380071,2.76439415431,2.45617663226,2.50649982441,2.52088167253,3.2313182663,2.76671373086,
2380
 
4.29788080518,2.59873116073,3.2580433505,2.25287687684,3.48606217197,4.08035529893,3.16228977305,3.10482538871,3.458874146,3.32902133917,3.29514346712,3.54703945901,3.44719544193;
2381
 
</t>
2382
 
<t tx="gcross.20081119205342.7">testCase(MM3x5x7_mediumlevel,MatrixMultiplierTests) {
2383
 
 
2384
 
    typedef Array&lt;double,2&gt; Matrix;
2385
 
 
2386
 
    int I = 3, J = 5, K = 7;
2387
 
 
2388
 
    CProxy_MatrixMultiplier&lt;double&gt; multiplier = CProxy_MatrixMultiplier&lt;double&gt;::ckNew(I,J,K);
2389
 
    CkGroupID mCastGrpId = CProxy_CkMulticastMgr::ckNew();
2390
 
    Array&lt;CProxySection_MatrixMultiplier&lt;double&gt;,2&gt; A_section_matrix(I,J), B_section_matrix(J,K), C_section_matrix(I,K);
2391
 
    MatrixMultiplier&lt;double&gt;::build_section_matrices(
2392
 
        multiplier,
2393
 
        I,J,K,
2394
 
        mCastGrpId,
2395
 
        A_section_matrix,
2396
 
        B_section_matrix,
2397
 
        C_section_matrix
2398
 
    );
2399
 
    Array&lt;CkCallback,2&gt; C_callback_matrix(I,K);
2400
 
    MatrixMultiplier&lt;double&gt;::build_thread_delay_callback_matrix(mCastGrpId,C_section_matrix,C_callback_matrix);
2401
 
 
2402
 
    {
2403
 
        Matrix A_data(23,11);
2404
 
        Matrix B_data(11,13);
2405
 
        Matrix C_data(23,13), correct_C_data(23,13);
2406
 
 
2407
 
        &lt;&lt; A data &gt;&gt;
2408
 
        &lt;&lt; B data &gt;&gt;
2409
 
        &lt;&lt; C data &gt;&gt;
2410
 
 
2411
 
        MatrixMultiplier&lt;double&gt;::broadcast_A_data(0,A_section_matrix,A_data);
2412
 
        MatrixMultiplier&lt;double&gt;::broadcast_B_data(0,B_section_matrix,B_data);
2413
 
        MatrixMultiplier&lt;double&gt;::gather_results(C_callback_matrix,C_data);
2414
 
        assertTrue(sum(abs(C_data-correct_C_data))&lt;1e-8);
2415
 
    }
2416
 
 
2417
 
    multiplier.ckDestroy();
2418
 
 
2419
 
}
2420
 
</t>
2421
 
<t tx="gcross.20081119205342.8">A_data =
2422
 
0.261866504012,0.236878231696,0.380017632472,0.593987204289,0.576522290572,0.686579179271,0.117057531975,0.0807189706706,0.524975647917,0.85348478089,0.32784113737,
2423
 
0.137307045661,0.721936270775,0.497272066704,0.00662990346833,0.934311820255,0.502196682797,0.609445178422,0.667736158144,0.798899583748,0.264161595828,0.104879945885,
2424
 
0.319679294935,0.636055286206,0.202729143402,0.207783865394,0.207354412515,0.335238700104,0.332923346186,0.189648385055,0.564489673834,0.309237115548,0.0589418897135,
2425
 
0.999552611389,0.207128209479,0.247170553961,0.249903696288,0.154265191093,0.792262871179,0.072877133596,0.817728566028,0.402116231499,0.607123140639,0.650708802013,
2426
 
0.853262567001,0.406558437323,0.462162950196,0.327946206801,0.264524424748,0.313971710267,0.633660743369,0.182623441676,0.136914584174,0.450341797727,0.0196506606282,
2427
 
0.850488263174,0.392463174662,0.735361834236,0.127493420602,0.332147016106,0.0300456280638,0.590630855646,0.414666471259,0.703663964187,0.923810792082,0.229049012856,
2428
 
0.995381059916,0.0428851257525,0.331077528949,0.78942945132,0.0834955598012,0.562198320834,0.936545350473,0.203572807047,0.892898850112,0.444973460656,0.0353533980962,
2429
 
0.788296011328,0.386833544193,0.891491850101,0.720879441372,0.742939842246,0.0510329573871,0.543584321238,0.149015778982,0.225329893599,0.40366551859,0.0315998155218,
2430
 
0.117003592342,0.237838001157,0.626057726921,0.508260895763,0.251743407826,0.190431967605,0.181848316198,0.50718214391,0.253622652508,0.450387478269,0.316331657775,
2431
 
0.515321437577,0.18875157865,0.632103577772,0.583705912732,0.841264070191,0.762791813602,0.0774012127148,0.670523177977,0.789176322828,0.1022102638,0.280725419529,
2432
 
0.331632772234,0.234608677795,0.946428173367,0.137036736073,0.777750220575,0.51776744907,0.46393810078,0.887574374768,0.957032697844,0.0171661939031,0.908509457721,
2433
 
0.0772033681099,0.460392995892,0.0999736374282,0.124643265136,0.978162973761,0.627270091518,0.0918355267612,0.542172490245,0.147837745177,0.818201023204,0.441658037386,
2434
 
0.304822197347,0.258127731465,0.952000877532,0.0956031274,0.925584101293,0.223408891998,0.722190228738,0.470058193836,0.309569888912,0.729637739648,0.81879995657,
2435
 
0.869796694677,0.291586527602,0.66192336729,0.75163303431,0.0105178952743,0.00831692641014,0.0768833949029,0.479968396166,0.0335657059737,0.698932952358,0.653429929735,
2436
 
0.32174317456,0.648326493503,0.84967268436,0.656475965688,0.233985674544,0.641282854781,0.161111230474,0.244099484477,0.963960208219,0.738368804128,0.716742533635,
2437
 
0.743825752552,0.956786997119,0.982975918727,0.332842770646,0.396636089193,0.678692624518,0.88678704315,0.271125786829,0.98314504261,0.883802487105,0.928988477637,
2438
 
0.568245202433,0.826197364222,0.688841426927,0.413868882819,0.436794442184,0.874196234122,0.284235074501,0.297373711938,0.254977644551,0.649149256866,0.606234019467,
2439
 
0.398292442086,0.230579511912,0.734614155349,0.852451092972,0.270141827812,0.88315782443,0.460339544548,0.0757437091179,0.527865725712,0.387833359001,0.56126945855,
2440
 
0.560272465525,0.733386233656,0.120197299603,0.531059891155,0.840337422591,0.63321258362,0.95969901644,0.925321288462,0.0441286085524,0.470060673073,0.912808667526,
2441
 
0.275027079982,0.760436571123,0.250187713192,0.0515411291099,0.477228325956,0.74090147845,0.765654219776,0.928727520985,0.423168694547,0.970202875799,0.503643520798,
2442
 
0.702490884601,0.276432745893,0.391797180964,0.0200279887029,0.795195910365,0.0640564369366,0.376991533787,0.907223629813,0.960200927608,0.166900303993,0.52333355076,
2443
 
0.120646470018,0.579610926073,0.319190579385,0.509717478291,0.756912045055,0.693859810094,0.955367185739,0.440628477158,0.362813479607,0.135191898404,0.237680156013,
2444
 
0.271258720902,0.806695911736,0.529901417966,0.513610843064,0.254644600733,0.944565840039,0.714090517383,0.868523248131,0.635095196522,0.43880840514,0.447541464633;
2445
 
</t>
2446
 
<t tx="gcross.20081119205342.9">B_data=
2447
 
0.338519448043,0.577445183289,0.714344727323,0.658301919056,0.793882195017,0.921157722106,0.0577648914639,0.687847024532,0.221618396668,0.170520402727,0.8984799562,0.668947955869,0.577999351541,
2448
 
0.653005818577,0.0777651307304,0.711003764864,0.310151984884,0.914902614143,0.794477586671,0.773372230331,0.947623242984,0.436268073833,0.115415900853,0.405067181246,0.308730012857,0.894462112134,
2449
 
0.685594167421,0.735907517741,0.183719988621,0.666037511439,0.83002130814,0.239093384013,0.604118187996,0.537144978572,0.279110396519,0.503183430236,0.958675711569,0.0113832056294,0.356667594252,
2450
 
0.515346650749,0.909519285222,0.361015245685,0.250015226661,0.643764662855,0.596689458656,0.639496226552,0.818496603303,0.700322559662,0.173394856186,0.101736041896,0.746345700845,0.301758606997,
2451
 
0.114771039479,0.608565873708,0.0155564484873,0.0176004576729,0.146978067832,0.963790424666,0.941671038922,0.710537197538,0.360260687003,0.488077184582,0.567896265204,0.710638567666,0.657722169854,
2452
 
0.955411872403,0.469631027096,0.538684684305,0.155027174568,0.0847980450302,0.942753117215,0.0145723259252,0.07679558772,0.885385875752,0.384913773723,0.34411140759,0.940314506079,0.321729030911,
2453
 
0.796731457201,0.342200403242,0.877966175523,0.380792077741,0.0513280264837,0.388143887869,0.472304007402,0.571411313158,0.0435416803201,0.655414843166,0.559857494826,0.924098840128,0.61060334532,
2454
 
0.891355837223,0.259171606051,0.542057917249,0.296033351049,0.910216386014,0.965320698874,0.382805153784,0.394092102599,0.853425291667,0.842133338027,0.557750047891,0.299478767031,0.713239273885,
2455
 
0.0414586701968,0.0126832723749,0.121381949536,0.556698529383,0.360770654669,0.416265722879,0.976527683174,0.0947413944391,0.96366821334,0.547672954636,0.565537572823,0.345727946086,0.02620734045,
2456
 
0.897827854819,0.546836317787,0.521642028451,0.217358529231,0.866370833193,0.476831978805,0.213789572269,0.0602385864117,0.452237648572,0.885551918228,0.7593062306,0.187170341416,0.809114719133,
2457
 
0.795928215029,0.460802836536,0.651159141431,0.477902630548,0.465155904725,0.0699897504759,0.529268026702,0.800777123722,0.0634700119732,0.91668143046,0.264076065876,0.974929169956,0.72910092266;</t>
2458
 
<t tx="gcross.20081119205342.10">correct_C_data =
2459
 
2.74630887563,2.34824795471,1.88749763459,1.46696440406,2.42618650929,2.8494203107,2.31547088645,2.01963930175,2.48568504913,2.40041046928,2.46172287712,2.54446545946,2.35050419565,
2460
 
2.88381435847,1.89636790137,2.19028375931,1.72348780374,2.57136311684,3.54381004672,3.19362884375,2.54051383117,2.76245193383,2.73679223432,2.99031715743,2.65258028199,2.84008538833,
2461
 
1.89597831248,1.22236107094,1.63997744186,1.24286548798,1.88534576127,2.18700473539,1.84425487982,1.65895739017,1.78587145472,1.51114860069,1.85525338942,1.70514210737,1.77947232828,
2462
 
3.41314357877,2.34224905431,2.7225684684,2.0115129485,3.16071823751,3.50918668137,1.89819559072,2.35122919671,2.71733227959,2.83306152092,2.9617225615,2.97581785227,2.88687322163,
2463
 
2.46381138372,1.99236704105,2.1947942171,1.6097910975,2.35702987655,2.66146432988,1.71587075023,2.19080239746,1.61870872183,1.7927020798,2.54719971163,2.22058142042,2.29509609954,
2464
 
3.06196962174,2.3242184069,2.54884964027,2.26341160987,3.34658062993,3.07455756425,2.63520711969,2.50121438308,2.29052041042,2.90586684945,3.56186832667,2.36738924172,2.96081159144,
2465
 
2.93778623805,2.49878500407,2.68762758571,2.20265030859,2.62985943893,3.25802587465,2.3883746404,2.40688014142,2.69085803275,2.43604092065,3.04033600607,3.21291163735,2.33204800744,
2466
 
2.59901999753,2.73587730256,2.11775694551,1.91328823757,2.90653948824,3.08424264137,2.681463071,2.94980765817,1.96251673132,2.12650849928,3.06215286197,2.50209551157,2.6359619265,
2467
 
2.3605300934,1.84063484445,1.56398014958,1.33844531682,2.31030149055,2.07450439719,1.92519584978,1.85990944876,1.82860398153,2.02074378416,2.01549527863,1.69644711625,1.95835542841,
2468
 
2.86447816225,2.57403302663,2.01649227605,1.9214588997,2.78869189932,3.72820557165,2.96851500958,2.62114770943,3.16035629705,2.62860290483,2.9604340175,2.99892942935,2.50057014648,
2469
 
3.50787298252,2.57630020603,2.52321434403,2.45975810165,3.12435220489,3.54466590989,3.57788720407,3.09745301423,3.03996023436,3.58619824544,3.48307990672,3.3612421795,3.07626960208,
2470
 
2.81981383874,1.98193838831,1.90583370063,1.07250880414,2.30853498234,3.11088115492,2.23483480691,2.07140142638,2.24815064073,2.58424076716,2.31104046775,2.45497281858,2.80554759615,
2471
 
3.60739012899,2.80101122303,2.58565178766,2.12601351281,3.07448027243,3.14137320402,3.14103823659,3.04558254805,2.1569545936,3.55056799062,3.51515136115,3.08363522025,3.4278209239,
2472
 
2.97324083415,2.54041473628,2.34808279686,1.94752907913,3.35523863872,2.54375424472,1.91440936235,2.65508952741,1.84512898397,2.34460425562,2.65246823604,2.24993829597,2.6681375693,
2473
 
3.71197473245,2.76679235419,2.67563833617,2.41973188812,3.61653418302,3.33807975298,3.3308566137,2.94291803336,3.22680775532,3.18208582924,3.30801987425,3.07653135596,3.04497763201,
2474
 
4.93786345433,3.38771616266,3.99497120347,3.23784987999,4.45670414797,4.40268597104,4.13631711029,4.05655342404,3.50958954092,4.22664236344,4.61098742563,4.28431977818,4.36904808611,
2475
 
3.87021305755,2.76399585849,2.92210100741,2.10483500742,3.40517585471,3.69210574976,2.73336360074,3.08836757224,2.74376609144,2.86725301558,3.21876386544,3.23675928141,3.36614499086,
2476
 
3.35424242099,2.79757928588,2.4481975096,2.02189521948,2.68036861204,3.02307209336,2.59938603482,2.66027607841,2.67453913652,2.59632482852,2.74075755356,3.25499819263,2.48948667867,
2477
 
4.46588650727,3.00725593652,3.67875053826,2.12441752137,3.47388514978,4.42337628884,3.24651236043,3.9018061952,2.85747918453,3.67205924769,3.34116258093,4.34866165224,4.23236717835,
2478
 
4.27772913177,2.35801305817,3.26930361625,1.97332274016,3.40001269977,3.9742288443,2.85264034622,2.78769279955,3.03100114892,3.62413619831,3.38184968341,3.30046665156,3.78940564902,
2479
 
2.56493240515,1.95643360563,2.19159367672,2.07111845441,2.85056719548,3.33714156529,3.02928329632,2.63498565823,2.56752902929,2.92957977068,3.11944672685,2.69350259607,2.76173825905,
2480
 
3.13016537508,2.22890041969,2.47344732538,1.55929623113,2.19790861852,3.36401833337,2.82578380071,2.76439415431,2.45617663226,2.50649982441,2.52088167253,3.2313182663,2.76671373086,
2481
 
4.29788080518,2.59873116073,3.2580433505,2.25287687684,3.48606217197,4.08035529893,3.16228977305,3.10482538871,3.458874146,3.32902133917,3.29514346712,3.54703945901,3.44719544193;
2482
 
</t>
2483
 
<t tx="gcross.20081119205342.15">testCase(MM9x10x11_mediumlevel,MatrixMultiplierTests) {
2484
 
 
2485
 
    typedef Array&lt;double,2&gt; Matrix;
2486
 
 
2487
 
    int I = 9, J = 10, K = 11;
2488
 
 
2489
 
    CProxy_MatrixMultiplier&lt;double&gt; multiplier = CProxy_MatrixMultiplier&lt;double&gt;::ckNew(I,J,K);
2490
 
    CkGroupID mCastGrpId = CProxy_CkMulticastMgr::ckNew();
2491
 
    Array&lt;CProxySection_MatrixMultiplier&lt;double&gt;,2&gt; A_section_matrix(I,J), B_section_matrix(J,K), C_section_matrix(I,K);
2492
 
    MatrixMultiplier&lt;double&gt;::build_section_matrices(
2493
 
        multiplier,
2494
 
        I,J,K,
2495
 
        mCastGrpId,
2496
 
        A_section_matrix,
2497
 
        B_section_matrix,
2498
 
        C_section_matrix
2499
 
    );
2500
 
    Array&lt;CkCallback,2&gt; C_callback_matrix(I,K);
2501
 
    MatrixMultiplier&lt;double&gt;::build_thread_delay_callback_matrix(mCastGrpId,C_section_matrix,C_callback_matrix);
2502
 
 
2503
 
    {
2504
 
        Matrix A_data(23,11);
2505
 
        Matrix B_data(11,13);
2506
 
        Matrix C_data(23,13), correct_C_data(23,13);
2507
 
 
2508
 
        &lt;&lt; A data &gt;&gt;
2509
 
        &lt;&lt; B data &gt;&gt;
2510
 
        &lt;&lt; C data &gt;&gt;
2511
 
 
2512
 
        MatrixMultiplier&lt;double&gt;::broadcast_A_data(0,A_section_matrix,A_data);
2513
 
        MatrixMultiplier&lt;double&gt;::broadcast_B_data(0,B_section_matrix,B_data);
2514
 
        MatrixMultiplier&lt;double&gt;::gather_results(C_callback_matrix,C_data);
2515
 
        assertTrue(sum(abs(C_data-correct_C_data))&lt;1e-8);
2516
 
    }
2517
 
 
2518
 
    multiplier.ckDestroy();
2519
 
 
2520
 
}
2521
 
</t>
2522
 
<t tx="gcross.20081119205342.16">A_data =
2523
 
0.261866504012,0.236878231696,0.380017632472,0.593987204289,0.576522290572,0.686579179271,0.117057531975,0.0807189706706,0.524975647917,0.85348478089,0.32784113737,
2524
 
0.137307045661,0.721936270775,0.497272066704,0.00662990346833,0.934311820255,0.502196682797,0.609445178422,0.667736158144,0.798899583748,0.264161595828,0.104879945885,
2525
 
0.319679294935,0.636055286206,0.202729143402,0.207783865394,0.207354412515,0.335238700104,0.332923346186,0.189648385055,0.564489673834,0.309237115548,0.0589418897135,
2526
 
0.999552611389,0.207128209479,0.247170553961,0.249903696288,0.154265191093,0.792262871179,0.072877133596,0.817728566028,0.402116231499,0.607123140639,0.650708802013,
2527
 
0.853262567001,0.406558437323,0.462162950196,0.327946206801,0.264524424748,0.313971710267,0.633660743369,0.182623441676,0.136914584174,0.450341797727,0.0196506606282,
2528
 
0.850488263174,0.392463174662,0.735361834236,0.127493420602,0.332147016106,0.0300456280638,0.590630855646,0.414666471259,0.703663964187,0.923810792082,0.229049012856,
2529
 
0.995381059916,0.0428851257525,0.331077528949,0.78942945132,0.0834955598012,0.562198320834,0.936545350473,0.203572807047,0.892898850112,0.444973460656,0.0353533980962,
2530
 
0.788296011328,0.386833544193,0.891491850101,0.720879441372,0.742939842246,0.0510329573871,0.543584321238,0.149015778982,0.225329893599,0.40366551859,0.0315998155218,
2531
 
0.117003592342,0.237838001157,0.626057726921,0.508260895763,0.251743407826,0.190431967605,0.181848316198,0.50718214391,0.253622652508,0.450387478269,0.316331657775,
2532
 
0.515321437577,0.18875157865,0.632103577772,0.583705912732,0.841264070191,0.762791813602,0.0774012127148,0.670523177977,0.789176322828,0.1022102638,0.280725419529,
2533
 
0.331632772234,0.234608677795,0.946428173367,0.137036736073,0.777750220575,0.51776744907,0.46393810078,0.887574374768,0.957032697844,0.0171661939031,0.908509457721,
2534
 
0.0772033681099,0.460392995892,0.0999736374282,0.124643265136,0.978162973761,0.627270091518,0.0918355267612,0.542172490245,0.147837745177,0.818201023204,0.441658037386,
2535
 
0.304822197347,0.258127731465,0.952000877532,0.0956031274,0.925584101293,0.223408891998,0.722190228738,0.470058193836,0.309569888912,0.729637739648,0.81879995657,
2536
 
0.869796694677,0.291586527602,0.66192336729,0.75163303431,0.0105178952743,0.00831692641014,0.0768833949029,0.479968396166,0.0335657059737,0.698932952358,0.653429929735,
2537
 
0.32174317456,0.648326493503,0.84967268436,0.656475965688,0.233985674544,0.641282854781,0.161111230474,0.244099484477,0.963960208219,0.738368804128,0.716742533635,
2538
 
0.743825752552,0.956786997119,0.982975918727,0.332842770646,0.396636089193,0.678692624518,0.88678704315,0.271125786829,0.98314504261,0.883802487105,0.928988477637,
2539
 
0.568245202433,0.826197364222,0.688841426927,0.413868882819,0.436794442184,0.874196234122,0.284235074501,0.297373711938,0.254977644551,0.649149256866,0.606234019467,
2540
 
0.398292442086,0.230579511912,0.734614155349,0.852451092972,0.270141827812,0.88315782443,0.460339544548,0.0757437091179,0.527865725712,0.387833359001,0.56126945855,
2541
 
0.560272465525,0.733386233656,0.120197299603,0.531059891155,0.840337422591,0.63321258362,0.95969901644,0.925321288462,0.0441286085524,0.470060673073,0.912808667526,
2542
 
0.275027079982,0.760436571123,0.250187713192,0.0515411291099,0.477228325956,0.74090147845,0.765654219776,0.928727520985,0.423168694547,0.970202875799,0.503643520798,
2543
 
0.702490884601,0.276432745893,0.391797180964,0.0200279887029,0.795195910365,0.0640564369366,0.376991533787,0.907223629813,0.960200927608,0.166900303993,0.52333355076,
2544
 
0.120646470018,0.579610926073,0.319190579385,0.509717478291,0.756912045055,0.693859810094,0.955367185739,0.440628477158,0.362813479607,0.135191898404,0.237680156013,
2545
 
0.271258720902,0.806695911736,0.529901417966,0.513610843064,0.254644600733,0.944565840039,0.714090517383,0.868523248131,0.635095196522,0.43880840514,0.447541464633;
2546
 
</t>
2547
 
<t tx="gcross.20081119205342.17">B_data=
2548
 
0.338519448043,0.577445183289,0.714344727323,0.658301919056,0.793882195017,0.921157722106,0.0577648914639,0.687847024532,0.221618396668,0.170520402727,0.8984799562,0.668947955869,0.577999351541,
2549
 
0.653005818577,0.0777651307304,0.711003764864,0.310151984884,0.914902614143,0.794477586671,0.773372230331,0.947623242984,0.436268073833,0.115415900853,0.405067181246,0.308730012857,0.894462112134,
2550
 
0.685594167421,0.735907517741,0.183719988621,0.666037511439,0.83002130814,0.239093384013,0.604118187996,0.537144978572,0.279110396519,0.503183430236,0.958675711569,0.0113832056294,0.356667594252,
2551
 
0.515346650749,0.909519285222,0.361015245685,0.250015226661,0.643764662855,0.596689458656,0.639496226552,0.818496603303,0.700322559662,0.173394856186,0.101736041896,0.746345700845,0.301758606997,
2552
 
0.114771039479,0.608565873708,0.0155564484873,0.0176004576729,0.146978067832,0.963790424666,0.941671038922,0.710537197538,0.360260687003,0.488077184582,0.567896265204,0.710638567666,0.657722169854,
2553
 
0.955411872403,0.469631027096,0.538684684305,0.155027174568,0.0847980450302,0.942753117215,0.0145723259252,0.07679558772,0.885385875752,0.384913773723,0.34411140759,0.940314506079,0.321729030911,
2554
 
0.796731457201,0.342200403242,0.877966175523,0.380792077741,0.0513280264837,0.388143887869,0.472304007402,0.571411313158,0.0435416803201,0.655414843166,0.559857494826,0.924098840128,0.61060334532,
2555
 
0.891355837223,0.259171606051,0.542057917249,0.296033351049,0.910216386014,0.965320698874,0.382805153784,0.394092102599,0.853425291667,0.842133338027,0.557750047891,0.299478767031,0.713239273885,
2556
 
0.0414586701968,0.0126832723749,0.121381949536,0.556698529383,0.360770654669,0.416265722879,0.976527683174,0.0947413944391,0.96366821334,0.547672954636,0.565537572823,0.345727946086,0.02620734045,
2557
 
0.897827854819,0.546836317787,0.521642028451,0.217358529231,0.866370833193,0.476831978805,0.213789572269,0.0602385864117,0.452237648572,0.885551918228,0.7593062306,0.187170341416,0.809114719133,
2558
 
0.795928215029,0.460802836536,0.651159141431,0.477902630548,0.465155904725,0.0699897504759,0.529268026702,0.800777123722,0.0634700119732,0.91668143046,0.264076065876,0.974929169956,0.72910092266;</t>
2559
 
<t tx="gcross.20081119205342.18">correct_C_data =
2560
 
2.74630887563,2.34824795471,1.88749763459,1.46696440406,2.42618650929,2.8494203107,2.31547088645,2.01963930175,2.48568504913,2.40041046928,2.46172287712,2.54446545946,2.35050419565,
2561
 
2.88381435847,1.89636790137,2.19028375931,1.72348780374,2.57136311684,3.54381004672,3.19362884375,2.54051383117,2.76245193383,2.73679223432,2.99031715743,2.65258028199,2.84008538833,
2562
 
1.89597831248,1.22236107094,1.63997744186,1.24286548798,1.88534576127,2.18700473539,1.84425487982,1.65895739017,1.78587145472,1.51114860069,1.85525338942,1.70514210737,1.77947232828,
2563
 
3.41314357877,2.34224905431,2.7225684684,2.0115129485,3.16071823751,3.50918668137,1.89819559072,2.35122919671,2.71733227959,2.83306152092,2.9617225615,2.97581785227,2.88687322163,
2564
 
2.46381138372,1.99236704105,2.1947942171,1.6097910975,2.35702987655,2.66146432988,1.71587075023,2.19080239746,1.61870872183,1.7927020798,2.54719971163,2.22058142042,2.29509609954,
2565
 
3.06196962174,2.3242184069,2.54884964027,2.26341160987,3.34658062993,3.07455756425,2.63520711969,2.50121438308,2.29052041042,2.90586684945,3.56186832667,2.36738924172,2.96081159144,
2566
 
2.93778623805,2.49878500407,2.68762758571,2.20265030859,2.62985943893,3.25802587465,2.3883746404,2.40688014142,2.69085803275,2.43604092065,3.04033600607,3.21291163735,2.33204800744,
2567
 
2.59901999753,2.73587730256,2.11775694551,1.91328823757,2.90653948824,3.08424264137,2.681463071,2.94980765817,1.96251673132,2.12650849928,3.06215286197,2.50209551157,2.6359619265,
2568
 
2.3605300934,1.84063484445,1.56398014958,1.33844531682,2.31030149055,2.07450439719,1.92519584978,1.85990944876,1.82860398153,2.02074378416,2.01549527863,1.69644711625,1.95835542841,
2569
 
2.86447816225,2.57403302663,2.01649227605,1.9214588997,2.78869189932,3.72820557165,2.96851500958,2.62114770943,3.16035629705,2.62860290483,2.9604340175,2.99892942935,2.50057014648,
2570
 
3.50787298252,2.57630020603,2.52321434403,2.45975810165,3.12435220489,3.54466590989,3.57788720407,3.09745301423,3.03996023436,3.58619824544,3.48307990672,3.3612421795,3.07626960208,
2571
 
2.81981383874,1.98193838831,1.90583370063,1.07250880414,2.30853498234,3.11088115492,2.23483480691,2.07140142638,2.24815064073,2.58424076716,2.31104046775,2.45497281858,2.80554759615,
2572
 
3.60739012899,2.80101122303,2.58565178766,2.12601351281,3.07448027243,3.14137320402,3.14103823659,3.04558254805,2.1569545936,3.55056799062,3.51515136115,3.08363522025,3.4278209239,
2573
 
2.97324083415,2.54041473628,2.34808279686,1.94752907913,3.35523863872,2.54375424472,1.91440936235,2.65508952741,1.84512898397,2.34460425562,2.65246823604,2.24993829597,2.6681375693,
2574
 
3.71197473245,2.76679235419,2.67563833617,2.41973188812,3.61653418302,3.33807975298,3.3308566137,2.94291803336,3.22680775532,3.18208582924,3.30801987425,3.07653135596,3.04497763201,
2575
 
4.93786345433,3.38771616266,3.99497120347,3.23784987999,4.45670414797,4.40268597104,4.13631711029,4.05655342404,3.50958954092,4.22664236344,4.61098742563,4.28431977818,4.36904808611,
2576
 
3.87021305755,2.76399585849,2.92210100741,2.10483500742,3.40517585471,3.69210574976,2.73336360074,3.08836757224,2.74376609144,2.86725301558,3.21876386544,3.23675928141,3.36614499086,
2577
 
3.35424242099,2.79757928588,2.4481975096,2.02189521948,2.68036861204,3.02307209336,2.59938603482,2.66027607841,2.67453913652,2.59632482852,2.74075755356,3.25499819263,2.48948667867,
2578
 
4.46588650727,3.00725593652,3.67875053826,2.12441752137,3.47388514978,4.42337628884,3.24651236043,3.9018061952,2.85747918453,3.67205924769,3.34116258093,4.34866165224,4.23236717835,
2579
 
4.27772913177,2.35801305817,3.26930361625,1.97332274016,3.40001269977,3.9742288443,2.85264034622,2.78769279955,3.03100114892,3.62413619831,3.38184968341,3.30046665156,3.78940564902,
2580
 
2.56493240515,1.95643360563,2.19159367672,2.07111845441,2.85056719548,3.33714156529,3.02928329632,2.63498565823,2.56752902929,2.92957977068,3.11944672685,2.69350259607,2.76173825905,
2581
 
3.13016537508,2.22890041969,2.47344732538,1.55929623113,2.19790861852,3.36401833337,2.82578380071,2.76439415431,2.45617663226,2.50649982441,2.52088167253,3.2313182663,2.76671373086,
2582
 
4.29788080518,2.59873116073,3.2580433505,2.25287687684,3.48606217197,4.08035529893,3.16228977305,3.10482538871,3.458874146,3.32902133917,3.29514346712,3.54703945901,3.44719544193;
2583
 
</t>
2584
1576
<t tx="gcross.20081204190733.8"></t>
2585
1577
<t tx="gcross.20081205110513.3">typedef void (*AMPISlaveFunction)(std::vector&lt;Operation*&gt;&amp; arguments);
2586
1578
 
2861
1853
 
2862
1854
};
2863
1855
</t>
2864
 
<t tx="gcross.20090120130405.3">subSuite(RandomizationTests,VectorTests)
2865
 
 
2866
 
@others
2867
 
</t>
2868
 
<t tx="gcross.20090120130405.4">testCase(UniformRandomization,RandomizationTests) {
2869
 
    DistributedArray&lt;double,1&gt; x(3,7);
2870
 
    x.randomizeUniformlyOnUnitInterval(Open,Open);
2871
 
    x.randomizeUniformlyOnUnitInterval(Open,Closed);
2872
 
    x.randomizeUniformlyOnUnitInterval(Closed,Open);
2873
 
    x.randomizeUniformlyOnUnitInterval(Closed,Closed);
2874
 
}
2875
 
</t>
2876
1856
<t tx="gmc.20080831173941.20">template&lt;typename T_numtype, int N_rank&gt; class DistributedArraySegment : public Slave, public Array&lt;T_numtype,N_rank&gt; {
2877
1857
public:
2878
1858
 
2879
1859
    typedef TinyVector&lt;int,N_rank&gt; Coordinates;
2880
1860
    typedef Array&lt;T_numtype,N_rank&gt; ArrayBase;
 
1861
    typedef RectDomain&lt;N_rank&gt; RectDomainType;
2881
1862
 
2882
1863
    typedef AbstractOperation&lt;T_numtype,N_rank&gt; AbstractOperationType;
2883
1864
 
3106
2087
 
3107
2088
    PE_dimensions = -1;
3108
2089
    remainder_extents = -1;
3109
 
 
3110
2090
    ddb(N_rank,length_.data(),requested_number_of_PEs,remainder_extents.data(),PE_dimensions.data());
3111
2091
 
3112
 
    //extents = (length_-remainder_extents)/(PE_dimensions-1)
3113
 
    Coordinates PE_dimensions_minus_first = PE_dimensions;
3114
 
    PE_dimensions_minus_first -= 1;
3115
 
 
3116
 
    for(int i = 0; i &lt; N_rank; i++)
3117
 
        if(PE_dimensions_minus_first[i]==0)
3118
 
            PE_dimensions_minus_first[i] = 1;
3119
 
 
3120
 
    extents = length_;
3121
 
    extents -= remainder_extents;
3122
 
    extents /= PE_dimensions_minus_first;
3123
 
 
3124
 
    for(int i = 0; i &lt; N_rank; i++)
3125
 
        if(extents[i]==0)
3126
 
            extents[i] = 1;
 
2092
    extents = length_/PE_dimensions;
 
2093
    for(int i = 0; i &lt; N_rank; ++i)
 
2094
        if(length_[i]%PE_dimensions[i]&gt;0) {
 
2095
            ++extents[i];
 
2096
            remainder_extents[i]=length_[i]%extents[i];
 
2097
        } else {
 
2098
            remainder_extents[i]=extents[i];
 
2099
        }
3127
2100
 
3128
2101
@
3129
2102
Create the Charm array.
3132
2105
 
3133
2106
    CProxy_DistributedArraySegment&lt;T_numtype,N_rank&gt; chares = CProxy_DistributedArraySegment&lt;T_numtype,N_rank&gt;::ckNew();
3134
2107
 
3135
 
    Coordinates chare_lbounds, chare_extents;
3136
 
 
3137
 
    CoordinateIteratorType chare_index(PE_dimensions);
3138
 
 
3139
 
    for(int i = 0; i &lt; number_of_PEs; i++, chare_index++) {
3140
 
        for(int j = 0; j &lt; N_rank; j++) {
3141
 
            if((*chare_index)[j]==0) {
3142
 
                chare_lbounds[j] = 0;
3143
 
                chare_extents[j] = remainder_extents[j];
3144
 
            } else {
3145
 
                chare_lbounds[j] = remainder_extents[j]+extents[j]*((*chare_index)[j]-1);
3146
 
                chare_extents[j] = extents[j];
3147
 
            }
3148
 
        }
3149
 
        chares[i].insert(chare_lbounds,chare_extents,storage_,*chare_index,PE_dimensions);
3150
 
    }
 
2108
    DomainIteratorType domain_iter(PE_dimensions,0,remainder_extents,extents);
 
2109
    for(int i = 0; i &lt; number_of_PEs; ++i, ++domain_iter)
 
2110
        chares[i].insert((*domain_iter),storage_,(*domain_iter.chare_index),PE_dimensions);
3151
2111
 
3152
2112
    chares.doneInserting();
3153
2113
 
3565
2525
 
3566
2526
        inline const T_numtype&amp; index(int index) { return ordering[index]; }
3567
2527
 
3568
 
        CoordinateIterator&amp; operator++(int) {
 
2528
        CoordinateIterator&amp; operator++() {
3569
2529
            assert(not invalid);
3570
2530
            current[index(N_dim-1)] += strides[index(N_dim-1)];
3571
2531
            int j = N_dim-1;
3628
2588
</t>
3629
2589
<t tx="gmc.20080907163416.3">virtual ~AbstractDistributedArray() { chares.ckDestroy(); }
3630
2590
</t>
3631
 
<t tx="gmc.20080907163416.8">subSuite(ScatteringAndRetrievingTests,VectorTests)
3632
 
</t>
3633
 
<t tx="gmc.20080907163416.9">testCase(ScatterSmallVector,ScatteringAndRetrievingTests) {
3634
 
    DistributedArray&lt;int,1&gt; x(3,7);
3635
 
 
3636
 
    x = 0;
3637
 
 
3638
 
    Array&lt;int,1&gt; y(7);
3639
 
 
3640
 
    y = 0, 1, 2, 3, 4, 5, 6;
3641
 
 
3642
 
    x = y;
3643
 
 
3644
 
    for(int i = 0; i &lt; 7; i++)
3645
 
        assertEqual(x[i],i);
3646
 
}
3647
 
</t>
3648
 
<t tx="gmc.20080907163416.10">testSuite(VectorTests)
3649
 
</t>
3650
 
<t tx="gmc.20080907163416.11">subSuite(OperationsTests,VectorTests)</t>
3651
 
<t tx="gmc.20080907163416.12">testCase(MultipleArithmeticOperations,OperationsTests) {
3652
 
    DistributedArray&lt;int, 1&gt; x(2,2);
3653
 
 
3654
 
    x = 0;
3655
 
 
3656
 
    x[1].abs();
3657
 
 
3658
 
    x[0].abs();
3659
 
 
3660
 
    x += 2;
3661
 
 
3662
 
    x[0].abs();
3663
 
 
3664
 
    x[0].abs();
3665
 
 
3666
 
    x = 2;
3667
 
 
3668
 
    x[0].abs();
3669
 
 
3670
 
    x[0] += 2;
3671
 
 
3672
 
    x[1] += 2;
3673
 
 
3674
 
    x[0] += 2;
3675
 
 
3676
 
    x = 2;
3677
 
 
3678
 
    x += 2;
3679
 
 
3680
 
    x[0] += 2;
3681
 
 
3682
 
    x[0] += 2;
3683
 
 
3684
 
    assertEqual(x[0],8);
3685
 
    assertEqual(x[1],4);
3686
 
}
3687
 
</t>
3688
2591
<t tx="gmc.20080907163416.13">ElementReference(AbstractDistributedArray&lt;T_numtype,N_rank&gt;&amp; parent_, const Coordinates&amp; coordinates_, const int index_) : parent(parent_), coordinates(coordinates_),  index(index_) {  }
3689
2592
 
3690
2593
void perform_operation(TwoArgumentOperationType optype, T_numtype x) {
3732
2635
 
3733
2636
//void print() { perform_operation(Print,0); }
3734
2637
</t>
3735
 
<t tx="gmc.20080907163416.16">subSuite(ElementReferenceTests,VectorTests)</t>
3736
 
<t tx="gmc.20080907163416.17">testCase(ComparisonOperator,ElementReferenceTests) {
3737
 
 
3738
 
    DistributedArray&lt;int, 1&gt; x(1,1);
3739
 
 
3740
 
    x[0] = 5;
3741
 
 
3742
 
    x++;
3743
 
 
3744
 
    assertTrue(x[0] &gt; 5);
3745
 
    assertTrue(x[0] == 6);
3746
 
    assertTrue(x[0] &lt; 7);
3747
 
 
3748
 
    assertTrue(x[0] &gt;= 5);
3749
 
    assertTrue(x[0] &gt;= 6);
3750
 
    assertTrue(x[0] &lt;= 6);
3751
 
    assertTrue(x[0] &lt;= 7);
3752
 
 
3753
 
}
3754
 
</t>
3755
2638
<t tx="gmc.20080907163416.18"></t>
3756
2639
<t tx="gmc.20080907163416.19"></t>
3757
2640
<t tx="gmc.20080907163416.20">void operator=(const ArrayType&amp; arr) {
3768
2651
            ticket_id_assignees,
3769
2652
            &amp;op
3770
2653
        );
3771
 
        domainref++; i++;
 
2654
        ++domainref; ++i;
3772
2655
    }
3773
2656
 
3774
2657
    update_broadcast_ticket();
3894
2777
            ticket_id_assignees,
3895
2778
            &amp;op
3896
2779
        );
3897
 
        domainref++; i++;
 
2780
        ++domainref; ++i;
3898
2781
    }
3899
2782
 
3900
2783
    update_broadcast_ticket();
3904
2787
}
3905
2788
</t>
3906
2789
<t tx="gmc.20080907163416.38"></t>
3907
 
<t tx="gmc.20080907163416.39">testCase(GatherSmallVector,ScatteringAndRetrievingTests) {
3908
 
    DistributedArray&lt;int,1&gt; x(2,4);
3909
 
 
3910
 
    x = 0;
3911
 
 
3912
 
    x[0]++;
3913
 
 
3914
 
    x[1] += 2;
3915
 
 
3916
 
    x[2] = 3;
3917
 
 
3918
 
    x[3] -= (-4);
3919
 
 
3920
 
    Array&lt;int,1&gt; y(4);
3921
 
 
3922
 
    x.gatherInto(y);
3923
 
 
3924
 
    for(int i = 0; i &lt; 4; i++)
3925
 
        assertTrue((bool)(y(i) == (i+1)));
3926
 
}
3927
 
</t>
3928
 
<t tx="gmc.20080907163416.41">subSuite(InformationalMethodsTests,VectorTests)</t>
3929
 
<t tx="gmc.20080907163416.42">testCase(StandardStorage,InformationalMethodsTests) {
3930
 
    DistributedArray&lt;int,3&gt; arr(7,4,5,6);
3931
 
 
3932
 
    assertEqual(arr.rank(),3);
3933
 
 
3934
 
    assertEqual(arr.rows(),4);
3935
 
    assertEqual(arr.cols(),5);
3936
 
    assertEqual(arr.depth(),6);
3937
 
 
3938
 
    TinyVector&lt;int,3&gt; correct;
3939
 
 
3940
 
    correct = 0,0,0;
3941
 
    assertArraysEqual(3, arr.lbound(), correct);
3942
 
 
3943
 
    correct = 3,4,5;
3944
 
    assertArraysEqual(3, arr.ubound(), correct);
3945
 
 
3946
 
    correct = 4,5,6;
3947
 
    assertArraysEqual(3, arr.shape(), correct);
3948
 
 
3949
 
    assertEqual(arr.size(),product(correct));
3950
 
 
3951
 
    assertEqual(arr.numElements(),product(correct));
3952
 
 
3953
 
    for(int i = 0; i &lt; 3; i++)
3954
 
        assertEqual(arr.extent(i),correct[i]);
3955
 
 
3956
 
    assertArraysEqual(3,arr.extent(),correct);
3957
 
}
3958
 
</t>
3959
 
<t tx="gmc.20080907163416.43">testCase(ScatterTensor,ScatteringAndRetrievingTests) {
3960
 
    DistributedArray&lt;int,3&gt; x(25,10,10,10);
3961
 
 
3962
 
    Array&lt;int,3&gt; y(10,10,10);
3963
 
 
3964
 
    for(DistributedArray&lt;int,3&gt;::CoordinateIteratorType chare_index(y.shape()); (bool)chare_index; chare_index++)
3965
 
        y(*chare_index) = product(*chare_index);
3966
 
 
3967
 
    x = y;
3968
 
 
3969
 
    for(DistributedArray&lt;int,3&gt;::CoordinateIteratorType chare_index(x.shape()); (bool)chare_index; chare_index++)
3970
 
        assertEqual(x(*chare_index),(int)product(*chare_index));
3971
 
}
3972
 
</t>
3973
 
<t tx="gmc.20080907163416.44">testCase(GatherTensor,ScatteringAndRetrievingTests) {
3974
 
    DistributedArray&lt;int,3&gt; x(25,10,10,10);
3975
 
 
3976
 
    for(DistributedArray&lt;int,3&gt;::CoordinateIteratorType chare_index(x.shape()); (bool)chare_index; chare_index++)
3977
 
        x(*chare_index) = product(*chare_index);
3978
 
 
3979
 
    Array&lt;int,3&gt; y(10,10,10);
3980
 
    x.gatherInto(y);
3981
 
 
3982
 
    for(DistributedArray&lt;int,3&gt;::CoordinateIteratorType chare_index(y.shape()); (bool)chare_index; chare_index++)
3983
 
        assertEqual(y(*chare_index),(int)product(*chare_index));
3984
 
}
3985
 
</t>
3986
 
<t tx="gmc.20080907163416.45">testCase(FortranStorage,InformationalMethodsTests) {
3987
 
    DistributedArray&lt;int,3&gt; arr(7,4,5,6,fortranArray);
3988
 
 
3989
 
    assertEqual(arr.rank(),3);
3990
 
 
3991
 
    TinyVector&lt;int,3&gt; correct;
3992
 
 
3993
 
    correct = 1,1,1;
3994
 
    assertArraysEqual(3, arr.lbound(), correct);
3995
 
 
3996
 
    correct = 4,5,6;
3997
 
    assertArraysEqual(3, arr.ubound(), correct);
3998
 
 
3999
 
    correct = 4,5,6;
4000
 
    assertArraysEqual(3, arr.shape(), correct);
4001
 
 
4002
 
    assertEqual(arr.size(),product(correct));
4003
 
 
4004
 
    assertEqual(arr.numElements(),product(correct));
4005
 
 
4006
 
    for(int i = 0; i &lt; 3; i++)
4007
 
        assertEqual(arr.extent(i),correct[i]);
4008
 
 
4009
 
    assertArraysEqual(3,arr.extent(),correct);
4010
 
}
4011
 
</t>
4012
2790
<t tx="gmc.20080907163416.46">template&lt;typename T_numtype, int N_rank&gt; class DistributedArray : public AbstractDistributedArray&lt;T_numtype,N_rank&gt; {
4013
2791
 
4014
2792
public:
4062
2840
</t>
4063
2841
<t tx="gmc.20080907163416.51">virtual void compute_remote_coordinates(const Coordinates&amp; coordinates,Coordinates&amp; processor_coordinates,Coordinates&amp; remote_coordinates) const {
4064
2842
    remote_coordinates = coordinates;
4065
 
 
4066
 
    for(int i = 0; i &lt; N_rank; i++)
4067
 
        if(coordinates[i] &lt; remainder_extents[i])
4068
 
            processor_coordinates[i] = 0;
4069
 
        else
4070
 
            processor_coordinates[i] = (coordinates[i]-remainder_extents[i])/(extents[i])+1;
4071
 
 
 
2843
    processor_coordinates = coordinates/extents;
4072
2844
}
4073
2845
</t>
4074
2846
<t tx="gmc.20080907163416.52">template&lt;int N_rank&gt; class DomainIterator {
4099
2871
 
4100
2872
    operator bool() { return ((bool) chare_index); }
4101
2873
 
4102
 
    void operator++(int) { chare_index++; update(); }
 
2874
    void operator++() { ++chare_index; update(); }
4103
2875
 
4104
2876
    void update() {
4105
2877
        if(not ((bool)chare_index)) return;
4106
2878
 
4107
 
        Coordinates subarray_lbounds, subarray_ubounds;
 
2879
        Coordinates subarray_lbounds = lbound+(*chare_index)*extents, subarray_ubounds;
4108
2880
 
4109
 
        for(int j = 0; j &lt; N_rank; j++) {
4110
 
            if((*chare_index)[j]==0) {
4111
 
                subarray_lbounds[j] = lbound[j];
4112
 
                subarray_ubounds[j] = lbound[j]+remainder_extents[j]-1;
4113
 
            } else {
4114
 
                subarray_lbounds[j] = lbound[j]+remainder_extents[j]+extents[j]*((*chare_index)[j]-1);
4115
 
                subarray_ubounds[j] = lbound[j]+remainder_extents[j]+extents[j]*((*chare_index)[j])-1;
4116
 
            }
 
2881
        for(int j = 0; j &lt; N_rank; ++j) {
 
2882
            if((*chare_index)[j]==PE_dimensions[j]-1)
 
2883
                subarray_ubounds[j] = subarray_lbounds[j]+remainder_extents[j]-1;
 
2884
            else
 
2885
                subarray_ubounds[j] = subarray_lbounds[j]+extents[j]-1;
4117
2886
        }
4118
2887
 
4119
2888
        domain = RectDomainType(subarray_lbounds,subarray_ubounds);
4254
3023
    Coordinates remainder_block_count = remainder_elements / block_sizes;
4255
3024
    Coordinates remainder_block_remainder = remainder_elements % block_sizes;
4256
3025
 
4257
 
    for(int i = 0; i &lt; number_of_PEs; i++, chare_index++) {
 
3026
    for(int i = 0; i &lt; number_of_PEs; ++i, ++chare_index) {
4258
3027
        Coordinates chare_extents = chare_minimum_extents;
4259
 
        for(int j = 0; j &lt; N_rank; j++)
 
3028
        for(int j = 0; j &lt; N_rank; ++j)
4260
3029
            if(chare_index[j] &lt; remainder_block_count[j])
4261
3030
                chare_extents[j] += block_sizes[j];
4262
3031
            else if(chare_index[j] == remainder_block_count[j])
4291
3060
    setupStorage(boundArrayID);
4292
3061
}
4293
3062
</t>
4294
 
<t tx="gmc.20080927101647.13">testSuite(BlockCyclicTests)
4295
 
</t>
4296
 
<t tx="gmc.20080927101647.14">subSuite(_1D,BlockCyclicTests)
4297
 
</t>
4298
 
<t tx="gmc.20080927101647.15">testCase(ComputeElementLocation_1D,_1D) {
4299
 
    TinyVector&lt;int,1&gt; PE_dimensions_, matrix_dimensions, block_sizes_;
4300
 
    PE_dimensions_ = 3;
4301
 
    matrix_dimensions = 9;
4302
 
    block_sizes_ = 2;
4303
 
 
4304
 
    BlockCyclicArray&lt;int,1&gt; vector(PE_dimensions_,matrix_dimensions,block_sizes_);
4305
 
 
4306
 
    TinyVector&lt;int,1&gt; coordinates, processor_coordinates, remote_coordinates;
4307
 
 
4308
 
    coordinates = 0;
4309
 
    vector.compute_remote_coordinates(coordinates,processor_coordinates,remote_coordinates);
4310
 
    assertEqual(processor_coordinates[0],0);
4311
 
    assertEqual(remote_coordinates[0],0);
4312
 
 
4313
 
    coordinates = 1;
4314
 
    vector.compute_remote_coordinates(coordinates,processor_coordinates,remote_coordinates);
4315
 
    assertEqual(processor_coordinates[0],0);
4316
 
    assertEqual(remote_coordinates[0],1);
4317
 
 
4318
 
    coordinates = 2;
4319
 
    vector.compute_remote_coordinates(coordinates,processor_coordinates,remote_coordinates);
4320
 
    assertEqual(processor_coordinates[0],1);
4321
 
    assertEqual(remote_coordinates[0],0);
4322
 
 
4323
 
    coordinates = 3;
4324
 
    vector.compute_remote_coordinates(coordinates,processor_coordinates,remote_coordinates);
4325
 
    assertEqual(processor_coordinates[0],1);
4326
 
    assertEqual(remote_coordinates[0],1);
4327
 
 
4328
 
    coordinates = 4;
4329
 
    vector.compute_remote_coordinates(coordinates,processor_coordinates,remote_coordinates);
4330
 
    assertEqual(processor_coordinates[0],2);
4331
 
    assertEqual(remote_coordinates[0],0);
4332
 
 
4333
 
    coordinates = 5;
4334
 
    vector.compute_remote_coordinates(coordinates,processor_coordinates,remote_coordinates);
4335
 
    assertEqual(processor_coordinates[0],2);
4336
 
    assertEqual(remote_coordinates[0],1);
4337
 
 
4338
 
    coordinates = 6;
4339
 
    vector.compute_remote_coordinates(coordinates,processor_coordinates,remote_coordinates);
4340
 
    assertEqual(processor_coordinates[0],0);
4341
 
    assertEqual(remote_coordinates[0],2);
4342
 
 
4343
 
    coordinates = 7;
4344
 
    vector.compute_remote_coordinates(coordinates,processor_coordinates,remote_coordinates);
4345
 
    assertEqual(processor_coordinates[0],0);
4346
 
    assertEqual(remote_coordinates[0],3);
4347
 
 
4348
 
    coordinates = 8;
4349
 
    vector.compute_remote_coordinates(coordinates,processor_coordinates,remote_coordinates);
4350
 
    assertEqual(processor_coordinates[0],1);
4351
 
    assertEqual(remote_coordinates[0],2);
4352
 
 
4353
 
}
4354
 
 
4355
 
</t>
4356
3063
<t tx="gmc.20080927101647.16"></t>
4357
 
<t tx="gmc.20080927101647.17">subSuite(_2D,BlockCyclicTests)
4358
 
</t>
4359
 
<t tx="gmc.20080927101647.18">testCase(ComputeElementLocation_2D,_2D) {
4360
 
    TinyVector&lt;int,2&gt; PE_dimensions_, matrix_dimensions, block_sizes_;
4361
 
    PE_dimensions_ = 3,2;
4362
 
    matrix_dimensions = 9;
4363
 
    block_sizes_ = 2;
4364
 
 
4365
 
    BlockCyclicArray&lt;int,2&gt; vector(PE_dimensions_,matrix_dimensions,block_sizes_);
4366
 
 
4367
 
    TinyVector&lt;int,2&gt; coordinates, processor_coordinates, remote_coordinates;
4368
 
 
4369
 
    coordinates = 0,1;
4370
 
    vector.compute_remote_coordinates(coordinates,processor_coordinates,remote_coordinates);
4371
 
    assertEqual(processor_coordinates[0],0);
4372
 
    assertEqual(processor_coordinates[1],0);
4373
 
    assertEqual(remote_coordinates[0],0);
4374
 
    assertEqual(remote_coordinates[1],1);
4375
 
 
4376
 
    coordinates = 3,7;
4377
 
    vector.compute_remote_coordinates(coordinates,processor_coordinates,remote_coordinates);
4378
 
    assertEqual(processor_coordinates[0],1);
4379
 
    assertEqual(processor_coordinates[1],1);
4380
 
    assertEqual(remote_coordinates[0],1);
4381
 
    assertEqual(remote_coordinates[1],3);
4382
 
 
4383
 
    coordinates = 5,4;
4384
 
    vector.compute_remote_coordinates(coordinates,processor_coordinates,remote_coordinates);
4385
 
    assertEqual(processor_coordinates[0],2);
4386
 
    assertEqual(processor_coordinates[1],0);
4387
 
    assertEqual(remote_coordinates[0],1);
4388
 
    assertEqual(remote_coordinates[1],2);
4389
 
 
4390
 
    coordinates = 8,8;
4391
 
    vector.compute_remote_coordinates(coordinates,processor_coordinates,remote_coordinates);
4392
 
    assertEqual(processor_coordinates[0],1);
4393
 
    assertEqual(processor_coordinates[1],0);
4394
 
    assertEqual(remote_coordinates[0],2);
4395
 
    assertEqual(remote_coordinates[1],4);
4396
 
 
4397
 
}
4398
 
 
4399
 
</t>
4400
 
<t tx="gmc.20080927101647.19">template&lt;typename T, int N&gt; void assertRemoteSegmentEquals(AbstractDistributedArray&lt;T,N&gt;&amp; array, const int segment_id, const Array&lt;T,N&gt;&amp; correct) {
4401
 
    CkCallback callback(CkCallback::resumeThread);
4402
 
    FullDataRetrieveOperation&lt;T,N&gt; op(callback);
4403
 
    array.pointcast_operation(segment_id,op);;
4404
 
    ArrayMessage&lt;T,N&gt;* msg = (ArrayMessage&lt;T,N&gt;*)(callback.thread_delay());
4405
 
    assertTrue(all(correct==(*msg)));
4406
 
}
4407
 
 
4408
 
testCase(SequenceScatter_1D,_1D) {
4409
 
    TinyVector&lt;int,1&gt; PE_dimensions_, matrix_dimensions, block_sizes_;
4410
 
    PE_dimensions_ = 4;
4411
 
    matrix_dimensions = 19;
4412
 
    block_sizes_ = 3;
4413
 
 
4414
 
    BlockCyclicArray&lt;int,1&gt; vector(PE_dimensions_,matrix_dimensions,block_sizes_);
4415
 
 
4416
 
    for(int i = 0; i &lt; 19; i++) vector[i] = i;
4417
 
 
4418
 
    Array&lt;int,1&gt; correct_array;
4419
 
 
4420
 
    correct_array.resize(6);
4421
 
    correct_array = 0,1,2,12,13,14;
4422
 
    assertRemoteSegmentEquals(vector,0,correct_array);
4423
 
 
4424
 
    correct_array.resize(6);
4425
 
    correct_array = 3,4,5,15,16,17;
4426
 
    assertRemoteSegmentEquals(vector,1,correct_array);
4427
 
 
4428
 
    correct_array.resize(4);
4429
 
    correct_array = 6,7,8,18;
4430
 
    assertRemoteSegmentEquals(vector,2,correct_array);
4431
 
 
4432
 
    correct_array.resize(3);
4433
 
    correct_array = 9,10,11;
4434
 
    assertRemoteSegmentEquals(vector,3,correct_array);
4435
 
 
4436
 
}
4437
 
</t>
4438
3064
<t tx="gmc.20080927101647.20"></t>
4439
3065
<t tx="gmc.20080927101647.21">template&lt;typename T_numtype, int N_rank&gt; class ArrayMessage : public CkMcastBaseMsg, public Array&lt;T_numtype,N_rank&gt;, public CMessage_ArrayMessage&lt;T_numtype,N_rank&gt; {
4440
3066
    public:
4478
3104
static ArrayMessage* from_reduction(void* reduction_message) { return from_envelope((envelope*)((CkReductionMsg*)reduction_message)-&gt;getData()); }
4479
3105
static ArrayMessage* from_envelope(envelope* env) { return ArrayMessage::unpack(EnvToUsr(env)); }
4480
3106
</t>
4481
 
<t tx="gmc.20080927101647.31">testSuite(ArrayMessageTests)
4482
 
</t>
4483
3107
<t tx="gmc.20080927101647.32">@language cplusplus
4484
3108
</t>
4485
 
<t tx="gmc.20080927101647.33">testCase(SerializeDeserialize_1D_Trivial,ArrayMessageTests) {   
4486
 
    typedef Array&lt;int,1&gt; ArrayType;
4487
 
    typedef ArrayMessage&lt;int,1&gt; ArrayMessageType;
4488
 
 
4489
 
    ArrayType arr(1);
4490
 
    arr = 42;
4491
 
 
4492
 
    ArrayMessageType* msg = ArrayMessageType::copy_from(arr);
4493
 
 
4494
 
    assertEqual((*msg)(0),42);
4495
 
 
4496
 
    msg = ArrayMessageType::unpack(ArrayMessageType::pack(msg));
4497
 
 
4498
 
    assertEqual((*msg)(0),42);
4499
 
 
4500
 
}
4501
 
</t>
4502
3109
<t tx="gmc.20080927101647.36">template&lt;typename T_numtype, int N_rank&gt; class FullArrayReductionOperation : public AbstractOperation&lt;T_numtype,N_rank&gt; {
4503
3110
 
4504
3111
PUPable_decl_template(FullArrayReductionOperation)
4577
3184
<t tx="gmc.20080927101647.38">public:
4578
3185
    @others
4579
3186
</t>
4580
 
<t tx="gmc.20080927101647.39">DistributedArraySegment(const Coordinates&amp; lbound, const Coordinates&amp; extent, const GeneralArrayStorage&lt;N_rank&gt; storage, const Coordinates&amp; processor_dimensions_, const Coordinates&amp; processor_coordinates_) : Array&lt;T_numtype,N_rank&gt;(lbound,extent,storage), processor_dimensions(processor_dimensions_), processor_coordinates(processor_coordinates_) { }
 
3187
<t tx="gmc.20080927101647.39">DistributedArraySegment(
 
3188
    const Coordinates&amp; lbound,
 
3189
    const Coordinates&amp; extent,
 
3190
    const GeneralArrayStorage&lt;N_rank&gt; storage,
 
3191
    const Coordinates&amp; processor_dimensions_,
 
3192
    const Coordinates&amp; processor_coordinates_
 
3193
) : Array&lt;T_numtype,N_rank&gt;(lbound,extent,storage),
 
3194
    processor_dimensions(processor_dimensions_),
 
3195
    processor_coordinates(processor_coordinates_)
 
3196
{ }
 
3197
 
 
3198
DistributedArraySegment(
 
3199
    const RectDomainType&amp; domain,
 
3200
    const GeneralArrayStorage&lt;N_rank&gt; storage,
 
3201
    const Coordinates&amp; processor_dimensions_,
 
3202
    const Coordinates&amp; processor_coordinates_
 
3203
) : Array&lt;T_numtype,N_rank&gt;(domain.lbound(),domain.ubound()-domain.lbound()+1,storage),
 
3204
    processor_dimensions(processor_dimensions_),
 
3205
    processor_coordinates(processor_coordinates_)
 
3206
{ }
4581
3207
 
4582
3208
explicit DistributedArraySegment(CkMigrateMessage*) { }
4583
3209
</t>
4607
3233
template&lt;typename T&gt; CkReduction::reducerType reducers&lt;T&gt;::allType = NULL_reducer;
4608
3234
template&lt;typename T&gt; CkReduction::reducerType reducers&lt;T&gt;::anyType = NULL_reducer;
4609
3235
</t>
4610
 
<t tx="gmc.20080927101647.47">subSuite(ReductionTests,VectorTests)
4611
 
 
4612
 
@others
4613
 
</t>
4614
 
<t tx="gmc.20080927101647.48">testCase(SumReduction_1D,ReductionTests) {
4615
 
    DistributedArray&lt;int,1&gt; x(3,7);
4616
 
 
4617
 
    x = 0;
4618
 
 
4619
 
    Array&lt;int,1&gt; y(7);
4620
 
 
4621
 
    y = 0, 1, 2, 3, 4, 5, 6;
4622
 
 
4623
 
    x = y;
4624
 
 
4625
 
    assertEqual(x.sum(),21);
4626
 
}
4627
 
</t>
4628
3236
<t tx="gmc.20080927101647.49">template&lt;class ReductionOperationType&gt; CkReductionMsg* performReduction(ReductionType reductionType) {
4629
3237
    CkCallback callback(CkCallback::resumeThread);
4630
3238
    ReductionOperationType op(reductionType,callback);
4651
3259
 
4652
3260
T_numtype any() { return performReductionAndUnwrap&lt;FullArrayReductionOperationType,bool&gt;(Any); }
4653
3261
</t>
4654
 
<t tx="gmc.20080927101647.51">testCase(SumReduction_3D,ReductionTests) {
4655
 
    DistributedArray&lt;int,3&gt; x(9,4,4,4);
4656
 
 
4657
 
    int total = 0;
4658
 
 
4659
 
    for(int i = 0; i &lt; 4; i++)
4660
 
        for(int j = 0; j &lt; 4; j++)
4661
 
            for(int k = 0; k &lt; 4; k++) {
4662
 
                x(i,j,k) = i*j*k;
4663
 
                total += i*j*k;
4664
 
            }
4665
 
 
4666
 
    assertEqual(x.sum(),total);
4667
 
}
4668
 
</t>
4669
 
<t tx="gmc.20080927101647.54">testCase(AllReduction,ReductionTests) {
4670
 
    DistributedArray&lt;bool,1&gt; x(3,7);
4671
 
 
4672
 
    x = true;
4673
 
 
4674
 
    assertTrue(x.all());
4675
 
 
4676
 
    x = false;
4677
 
 
4678
 
    assertTrue(!x.all());
4679
 
 
4680
 
    x = false;
4681
 
 
4682
 
    x(0) = true;
4683
 
    assertTrue(!x.all());
4684
 
 
4685
 
    x = true;
4686
 
 
4687
 
    x(4) = false;
4688
 
 
4689
 
    assertTrue( (bool)x(0));
4690
 
    assertTrue( (bool)x(1));
4691
 
    assertTrue( (bool)x(2));
4692
 
    assertTrue( (bool)x(3));
4693
 
    assertTrue(!(bool)x(4));
4694
 
    assertTrue( (bool)x(5));
4695
 
    assertTrue( (bool)x(6));
4696
 
 
4697
 
    assertTrue(!x.all());
4698
 
 
4699
 
}
4700
 
</t>
4701
3262
<t tx="gmc.20080930225830.3">template&lt;typename T_numtype, int N_rank&gt; struct StashInfo {
4702
3263
    StashInfo(const Array&lt;T_numtype,N_rank&gt;&amp; destination_, int&amp; counter_, CthThread thread_) : destination(destination_), counter(counter_), thread(thread_) { }
4703
3264
    Array&lt;T_numtype,N_rank&gt; destination;