Committing John Lewis' final version of PTRANS

This is the version of PTRANS that John wrote to use a Block
distribution just prior to leaving Cray.  He used the Block
distribution not because it's ideal, but as a stand-in for the
not-yet-complete Block-Cyclic distribution.  This commit only has very
minor commits to his version, to remove tabs, update the 'def'
keyword, add a flag for turning off performance timings, turn down the
problem size for testing purposes, and remove an extraneous forall
loop from the 'arbitrary beta' variations.

In its current form, only the beta = 1.0 version is tested.  Ideally,
it would be nice to test beta = 0.0, 1.0 and other, but I haven't
taken that step yet.



git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18377 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Two minor improvements to John's original PTRANS code:

1) changed indices from int(64) to default (currently int(32), which
   should be sufficient for dense 2D arrays);

2) moved repeated verification code out to a helper procedure.




git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18378 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Committing my recent changes to Block-Cyclic distribution

This change commits my recent changes to the Block-Cyclic distribution
and related changes to existing tests:

* renamed targetLocales array to targetLocs to match other distributions
  like Block

* made constructor do a better job of inferring rank and idxType from
  input arguments, as with other distributions like Block

* renamed constructor arguments to clarify use:
  - low -> startIdx
  - blk -> blocksize

* implemented dsiDims() routine

* removed use of uint(64)s as the index type of the linear data buffer
  for the time being to keep code simpler, under the argument that we
  probably won't need the full resolution of a uint(64) in most cases
  (should revisit later once everything is working well)

* added a dsiReindex() placeholder but didn't implement it yet




git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18379 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Oops, this should have gone in with the last commit



git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18380 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Adding a Block-Cyclic version of John's PTRANS code

ptrans_2011-blkcyc.chpl is a variation of ptrans_2011.chpl that uses a
Block-Cyclic distribution instead of a Block distribution.
Ultimately, the Block version can be retired, but for now it is a
useful means of testing rewrites to the code when using features that
Block-Cyclic does not yet support.

Also did some cleanup in the Block version to make the diffs between
the two versions minimal.

Dialed the number of locales down to 3 simply to reduce execution time
when using a single machine (yet still test a case that isn't a
perfect square which is why I originally chose 6; 2 would also fulfill
this but seemed slightly less interesting).



git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18381 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Make the threading layer responsible for maintaining thread counts.

The tasking layer has been responsible for maintaining a count of the
number of threads in existence, and not creating more threads than we
are supposed to.  Move this responsibility into the threading layer.
This involves creating four new functions in the threading layer:
  threadlayer_can_start_thread()
  threadlayer_thread_destroy()
  threadlayer_get_max_threads()
  threadlayer_get_num_threads()

(Strictly speaking threadlayer_destroy() isn't necessary here, but I
added it anyway, for symmetry and to match up with the needs of tasking
layers other than the FIFO one.)

I also augmented the existing threadlayer_init() to take the maximum
number of threads per locale, in addition to its existing call stack
size argument.


git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18382 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Remove a function that is no longer used.


git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18383 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Major revision of data structures for coarse-fine data transfer.

git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18384 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Now without TAB characters.


git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18385 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
More adequate reflection of the current Chapel keywords:
no 'def'
yes 'iter', 'proc'
'index' is a keyword
'this' is not a keyword


git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18386 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Switched to contiguous arabic page numbering.

(Not sure what the right way is. Just commenting out all (three)
\pagenumbering directives seems to work. Perhaps arabic is the
default page numbering scheme.)


git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18387 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Minor updates on our spec conventions
following our recent spec reviews.


git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18388 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
* Made explicit and/or defined the following concepts:
 - "function" (as the union of procedures and iterators)
 - "formal", "actual", "call site"
 - "operator", "method" as subsets of "function"
 - "receiver" (the 'this' argument)

Note: we can change the words we use to denote these concepts, as desired.
"Function" has been the de-facto name for the procs+iters concept
in the current spec already, I let it be.

* Renamed the "Functions" chapter to "Procedures" because that's what
it focuses on. (Even though much of it applies to all "functions" as well,
as suggested by Brad.)

Rewrote the overview and added a roadmap (in Vass's new preferred format).

* Replaced 'function' with 'procedure' in the Procedures (former
Functions) chapter when appropriate.

There were a few borderline cases, e.g. "type functions" and
"param functions", and I mostly left them "functions".
(The above two are borderline because we intend to allow them, but at
present they are "unsupported", as per an "openissue" clause.)

I left "function" in "function calls" mostly as-is -- because these are
the same for procs and iters (except *how* those calls are used).

* Clarified the blank intent to correspond to what's presently implemented
in the compiler.

* Almost introduced "copy constructor" for 'in' parameter passing.
But chickened out at the last moment, especially because I had
called it "assignment operator". (Seriously, need group approval and details
- I don't think we define it anywhere in the spec.)

* Switched the order of Nested Functions and Overloading sections
moving the Nested Functions closer to other declaration-related sections
and Overloading next to Function Resolution.

* Restructured some of the Classes chapter to follow our
"define the types then define the values" guideline.

* Removed the "Class Variable Declarations" because it did not
add any information.

* Lifted "The 'this' method" and "The 'these' method" out from
the "Method Calls" sections of Classes and Records.

* Changes to the syntax rules:

 - member-access-expression is now
   a field-access-expression or method-call-expression

 - function-declaration-statement -->  procedure-declaration-statement

 - defined method-call-expression

* Added a few index entries. Some of them could be renamed
function->procedure.

* Rephrased a few pieces.

* Filled in some other gaps.

* Added some TODO notes.


git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18389 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
More spec changes, minor this time.

* Toned down the uses of "function" in the Iterators chapter.

* Fixed a bug in method syntax.

* More index entries.

* Replaced var-param-type-clause[OPT] with return-intent[OPT] return-type[OPT].
(Curiously, this is the change - which I wanted for my "intents" proposal -
that triggered all the other changes in this and the previous commit.)


git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18390 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
This checkin provides the initial implementation for ranges with an explicit 
alignment field.  Successive slices of a 3-strided array can thus be represented
as (for example):
0..10 by 3
0..10 by 3 align 1
0..10 by 3 align 2
This ought to simplify the coding of several distributions, since only the
alignment need be manipulated to visit all of the elements in a domain.

This is a preliminary version, because a discussion of the desired semantics is
still pending.  After I started coding, I decided that it would be good to have
alignments be relative to the low bound (if present), otherwise the high bound
(if present), otherwise absolute.  

Brad's initial recommendation was to have the alignment be absolute in all
cases.  But then there is a significant difference between a range whose
alignment is unassigned (and zero by default) vs. one whose alignment is
explicitly set to zero.  In an unaligned range, we would have to update the
alignment value each time the low bound is updated, or sprinkle many more tests
of the "aligned" param throughout the code to handle those cases separately.

At present, there is only one place in the code where we test the "aligned"
param.  I am hoping that choosing default values more carefully and making one
more pass through the code will enable me to get rid of that param entirely
(back down to 3).  To cut down on the number of cases and to get consistent
return value types, I am tying stridable and aligned together in much of the
domain code anyway.  If I never have to test whether a range has been explicitly
aligned, then "aligned" can go away.

M      test/types/seq/deitz/test_aseq4.good
M      test/types/range/deitz/test_range_index3.good
The definition of a negative stride applied to a bounded range has changed.
Unaligned ranges are effectively aligned to _low + 0, so we still use the low
bound for alignment when applying a negative stride to a bounded range.
This point can be argued, but that's how I have it for now.





M      spec/Ranges.tex
Added an explanation of how alignment works.
Added a subsection discussing the align operator.

M      compiler/parser/chapel.lex
M      compiler/parser/chapel.ypp
Added the "align" keyword and the production: expr TALIGN expr.

M      modules/dists/CyclicDist.chpl
Renamed mod as chpl__mod.  Use chpl__diffMod to compute an aligned bound.
506: Made alignedness track stridability.

M      modules/dists/BlockDist.chpl
Made alignedness track stridability.

M      modules/internal/ChapelArray.chpl
Made alignedness track stridability.

M      modules/internal/ChapelRange.chpl
Don't even try to diff these two.  I rearranged routines in a logical order
while going through and adding alignment.

M      modules/internal/DefaultRectangular.chpl
Made alignedness follow stridability.  Added type parameters where needed.

M      test/param/diten/paramForHuge.good
Added a parameter for aligned.

M      test/arrays/deitz/part3/test_slice_stride3.chpl
M      test/arrays/deitz/part3/test_slice_stride3.good
Added linefeeds to the output, for readability.

M      test/arrays/bradc/inferArrayType.chpl
Fix typo.

M      test/distributions/diten/Cyclic.chpl
Added some debug statements.

M      test/distributions/diten/testCyclic.good
Range offsets chaned to alignments in the output.

M      test/distributions/diten/Dimensional.good
M      test/distributions/robust/arithmetic/trivial/test_dot_expand.good
M      test/ranges/bradc/bigStride.good
M      test/ranges/bradc/mixSliceType.good
M      test/domains/shannon/expandOverload.good
M      test/domains/shannon/expand3Dtuple.good
M      test/domains/shannon/expand3D.good
M      test/domains/sungeun/rect/expand.good
M      test/domains/bradc/slices/sliceStridedDomain.good
M      test/types/range/deitz/test_range_index.good
M      test/types/range/diten/rangeSlice.good
M      test/types/range/claridge/expand_strided_range.good
M      test/types/range/bradc/strideRangeSlice2.good
Alignments now appear in the output.

M      test/ranges/bradc/needAlignment/wantsAlignment.chpl
M      test/ranges/bradc/needAlignment/wantsAlignment.good
D      test/ranges/bradc/needAlignment/wantsAlignment.future
Changed output format; enabled this test.

M      test/ranges/bradc/needAlignment/alignedOp.chpl
M      test/ranges/bradc/needAlignment/alignedOp.good
M      test/ranges/bradc/needAlignment/alignedOp.future
Renamed "aligned" as "align".

M      test/ranges/bradc/needAlignment/alignedOp2.chpl
M      test/ranges/bradc/needAlignment/alignedOp2.good
D      test/ranges/bradc/needAlignment/alignedOp2.future
Renamed "aligned" as "align" and enabled this test.

M      test/studies/amr/lib/grid/Grid_def.chpl
Forced strided ranges to be aligned as well (to get return type right).

M      test/classes/hilde/explainInstantiation.good
Call site shifted.

M      test/classes/bradc/overloadMethods/v4oneClassReturnNoMatch.good
M      test/classes/bradc/overloadMethods/v5bothReturnTypes.good
M      test/types/type_variables/deitz/test_query_field11.good
Range types in diagnostic messages now contain an "aligned" boolean.

M      test/types/range/diten/badRange2.good
Formatting.

M      test/types/range/claridge/strided_range_constructor.chpl
Updated constructor call. (signature changed)



git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18391 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Squash tabs.



git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18394 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
REGRESSIONS updates from the weekend and past few days:

these ones are plausibly due to range changes:
- new generated code compiling warnings for XMT and Cray compilers:
  loop not reachable
- a bunch of failures in cyclic distribution testing
- fast on optimization not firing for 4 GASNet tests
- wrong answer on 4 GASNet tests

failures, probably due to test runs overlapping:
- 7 --no-local regressions

"normal" nondet. regressions:
- valgrind "impossible has happened"
- taskParallel --no-local failure
- lost updates on test_OptimizedOn_Block*
- hello timeout on xmt



git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18395 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Minor comment and error message fixes.


git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18396 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Clarify some variable names and clean up a bit.

Mainly this renames some of the counters in order to clarify what
precisely it is that they count:
  queued_cnt  -> queued_task_cnt
  running_cnt -> running_task_cnt
  idle_cnt    -> idle_thread_cnt
  waking_cnt  -> waking_thread_cnt

It also makes running_task_cnt include the main task so that we don't
have to adjust for it manually, gets rid of an unused variable, fixes a
typo in the header comment for get_current_ptask(), removes a couple of
incorrect comments, and removes some extraneous blanks at the ends of
lines.


git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18397 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Standardize thread identifiers.

Standardize thread identifiers to be negative 64-bit integers.  This
doesn't seem overly restrictive and, should tasking layers standardize
on positive 64-bit integers, will allow distinguishing between task and
thread identifiers in debug output and in other circumstances.

As a side effect of this change, remove the threadlayer_thread_create()
capability to return the new thread's identifier.  That was no longer
being used anyway.


git-svn-id: http://svn.code.sf.net/p/chapel/code/trunk@18399 3a8e244f-b0f2-452b-bcba-4c88e055c3ca