130 lines
3.0 KiB
C
Executable File
130 lines
3.0 KiB
C
Executable File
#ifndef MOC_H_PPU
|
|
#define MOC_H_PPU
|
|
|
|
|
|
#include "moc_dma_ppu.h"
|
|
#include "moc_datatype_ppu.h"
|
|
#include "../moc.h"
|
|
|
|
#include <stdint.h>
|
|
#include <libspe2.h>
|
|
|
|
|
|
|
|
/**
|
|
* Maximum number of possible SPU-threads.
|
|
**/
|
|
#define MOC_SPU_THREAD_MAX 16
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* \addtogroup environment_startup
|
|
**/
|
|
//@{
|
|
/**
|
|
* @name PPU-only
|
|
**/
|
|
//@{
|
|
|
|
/**
|
|
* Returns the number of available SPUs.
|
|
*
|
|
* \attention PPU-only
|
|
*
|
|
* \note Must be called before \ref MOC_Init
|
|
*
|
|
* \note This function should return the count of free SPUs. But this
|
|
* doesn't really works. To get the available SPU-count the
|
|
* function spe_cpu_info_get() from libspe2 with
|
|
* SPE_COUNT_USABLE_SPES-flag is used. However this function can only
|
|
* detect if a SPU-thread is used by the calling function. There seems
|
|
* to be no means to detect SPU-thread used by other applications.
|
|
*
|
|
*
|
|
* \param count \b out number of available SPUs
|
|
* \retval MOC_SUCCESS No error; MPI routine completed successfully.
|
|
* \retval ... error-code
|
|
**/
|
|
int MOC_Get_avail_spu_count(int* count);
|
|
|
|
/**
|
|
* Returns the number of SPUs.
|
|
*
|
|
* \attention PPU-only
|
|
*
|
|
* \note Must be called before \ref MOC_Init
|
|
*
|
|
* \param count \b out SPU-count
|
|
* \retval MOC_SUCCESS No error; MPI routine completed successfully.
|
|
* \retval ... error-code
|
|
**/
|
|
int MOC_Get_max_spu_count(int* count);
|
|
|
|
/**
|
|
* Adds a SPU-Thread.
|
|
*
|
|
* \attention PPU-only
|
|
*
|
|
* \note Must be called before calling \ref MOC_Init
|
|
*
|
|
* \note The order of executions defines the order of the ranks of the SPU-Threads
|
|
*
|
|
* \param phandle \b in Handle of the SPE-Program
|
|
* \param argp \b in Pointer to some user-defined information in the main-memory
|
|
* \retval MOC_SUCCESS No error; MPI routine completed successfully.
|
|
* \retval MOC_ERR_BUFFER_OVERFLOW A Buffer-Overflow occured. Mosst likely you tried to add more
|
|
* SPU-threads than defined by \ref MOC_SPU_THREAD_MAX.
|
|
* \retval MOC_ERR_INTERN Internal Error
|
|
**/
|
|
int MOC_Add_spu_thread ( spe_program_handle_t* phandle, void* argp );
|
|
|
|
/**
|
|
* Sets the size of the buffer used for buffered communication.
|
|
*
|
|
* \attention PPU-only
|
|
*
|
|
* \note Must be called before \ref MOC_Init
|
|
*
|
|
* \param size buffer-size
|
|
* \return 0 if success, otherwise error-code
|
|
**/
|
|
int MOC_Set_buffer_size ( uint32_t size );
|
|
|
|
/**
|
|
* Sets the size of the message-queues.
|
|
*
|
|
* \attention PPU-only
|
|
*
|
|
* \note Must be called before \ref MOC_Init
|
|
*
|
|
* \param size queue-size
|
|
* \return 0 if success, otherwise error-code
|
|
**/
|
|
int MOC_Set_queue_size ( uint8_t size );
|
|
|
|
/**
|
|
* Initialize the MPI execution environment.
|
|
*
|
|
* \attention PPU-only function
|
|
*
|
|
* \note All processes must call this routine before executing any MOC-routine.
|
|
*
|
|
* \param argc \b in Pointer to the number of arguments
|
|
* \param argv \b in Pointer to the argument vector
|
|
* \retval MOC_SUCCESS No error; MPI routine completed successfully.
|
|
* \retval MOC_ERR_NO_MEMORY Insufficient Memory.
|
|
* \retval MOC_ERR_INTERN Internal Error
|
|
**/
|
|
int MOC_Init ( int *argc, char ***argv );
|
|
|
|
//@}
|
|
//@}
|
|
|
|
|
|
|
|
#endif /*MOC_H_*/
|
|
|