Skip to main content
Skip to main content
Version: 2.0 (Current)

API Reference

This reference covers the core GASNet-EX API functions used in PGAS runtime development. Use it as a quick lookup for signatures, parameters, and expected behavior.

Initialization and termination

gasnet_init

int gasnet_init(int \*argc, char \*\*\*argv);

Initialize the GASNet library. Must be called before any other GASNet functions.

Parameters

  • argc: Pointer to argument count (typically from main).
  • argv: Pointer to argument vector (typically from main).

Returns

GASNET_OK on success, error code on failure.

gasnet_attach

int gasnet_attach(gasnet_handlerentry_t \*table, int nentries, size_t segsize, uintptr_t minaddr);

Attach to the GASNet network and allocate the shared segment.

Parameters

  • table: Handler entry table (can be NULL if nentries == 0).
  • nentries: Number of handlers in table.
  • segsize: Requested shared segment size (0 for default).
  • minaddr: Minimum address for segment placement.

Returns

GASNET_OK on success.

gasnet_exit

void gasnet_exit(int exitcode) **attribute** ((noreturn));

Terminate the GASNet application and exit all nodes.

Parameters

  • exitcode: Process exit code to broadcast.

Returns

Does not return.

Node information

gasnet_mynode

int gasnet_mynode(void);

Return the calling node's ID.

Returns

Node ID in the range [0, gasnet_nodes() - 1].

gasnet_nodes

int gasnet_nodes(void);

Return the total number of nodes in the job.

Returns

Total node count.

Remote memory access (RMA)

gasnet_put

void gasnet_put(gasnet_node_t node, void *dst, void *src, size_t nbytes);

One-sided put operation. Copies nbytes from local src to remote dst on node.

Parameters

  • node: Target node ID.
  • dst: Destination address on remote node.
  • src: Source address on local node.
  • nbytes: Number of bytes to transfer.

Returns

Non-blocking initiation with local completion on return.

gasnet_get

void gasnet_get(void *dst, gasnet_node_t node, void *src, size_t nbytes);

One-sided get operation. Copies nbytes from remote src on node to local dst.

Parameters

  • dst: Destination address on local node.
  • node: Target node ID.
  • src: Source address on remote node.
  • nbytes: Number of bytes to transfer.

Returns

Blocks until the requested data arrives at dst.

Error handling

Most GASNet-EX calls return GASNET_OK on success. Capture and log error codes alongside job metadata so failures can be correlated with topology and runtime configuration.

Loading comments...