## The `upc_affinitysize` function

#### Synopsis

        #include <upc.h>
        size_t upc_affinitysize(size_t totalsize,
                                size_t nbytes,
                                size_t threadid);

#### Description

The `upc_affinitysize` function is a convenience function which calculates the exact size of the local portion of the data in a shared object with affinity to `threadid`.

In the case of a dynamically allocated shared object, the `totalsize` argument shall be `nbytes*nblocks` and the `nbytes` argument shall be `nbytes`, where `nblocks` and `nbytes` are exactly as passed to `upc_global_alloc` or `upc_all_alloc` when the object was allocated.

In the case of a statically allocated shared object with declaration:

       shared [b] t d[s];

the `totalsize` argument shall be `s * sizeof(t)` and the `nbytes` argument shall be `b * sizeof(t)`. If the block size is indefinite, `nbytes` shall be 0.

`threadid` shall be a value in `0..(THREADS-1)`.

Terms, definitions, and symbols

Back to index of all UPC functions