Disable futures for cygwin

Cygwin testing takes a while and it doesn't seem to be much benefit of running
futures on cygwin.
First try at .good files to make dist-replicated pass.
Get rid of warnings about non-literal printf() format strings on darwin.

On darwin we get warnings from the gen compiler about non-literal
printf() format strings in these three tests, causing them to fail.
Resolve these warnings as follows:

test/extern/hilde/namedExtern.chpl
  We declare printf() such that the fmt argument is implicitly typed
  by the corresponding actual argument.  That actual arg is a literal
  string, but of type Chapel string.  The compiler emits code to
  convert it to a c_string for the call to the extern printf(), but
  this ends up making the actual a variable in the emitted code.
  Change the printf() declaration(s) so that the fmt argument is
  explicitly a c_string.  This makes the compiler emit the literal as
  a c_string in the first place, and we don't get conversion code or
  the resulting variable.

test/io/vass/time-write.chpl
  In this case we actually do need to be able to printf() non-literal
  strings.  As the code stands we send these as the first (format)
  argument to printf().  Since we need to prnt non-literal strings,
  change the calls (and declarations) so that we use a "%s" format and
  pass the c_string to print as the second argument.  Arguably this
  adds a slight amount of overhead to the printf() call and thus
  changes the test.  If this is a problem we'll need to discuss the
  point of the test, in particular whether it is testing printf()
  performance or the performance of the C buffered I/O FILE interface.
  If the latter, we could call puts() here instead of printf().

test/studies/pidigits/bbp/nomem32.chpl
  This has the same problem as namedExtern, above.  The printf("\t")
  here is the only printf() call in the program.  Everywhere else we
  use Chapel write.  Convert the printf() to a write().
Avoid relying on qthreads syscall interception for chpl_task_sleep

chpl_task_sleep() was previously just a call to sleep(). This system call is
supposed to be intercepted by qthreads, and qthreads will perform
qthread_yields until the specified sleep time is up. If that doesn't happen
sleep, would cause the entire worker to sleep, preventing other tasks on the
same worker from running.

The system call interception does not seem to be working on darwin currently.
As a result any test with sleep() in it fails on darwin.  We're working with
the qthreads team to figure out what's going on but in the meantime (and
possibly longer term) we will just perform what the syscall interception is
supposed to do directly.
Add classes/figueroa/RecordConstructor2.skipif

This test arguably works correctly in both configurations, even though its output differs
when run with the --baseline option compared to when run without it.  That is because
--baseline disables the removeUnnecessaryAutoCopyCalls() optimization.  The compiler may
add or remove autoCopy calls at will, so the user should not write code that depends upon
its having run (except as needed for memory management reasons).

In this test, running autoCopy has a side-effect (setting the contents of the record to
2).  The autoCopy function does this because every constructor implicitly calls the
initialize() function, and that is what is done by the initialize() function for this
record type.

The compiler could do a better job of aligning --baseline vs. optimized behavior by
inserting fewer autoCopy calls to begin with.  Also, the fact that the compiler-generated
autoCopy calls initialize is quite hidden.
Reduced the problem size for test_array_slicing3
to avoid timeouts during nightly testing.
Merge pull request #727 from gbtitus/darwin-non-literal-format

Get rid of warnings about non-literal printf() format strings on darwin.

On darwin we get warnings from the gen compiler about non-literal
printf() format strings in these three tests, causing them to fail.
Resolve these warnings as follows:

test/extern/hilde/namedExtern.chpl
We declare printf() such that the fmt argument is implicitly typed
by the corresponding actual argument. That actual arg is a literal
string, but of type Chapel string. The compiler emits code to
convert it to a c_string for the call to the extern printf(), but
this ends up making the actual a variable in the emitted code.
Change the printf() declaration(s) so that the fmt argument is
explicitly a c_string. This makes the compiler emit the literal as
a c_string in the first place, and we don't get conversion code or
the resulting variable.

test/io/vass/time-write.chpl
In this case we actually do need to be able to printf() non-literal
strings. As the code stands we send these as the first (format)
argument to printf(). Since we need to print non-literal strings,
change the calls (and declarations) so that we use a "%s" format and
pass the c_string to print as the second argument. Arguably this
adds a slight amount of overhead to the printf() call and thus
changes the test. If this is a problem we'll need to discuss the
point of the test, in particular whether it is testing printf()
performance or the performance of the C buffered I/O FILE interface.
If the latter, we could call puts() here instead of printf().

test/studies/pidigits/bbp/nomem32.chpl
This has the same problem as namedExtern, above. The printf("\t")
here is the only printf() call in the program. Everywhere else we
use Chapel write. Convert the printf() to a write().
Bump timeout for gasnet+qthreads testing on low core count machines

On low core count machines like the linux32 box, lnx-diten, and lnx-vass we
still have some timeouts with gasnet+qthreads even when built with
oversubscription on and affinity off. The reason we see it on these machines
but not for regular gasnet testing is just because these machines have a lower
core count.

This increase in timeout does NOT reflect true performance issues with
qthreads, but merely the fact that qthreads wasn't designed to run in an
oversubscribed manner. Qthreads expects that it owns the whole machine. With
oversubscription on, amongst other things, busy loops turn into loops with
sched_yield in them. While this yields the processor, the qthread is not
yielded and so there are still situations where it takes much longer to get
work done because qtheads doesn't own the whole machine, but fundamentally
assumes it does.

Increasing the timeout is a stop-gap to quiet nightly testing until I figure
out a better solution, or we start doing gasnet testing on real hardware.

I tried a few things to get rid of timeouts with little success including
modifications to qthreads source, and limiting CHPL_RT_NUM_THREADS_PER_LOCALE
to numCores/numLocales. Limiting the number of threads doesn't help on low core
count machines because you get 1 thread per locale, which is equally as slow as
the contention in most cases.

I can look for a better solution as a background test, but this will quiet
testing in the meantime.
Merge pull request #732 from hildeth/quietRecordConstructor2

Add classes/figueroa/RecordConstructor2.skipif



This test arguably works correctly in both configurations, even though its output differs
when run with the --baseline option compared to when run without it. That is because
--baseline disables the removeUnnecessaryAutoCopyCalls() optimization. The compiler may
add or remove autoCopy calls at will, so the user should not write code that depends upon
its having run (except as needed for memory management reasons).

In this test, running autoCopy has a side-effect (setting the contents of the record to
2). The autoCopy function does this because every constructor implicitly calls the
initialize() function, and that is what is done by the initialize() function for this
record type.

The compiler could do a better job of aligning --baseline vs. optimized behavior by
inserting fewer autoCopy calls to begin with. Also, the fact that the compiler-generated
autoCopy calls initialize is quite hidden.
Merge pull request #730 from ronawho/qthreads-sleep-on-darwin

Avoid relying on qthreads syscall interception for chpl_task_sleep

[reviewed by @gbtitus]

chpl_task_sleep() was previously just a call to sleep(). This system call is
supposed to be intercepted by qthreads, and qthreads will perform
qthread_yields until the specified sleep time is up. If that doesn't happen
sleep, would cause the entire worker to sleep, preventing other tasks on the
same worker from running.

The system call interception does not seem to be working on darwin currently.
As a result any test with sleep() in it fails on darwin. We're working with
the qthreads team to figure out what's going on but in the meantime (and
possibly longer term) we will just perform what the syscall interception is
supposed to do directly.
Merge pull request #729 from ronawho/qthreads-gasnet-timeouts

Bump timeout for gasnet+qthreads testing

[ok'd by @gbtitus]

On low core count machines like the linux32 box, lnx-diten, and lnx-vass we
still have some timeouts with gasnet+qthreads even when built with
oversubscription on and affinity off. The reason we see it on these machines
but not for regular gasnet testing is just because these machines have a lower
core count.

This increase in timeout does NOT reflect true performance issues with
qthreads, but merely the fact that qthreads wasn't designed to run in an
oversubscribed manner. Qthreads expects that it owns the whole machine. With
oversubscription on, amongst other things, busy loops turn into loops with
sched_yield in them. While this yields the processor, the qthread is not
yielded and so there are still situations where it takes much longer to get
work done because qtheads doesn't own the whole machine, but fundamentally
assumes it does.

Increasing the timeout is a stop-gap to quiet nightly testing until I figure
out a better solution, or we start doing gasnet testing on real hardware.

I tried a few things to get rid of timeouts with little success including
modifications to qthreads source, and limiting CHPL_RT_NUM_THREADS_PER_LOCALE
to numCores/numLocales. Limiting the number of threads doesn't help on low core
count machines because you get 1 thread per locale, which is equally as slow as
the contention in most cases.

I can look for a better solution as a background test, but this will quiet
testing in the meantime.
Added to .gitignore and CLEANFILES.
Fix static_dynamic for intel compiler

It turns out that -Bstatic fails to find a static library in one case and
causes compilation to fail.  The correct combination to ensure complete and
static compilation is -static-intel -static-libgcc -static.  These tests should
now pass (phew!).
Have serial tasks directly execute the function for qthreads

Previously, serial task creation spawned a new task, and the original task
would wait for that task to complete. We believe the original motivation for
this is from the days when qthreads had a lower stack size. If you have
recursive serial tasks being created you're going to run out of stack pretty
quickly.

This was changed with the qthreads commit 82a0224513ec

With our current default stack size of 8MB you end up wasting a lot of memory
because you're creating a task for each serialized task. For schedulers that
have more than one worker per shepeherd you can also schedule the serial task
on a different core, which can cause you to lose some cache and can result in
slowdown because many qthreads are constantly yielding waiting for one to
finish.
Merge pull request #734 from lydia-duncan/fixStaticDynamicTest

Fix static_dynamic for intel compiler

It turns out that -Bstatic fails to find a static library in one case and
causes compilation to fail. The correct combination to ensure complete and
static compilation is -static-intel -static-libgcc -static. These tests should
now pass (phew!).
Move the failure mode of externFloat4calls.someFields.chpl to a future and
disable the mode it fails here.

I copied this test to a separate file so that it could be futurized without
losing the accurate results produced under other circumstances.

Throwing --no-remove-copy-calls causes this test to lose information for extern
record fields not named within Chapel, as an autoCopy does not know to copy that
information over.  The new future always throws this flag, to ensure the failure
mode is visible.
Merged chapel-lang/master
Merge pull request #733 from ronawho/qthreads-serialized-task-creation

Have serial tasks directly execute the function for qthreads

[reviewed by @gbtitus]

Previously, serial task creation spawned a new task, and the original task
would wait for that task to complete. We believe the original motivation for
this is from the days when qthreads had a lower stack size. If you have
recursive serial tasks being created you're going to run out of stack pretty
quickly.

This was changed with the qthreads commit 82a0224513ec

With our current default stack size of 8MB you end up wasting a lot of memory
because you're creating a task for each serialized task. For schedulers that
have more than one worker per shepeherd you can also schedule the serial task
on a different core, which can cause you to lose some cache and can result in
slowdown because many qthreads are constantly yielding waiting for one to
finish.
Merge pull request #735 from lydia-duncan/silenceBaselineFailure

Move the failure mode of externFloat4calls.someFields.chpl to a future
and disable the mode under which it fails here.

I copied this test to a separate file so that it could be futurized without
losing the accurate results produced under other circumstances.

Throwing --no-remove-copy-calls causes this test to lose information for extern
record fields not named within Chapel, as an autoCopy does not know to copy that
information over. The new future always throws this flag, to ensure the failure
mode is visible.
Merge pull request #736 from vasslitvinov/fix-replicated-dist-testing

Fixed failures in dist-replicated nightly testing.

As of today, we have 60 failures in dist-replicated nightly testing.
With these changes, there should be none.
Most of the changes are:

* Created separate .good files for testing with replicated.
  Checked their correctness.

  Given that the replicated distribution is different by nature
  from the others, we chose this instead of trying to make
  the tests behave the same as for other distributions.

* Provided PREDIFFs to dispatch among .good.
  Augmented CLEANFILES and .gitignore.

* Skipif-ed several tests for replicated.

* Modified a test to account for replication.

* Reduced the problem size for a test to avoid timeout.

Details below.


Note: testing, e.g.

  start_test -compopts -sdistType=DistType.replicated ...

will fail if run under comm=none. That's because
.replicated.good are specific to the number of locales.


Aside: a common pattern in a lot of tests results in this:

  var Dom1D = {1..100} dmapped Replicated();
  var AA1d: [Dom1D] real;
  for i in Dom1D do
    ...AA1d[i]...;

  // same for 2d, 3d, etc.

When run e.g. on 4 locales, it is equivalent to this loop:

  for i in 1..100 do
    ...AA1d[i]...;

performed *4 times*. Each time it accesses the same local
replicand of AA1d.

This is not very intuitive and can be used as an argument to change
the behavior of Replicated.


DETAILS

* Added

  distributions/robust/arithmetic/PREDIFF

derived from distributions/robust/arithmetic/performance/multilocale/PREDIFF.

For a given test, it fires only when .default.good exists.
If so, it checks which .good is pertinent - .replicated, .block, ... -
and copies that one - or .default.good if that one does not exist -
into .good.

* a PREDIFF in a subdirectory of distributions/robust/arithmetic
invokes the above prediff. I chose that over a symlink to make
the failure more obvious.


* For each test that exhibits non-standard behavior of Replicated,
I moved .good into .default.good and created .replicated.good.
NB .replicated.good is sensitive to the number of locales.

I also added .good to CLEANFILES and .gitignore.

The behavioral differences are discussed in the thread re
"Cron Dist replicated (linux64.gnu.gasnet.fifo.flat) 60/0/60"
on the internal mailing list in mid-february 2014.
In summary:

 - domains and arrays print out differently
 - parallel and serial iterations go over each index multiple times,
   once for each locale
 - therefore things like reductions and 'for a in A do a=next();'
   behave differently too


* For each of the above tests, .replicated.good came from the current
test behavior. For each, I checked, sometimes thoroughly sometimes not,
whether that behavior is correct. For a couple of tests I wrote a test
that mimicks the behavior using DefaultRectangular.

The following tests are exceptions - no checking for correctness,
except the first part of Random:

  modules/test_module_Random
  modules/test_module_Norm
  performance/multilocale/assignSlice.chpl


* These tests already had .replicated.good. They were failing
because they had a significant reduction in fork counts.
I did not investigate, just updated .replicated.good:

  performance/multilocale/assignSlice
  performance/multilocale/reduceAlias
  performance/multilocale/reduceSlice
  performance/multilocale/assignAlias
  performance/multilocale/alloc


* Added a skipif for replicated for the following tests:

 - output is nondeterministic under Replicated:

  basics/test_zipper_default
  basics/test_zipper_range

 - the expected optimization does not fire under Replicated;
   a todo is to check whether that is OK:

  optimizations/optimizeOnClauses_basic_record
  optimizations/optimizeOnClauses_basic_tuple
  optimizations/optimizeOnClauses_basic

 - MergeSort gets into "zippered iterations have non-equal lengths"
   which seems correct based on how MergeSort si written:

  modules/test_module_Sort

 - This test crashes under Replicated. I skipif-ed it and created
   a separate trimmed-down future (#706) distributions/dm/hplx.chpl:

  kernels/hpl


* Modified this test to account for replication when present:

  stress/test_many_domains


* Reduced the domain sizes to avoid timeout:

  slicing/test_array_slicing3

This test creates lots of array slices, which is slow for privatized
distributions such as Cyclic and Replicated. The new (rather small)
sizes make the test run, under Replicated and on the machine that
tests it nightly, in ~70 seconds.


* While there, clarified instructions on running the robustness suite
in distributions/robust/arithmetic/README.


Reviewed by Tom.