| <html>
|
| <head>
|
| <title>shmem_collect</title>
|
| </head>
|
| <h2 id="top">shmem_collect</h2>
|
| <h4>Purpose</h4>
|
|
|
|
|
| <p>Concatenates blocks of data from multiple PEs to an array on every PEs in the active set.
|
| </p>
|
|
|
| <h4>C syntax</h4>
|
|
|
| <pre>
|
| #include <shmem.h>
|
|
|
| void shmem_collect(void *target, const void *source, size_t nlong, int PE_start, int logPE_stride, int PE_size, long *pSync);
|
|
|
| </pre>
|
|
|
| <h4>Parameters</h4>
|
|
|
|
|
| <dl>
|
| <dt class="bold">INPUT</dt>
|
| <dd>
|
| </dd>
|
| <dt class="bold ">target</dt>
|
| <dd>A symmetric data object array which will receive the broadcasted data. For shmem_collect, shmem_collect64, shmem_fcollect and shmem_fcollect64, the target can be any 64-bit data object. For shmem_collect32 and shmem_fcollect32 the target can be any 32-bit data object.
|
| </dd>
|
| <dt class="bold ">source</dt>
|
| <dd>A symmetric data object array which is the same type as the target.
|
| </dd>
|
| <dt class="bold ">nlong</dt>
|
| <dd>The number of elements in source array. For shmem_collect, shmem_collect64, shmem_fcollect and shmem_fcollect64, it is the number of 64-bit data items. For shmem_collect32 and shmem_fcollect32, it is the number of 32-bit data items.
|
| </dd>
|
| <dt class="bold ">PE_start</dt>
|
| <dd>The lowest virtual PE number of the active set of PEs.
|
| </dd>
|
| <dt class="bold ">logPE_stride</dt>
|
| <dd>The log (base 2) of the stride between consecutive virtual PE numbers in the active set.
|
| </dd>
|
| <dt class="bold ">PE_size</dt>
|
| <dd>The number of PEs in the active set.
|
| </dd>
|
| <dt class="bold ">pSync</dt>
|
| <dd>A symmetric work array. In C/C++, pSync must be of type long and size _SHMEM_REDUCE_SYNC_SIZE. Every element of this array must be initialized with the value _SHMEM_SYNC_VALUE before any of the PEs in the active set enters the reduction routine the first time.
|
| </dd>
|
| </dl>
|
|
|
| <h4>Description</h4>
|
|
|
| <div class="ledi">
|
| <p>The shmem_collect routine concatenates nlong 64- or 32-bit data items from the source arrays into the target arrays over the active set that is defined by PE_start, logPE_stride, and PE_size. The resultant target array contains the contribution from PE PE_start first, then the contribution from PE PE_start + (2^PE_stride) second, and so on.</p>
|
| <p>This function is a collective function, and must be called by all PEs in the active set defined by the PE_start, logPE_stride, and PE_size. On all PEs in the active set, the values of PE_root, PE_start, logPE_stride, and PE_size must be equal. And the same source, target, and pSync objects must be used on all PEs in the active set.
|
| The value of nlong must be the same in all participating PEs for fcollect functions, while collect functions allow nlong to vary from PE to PE. The performance of fcollect functions is much better than collect functions, since the same nlong is used on all participating PEs and there is no need to calculate the position of each contribution in the target array.</p>
|
| <p>Before any PE calls the collective functions, users have to ensure the following conditions exist:</p>
|
| <p>The pSync arrays on all PEs in the active set are not still in use from a prior call to a collective function.</p>
|
| <p>The target array on all PEs in the active set is ready to accept the broadcast data.</p>
|
|
|
| <p>Upon returning from the colletcive function, the following conditions are true:</p>
|
| <p>The target data array is updated.</p>
|
| <p>The values in the pSync array are restored to the original values.</p>
|
|
|
| <p>Each of these functions assumes that only PEs in the active set call the function. If a PE not in the active set calls the collective function, the behavior is undefined.</p>
|
|
|
|
|
| <h4>C examples</h4>
|
| <pre>
|
| </pre>
|
|
|
| <h4>Related information</h4>
|
|
|
| <p>Subroutines: shmem_broadcast, shmem_and, shmem_barrier, shmem_max, shmem_min, shmem_or, shmem_prod, shmem_sum, shmem_xor
|
| </p>
|
| <hr><a href="apiIndex.html">OpenSHMEM API Index</a> |
| </html> |