Files
2017-10-26 19:57:24 +02:00

120 lines
3.8 KiB
C
Executable File

#ifndef MOC_DATA_TRANSFER_PPU_H_
#define MOC_DATA_TRANSFER_PPU_H_
#include <stdint.h>
#include "../moc.h"
#include "moc_datatype_ppu.h"
/**
* \addtogroup dma_access
**/
//@{
/**
* @name PPU-only
**/
//@{
/**
* Wrapper-function for a blocking DMA-get operation.
* Data can be of any size, constraints of low-level DMA-functions
* are dealt by this function.
* However data-addresses have to be at least 16-byte aligned.
*
* @param target \b out pointer to buffer
* @param source \b in local-store address of data
* @param count \b in size of data in byte
* @param datatype \b in Type of Elements
* @param dest \b in rank of source spe
* @retval MOC_SUCCESS No error; MPI routine completed successfully.
* @retval ... error-code
**/
int MOC_Get_data(void* target, uint32_t source, int count,
MOC_Datatype datatype, int dest);
/**
* Wrapper-function for a blocking DMA-put operation.
* Data-size should be a multiple of 16 because of low-level constraints, but
* there is no upper limit of transfer-size.
* Data-addresses have to be at least 16-byte aligned.
*
* @param source \b in pointer to data
* @param target \b in local-store address of buffer
* @param count \b in size of data in byte
* @param datatype \b in Type of Elements
* @param src \b in rank of source-SPE
* @retval MOC_SUCCESS No error; MPI routine completed successfully.
* @retval ... error-code
**/
int MOC_Put_data(void* source, uint32_t target, int count,
MOC_Datatype datatype, int src);
/**
* Wrapper-function for a non-blocking DMA-get operation.
* Data can be of any size, constraints of low-level DMA-functions
* are dealt by this function.
* However data-addresses have to be at least 16-byte aligned.
* Operation-completion can be derived with MOC_Test and MOC_Wait.
*
* @param target \b out pointer to buffer
* @param source \b in local-store address of data
* @param count \b in size of data in byte
* @param datatype \b in Type of Elements
* @param dest \b in rank of source spe
* @param request \b out communication request (handle)
* @retval MOC_SUCCESS No error; MPI routine completed successfully.
* @retval ... error-code
**/
int MOC_IGet_data(void* target, uint32_t source, int count,
MOC_Datatype datatype, int dest, MOC_Request *request);
/**
* Wrapper-function for a non-blocking DMA-put operation.
* Data-size should be a multiple of 16 because of low-level constraints, but
* there is no upper limit of transfer-size.
* Data-addresses have to be at least 16-byte aligned.
* Operation-completion can be derived with MOC_Test and MOC_Wait.
*
* @param source \b in pointer to data
* @param target \b in local-store address of buffer
* @param count \b in size of data in byte
* @param datatype \b in Type of Elements
* @param src \b in rank of source-SPE
* @param request \b out communication request (handle)
* @retval MOC_SUCCESS No error; MPI routine completed successfully.
* @retval ... error-code
**/
int MOC_IPut_data(void* source, uint32_t target, int count,
MOC_Datatype datatype, int src, MOC_Request *request);
/**
* Translates an effective-address of a SPU into the corresponding local-store address.
*
* @param ea \b in effective-address
* @param rank \b in rank of SPU
* @param ls \b out local-store address
**/
int MOC_Translate_EA_to_LS(uint64_t ea, int rank, uint32_t* ls);
//@}
/**
* Waits till a MOC_IGet_data or IMOC_IPut_data is completed.
*
* @param request \b in request-handle
* @return 0 when success otherwise error-code
**/
int MOC_Wait_data(MOC_Request* request);
/**
* Tests if a MOC_IGet_data or IMOC_IPut_data is completed.
*
* @param request \b in request-handle
* @param flag \b out true if operation is completed
* @return 0 when success otherwise error-code
**/
int MOC_Test_data(MOC_Request* request, int *flag);
//@}
#endif /*MOC_DATA_TRANSFER_PPU_H_*/