UnorderedCopy¶
Usage
use UnorderedCopy;
Warning
This module represents work in progress. The API is unstable and likely to change over time.
This module provides an unordered version of copy/assign for numeric
types. The results from this function are not visible until task or forall
termination or an explicit unorderedCopyTaskFence()
, but it can
provide a significant speedup for bulk assignment operations that do not
require ordering of operations:
use BlockDist, UnorderedCopy;
const size = 10000;
const space = {0..size};
const D = space dmapped Block(space);
var A, reversedA: [D] int = D;
forall i in D do
unorderedCopy(reversedA[i], A[size-i]);
// no fence required, fenced at task/forall termination
forall (rA, i) in zip(reversedA, D) do
assert(rA == size-i);
It's important to be aware that unordered operations are not consistent with
regular operations and updates may not be visible until the task or forall
that issued them terminates or an explicit unorderedCopyTaskFence()
.
var a = 0;
on Locales[1] {
var b = 1;
unorderedCopy(b, a);
writeln(b); // can print 0 or 1
unorderedCopyTaskFence();
writeln(b); // must print 0
}
Generally speaking they are useful for when you have a large batch of remote assignments to perform and the order of those operations doesn't matter.
Note
Currently, this is only optimized for CHPL_COMM=ugni
. Other
communication layers fall back to regular operations. Under ugni, GETs are
internally buffered. When the buffers are flushed, the operations are
performed all at once. Cray Linux Environment (CLE) 5.2.UP04 or newer is
required for best performance. In our experience, buffered gets can
achieve up to a 5X performance improvement over non-buffered gets for CLE
5.2UP04 or newer.
-
proc
unorderedCopy
(ref dst: numeric, const ref src: numeric): void¶ Unordered copy. Only supported for identical numeric and bool types.
-
proc
unorderedCopy
(ref dst: bool(?), const ref src: bool(?)): void
-
proc
unorderedCopyTaskFence
(): void¶ Fence any pending unordered copies issued by the current task.
-
proc
unorderedCopyFence
(): void¶ Warning
This function has been deprecated - please use
unorderedCopyTaskFence()
instead. Note that this function has been deprecated without a full release of support because the previous global fence semantics imposed expensive implementation requirements and is not expected to be needed now that operations are implicitly fenced at task/forall termination.