## shmem_finalize

#### Purpose

Cleans up the resources that used by IBM openshmem library.

#### C syntax

    #include <shmem.h>

    void shmem_finalize(void);

#### Description

The shmem_finalize function cleans up the resources used by IBM openshmem library.

This function should be call only once at the end of main function. It is a blocking collective call. Internally, a shmem_barrier_all is called to ensure all communications prior the call are finished.

#### IBM NOTES

The calling of this function is optional. After the call to shmem_finalize, any IBM openshmem function call will not be valid, and the buffers allocated using shmalloc (or shrealloc) cannot be used anymore.

#### C examples

#### Related information

Subroutines: num_pes, my_pe, start_pes

OpenSHMEM API Index