[ExM Users] 2D arrays

Ketan Maheshwari ketan at mcs.anl.gov
Thu Jun 26 15:47:41 CDT 2014


Thanks Tim. That makes sense. One more question:

Is it possible to consume the resulting 2D array in an outer loop of a
nested loop such that for each outer dimension all elements of inner
dimension are passed to a function. eg:

foreach outer in outerlist{
    foreach inner in innerlist{
        pickle[outer][inner] = producearray(args);
    }
    dumpedout[outer] = consume(pickle[outer][*]);
}

So, the synchronization is partial here: as soon as a round of inner loop
is done the result can be used by consume.

Thanks,
Ketan


On Thu, Jun 26, 2014 at 3:04 PM, Tim Armstrong <tim.g.armstrong at gmail.com>
wrote:

>  Yes 2D arrays are supported with the same declaration syntax as
> Swift/K.  You're trying to declare a 2D array with key types i and j in
> each loop iteration.  The compiler is correctly pointing out that i isn't a
> type.  You need to declare it outside of the loops then assign it inside
> the loops.
>
>  - Tim
>
>
> On Thu, Jun 26, 2014 at 2:44 PM, Ketan Maheshwari <ketan at mcs.anl.gov>
> wrote:
>
>> Are 2D arrays of this style supported in T:
>>
>>  main {
>> foreach i in [0:31]{
>>         /*string commands[] = ["head","tail","wc","stat"];*/
>>         foreach j in [0:24]{
>>                 string pyline=sprintf("import cPickle as
>> pickle\n\nrepr(pickle.dumps({'foo1':%s,'foo2':%s}))", i, j);
>>                 string pickle[i][j] = python(pyline);
>>         }
>> }
>> }
>>
>>  stc gives following error:
>>
>>  stc error:
>> multi-map-reduce.swift:15:3: The following type was not defined in the
>> current context: j
>>
>> _______________________________________________
>> ExM-user mailing list
>> ExM-user at lists.mcs.anl.gov
>> https://lists.mcs.anl.gov/mailman/listinfo/exm-user
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/exm-user/attachments/20140626/4a58b85d/attachment.html>


More information about the ExM-user mailing list