Hi Damian --

Thanks for clarifying your question -- I hadn't spent the time with the 
code to realize that the array literals were the issue here.

AFAIK, Chapel has never settled on a syntax for multidimensional array 
literals.  We kicked off a conversation about how this should be expressed 
awhile back, but never committed to anything, nor did anyone implement it. 
Here's the thread for reference:

        http://sourceforge.net/p/chapel/mailman/message/31974940/

To summarize, the main takeaway was that there ought to be some sort of 
separator for "end of dimension" (where ; and \ were the two prevalent 
choices) and multiple instances of it would be used for higher-dimensional 
array literals.  While I don't think anyone was deeply excited by this 
proposal, I don't think there were any significant objections either.

("Open issue" in the spec means "We still need to figure this out")

My guess as to why your standalone example works is that Chapel routines 
are not fully type checked until they're called.  Could it be that your 
standalone code was never called and therefore never type-checked?

Thanks,
-Brad


> I agree with everything in the above. The problem is initialization. There is 
> only a single example in the Specification. That document also notes on page 
> 174 ($20.2.1) that there is an 'Open issue' in this area. I am unsure what 
> 'Open' means. Read on.
>
> I have attempted the simplest changes to 'lulesh.chpl' in the benchmarks.
>
> After the 'param' definition of those symbolic constants at about line 117 of 
> 'lulesh.chpl', I add the following lines which initializes a 1D
> array of 1D arrays.
>
> var
>    bc_symm_free : [1..6] [1..3] real = // COMPILES PERFECTLY
>    [
>        [ 0x0f, ZETA_M_SYMM, ZETA_M_FREE ],
>        [ 0x33, ETA_M_SYMM, ETA_M_FREE ],
>        [ 0x99, XI_M_SYMM, XI_M_FREE ],
>        [ 0xf0, ZETA_P_SYMM, ZETA_P_FREE ],
>        [ 0xcc, ETA_P_SYMM, ZETA_P_FREE ],
>        [ 0x66, XI_P_SYMM, XI_P_FREE ]
>    ];
>
>
> When I compile lulesh all is cool and wonderful.
>
> If I change the declaration to, i.e.
>
>    bc_symm_free : [1..6, 1..3] real = // COMPILATION FAILS
>    [
>        [ 0x0f, ZETA_M_SYMM, ZETA_M_FREE ],
>        [ 0x33, ETA_M_SYMM, ETA_M_FREE ],
>        [ 0x99, XI_M_SYMM, XI_M_FREE ],
>        [ 0xf0, ZETA_P_SYMM, ZETA_P_FREE ],
>        [ 0xcc, ETA_P_SYMM, ZETA_P_FREE ],
>        [ 0x66, XI_P_SYMM, XI_P_FREE ]
>    ];
>
> because I want a 2D array, an attempt at compilation says
>
>       lulesh.chpl:120: error: rank mismatch in array assignment
>
> If I remove the initialization, there is no problem with the declaration of 
> the 2D array.
>
> What have I done wrong?
>
> If I write my own small example code with the same initialization code for 
> either the 1D array of 1D arrays, or the 2D array, that same syntax works 
> flawlessly for either case, as the example in my original email showed.
>
> I compile manually with
>
>       chpl -o lulesh-bad --fast -suseSpareMaterials lulesh.chpl
>
> Thanks - Damian
>
> Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
> Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
> Views & opinions here are mine and not those of any past or present employer
>

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to