> I understood that assignment of arrays is by value, like
> ArrayA = ArrayB
> makes A an independent copy of the array B taken that their domains 
> match, right?

Mostly right, though their domains need not match.  See "20.5 Array 
Assignment" in the language spec:

        http://chapel.cray.com/spec/spec-0.96.pdf

or [test/release/]examples/primers/arrays.chpl for a primer-based 
introduction.

> If I wanted A to reference to the B how should I write in 
> that case?

At present, see "20.9 Array Aliases" in the language spec.  This can also 
be done in a constructor context, as some examples within the 
BlockDist.chpl code demonstrate (search on "=>").

Longer-term, we'd like to support this as:

        ref A = B;

but it doesn't work as generally as we'd ultimately like.



> Also, what is the effect of writing
> DomainA = DomainB

See Section "19.8.1 Domain Assignment" in the language spec as well as the 
cross-reference to "20.11 Association of Arrays to Domains" (or, again, 
the arrays.chpl primer example).


> Would you expand a bit on this? Namely, where should I stop the timer,

It all depends on what you want to time.  Given a loop of the form:

        coforall loc in MyLocs {
          on loc do {
            ... do some work on that locale ...
          }
        }

I'd imagine you'd probably want to do this:

        coforall loc in MyLocs {
          on loc do {
            // start timer
            ... do some work on that locale ...
            // stop timer
          }
        }

to time the work done by each locale.  See "32.2.7 Time" in the language 
spec for information on the timing routines we provide, or 
[test/release/]examples/primers/timers.chpl in the source tree for a 
code-based primer.


> and how should I return the gathered information to the user?

I don't have any particular vision here. The forall loops don't have any 
interface for returning timings to the callsite, so you'd presumably need 
to tuck this information away into your classes and then support a query 
into the classes to retrieve it (or else print it out to the console).

Today, to call a method on one of the classes implementing your 
domain/array value, you'd use:

        myDom._value.mySpecialDomainMethod()

or:

        myArr._value.mySpecialArrayMethod()


> Also I'd like to be able to turn the timings on/off during runtime, how 
> should I pass this argument?

You could either make a config const that would control it for all 
instantitations of your domain map, or make it an argument to the domain 
map itself and set it on a per domain map basis.  We don't support 
optional constructor arguments to domains/arrays at present outside of the 
domain map, though you could use the same ._value-based backdoor in the 
previous paragraph to set/reset a value dynamically if you wanted.

-Brad


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to