libsc  2.8.7
The SC library provides support for parallel scientific applications.
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Macros | Enumerations | Functions | Variables
sc_shmem.h File Reference
#include <sc.h>
Include dependency graph for sc_shmem.h:

Go to the source code of this file.

Macros

#define SC_SHMEM_ALLOC(t, e, c)   (t *) sc_shmem_malloc(sc_package_id,sizeof(t),e,c)
 
#define SC_SHMEM_FREE(a, c)   sc_shmem_free (sc_package_id,a,c)
 

Enumerations

enum  sc_shmem_type_t {
  SC_SHMEM_BASIC = 0 ,
  SC_SHMEM_PRESCAN ,
  SC_SHMEM_NUM_TYPES ,
  SC_SHMEM_NOT_SET
}
 

Functions

void sc_shmem_set_type (sc_MPI_Comm comm, sc_shmem_type_t type)
 Set the type of shared memory arrays to use on this mpi communicator. More...
 
sc_shmem_type_t sc_shmem_get_type (sc_MPI_Comm comm)
 Get the type of shared memory arrays to use on this mpi communicator. More...
 
void * sc_shmem_malloc (int package, size_t elem_size, size_t elem_count, sc_MPI_Comm comm)
 Allocate a shmem array: an array that is redundant on every process. More...
 
void sc_shmem_free (int package, void *array, sc_MPI_Comm comm)
 Destroy a shmem array created with sc_shmem_alloc() More...
 
int sc_shmem_write_start (void *array, sc_MPI_Comm comm)
 Start a write window for a shared array. More...
 
void sc_shmem_write_end (void *array, sc_MPI_Comm comm)
 End a write window for a shared array. More...
 
void sc_shmem_memcpy (void *destarray, void *srcarray, size_t bytes, sc_MPI_Comm comm)
 Copy a shmem array. More...
 
void sc_shmem_allgather (void *sendbuf, int sendcount, sc_MPI_Datatype sendtype, void *recvbuf, int recvcount, sc_MPI_Datatype recvtype, sc_MPI_Comm comm)
 Fill a shmem array with an allgather. More...
 
void sc_shmem_prefix (void *sendbuf, void *recvbuf, int count, sc_MPI_Datatype type, sc_MPI_Op op, sc_MPI_Comm comm)
 Fill a shmem array with an allgather of the prefix op over all processes. More...
 

Variables

const char * sc_shmem_type_to_string [SC_SHMEM_NUM_TYPES]
 
sc_shmem_type_t sc_shmem_default_type
 

Enumeration Type Documentation

◆ sc_shmem_type_t

Enumerator
SC_SHMEM_BASIC 

use allgathers, then sum to simulate scan

SC_SHMEM_PRESCAN 

mpi_scan, then allgather

Function Documentation

◆ sc_shmem_allgather()

void sc_shmem_allgather ( void *  sendbuf,
int  sendcount,
sc_MPI_Datatype  sendtype,
void *  recvbuf,
int  recvcount,
sc_MPI_Datatype  recvtype,
sc_MPI_Comm  comm 
)

Fill a shmem array with an allgather.

Parameters
[in]sendbufthe source from this process
[in]sendcountthe number of items to allgather
[in]sendtypethe type of items to allgather
[in,out]recvbufthe destination shmem array
[in]recvcountthe number of items to allgather
[in]recvtypethe type of items to allgather
[in]commthe mpi communicator

◆ sc_shmem_free()

void sc_shmem_free ( int  package,
void *  array,
sc_MPI_Comm  comm 
)

Destroy a shmem array created with sc_shmem_alloc()

Parameters
[in]packagepackage freeing memory
[in]arrayarray to be freed
[in]commthe mpi communicator

◆ sc_shmem_get_type()

sc_shmem_type_t sc_shmem_get_type ( sc_MPI_Comm  comm)

Get the type of shared memory arrays to use on this mpi communicator.

Parameters
[in]commthe mpi communicator
Returns
the type of shmem array used on this communicator.

◆ sc_shmem_malloc()

void* sc_shmem_malloc ( int  package,
size_t  elem_size,
size_t  elem_count,
sc_MPI_Comm  comm 
)

Allocate a shmem array: an array that is redundant on every process.

Parameters
[in]packagepackage requesting memory
[in]elem_sizethe size of each element in the array
[in]elem_countthe number of elements in the array
[in]commthe mpi communicator
Returns
a shared memory array

◆ sc_shmem_memcpy()

void sc_shmem_memcpy ( void *  destarray,
void *  srcarray,
size_t  bytes,
sc_MPI_Comm  comm 
)

Copy a shmem array.

Parameters
[out]destarrayarray to write to
[in]srcarrayarray to write from
[in]bytesnumber of bytes to write
[in]commthe mpi communicator

◆ sc_shmem_prefix()

void sc_shmem_prefix ( void *  sendbuf,
void *  recvbuf,
int  count,
sc_MPI_Datatype  type,
sc_MPI_Op  op,
sc_MPI_Comm  comm 
)

Fill a shmem array with an allgather of the prefix op over all processes.

The return array will be (0, send0, send0 op send1, send0 op send1 op send2, ...)

Note that the first entry of recvbuf will be set to 0 using memset: if this is not the desired value for the first entry of the array, the user can change it after calling sc_shmem_prefix.

Parameters
[in]sendbufthe source from this process
[in,out]recvbufthe destination shmem array
[in]countthe number of items to allgather
[in]typethe type of items to allgather
[in]opthe operation to prefix (e.g., sc_MPI_SUM)
[in]commthe mpi communicator

◆ sc_shmem_set_type()

void sc_shmem_set_type ( sc_MPI_Comm  comm,
sc_shmem_type_t  type 
)

Set the type of shared memory arrays to use on this mpi communicator.

Parameters
[in,out]commthe mpi communicator
[in]typethe type of shmem array behavior.

◆ sc_shmem_write_end()

void sc_shmem_write_end ( void *  array,
sc_MPI_Comm  comm 
)

End a write window for a shared array.

Parameters
[in]arrayarray that has changed
[in]commthe mpi communicator

◆ sc_shmem_write_start()

int sc_shmem_write_start ( void *  array,
sc_MPI_Comm  comm 
)

Start a write window for a shared array.

Parameters
[in]arrayarray that will be changed.
[in]commthe mpi communicator
Returns
1 if I have write access, 0 if my proc should not change the array.