|
To be able to communicate with other processes every MOC-process needs to setup his MOC-Environment before any MOC-function can be called (there are some exceptions though).
The PPU-process has a special role, because he is the one who starts the SPU-processes. SPU-processes can be added to the MOC-environment by calling MOC_Add_spu_thread with the appropriate SPU-thread-handle (This implementation only supports the embedded binary concept where the SPU-binary is embedded into the PPU-binary and accessed via a handle). The order of calling determines the rank of the SPU-processes. To get the number of total and available SPUs the functions MOC_Get_avail_spu_count and MOC_Get_max_spu_count can be used.
The buffer-size and the size of the message-queues can be set before calling MOC_Init on the PPU using MOC_Set_buffer_size and MOC_Set_queue_size.
MOC_Init only returns after all processes have called this function and have set up their environment.
If the MOC-environment isn't needed anymore, MOC_Finalize should be called by all MOC-processes. MOC_Finalize only returns after all MOC-processes have called this functions and have shutdown their environments.
PPU & SPU | |
| int | MOC_Finalize (void) |
| Terminates MPI execution environment. | |
PPU-only | |
| int | MOC_Get_avail_spu_count (int *count) |
| Returns the number of available SPUs. | |
| int | MOC_Get_max_spu_count (int *count) |
| Returns the number of SPUs. | |
| int | MOC_Add_spu_thread (spe_program_handle_t *phandle, void *argp) |
| Adds a SPU-Thread. | |
| int | MOC_Set_buffer_size (uint32_t size) |
| Sets the size of the buffer used for buffered communication. | |
| int | MOC_Set_queue_size (uint8_t size) |
| Sets the size of the message-queues. | |
| int | MOC_Init (int *argc, char ***argv) |
| Initialize the MPI execution environment. | |
SPU-only | |
| int | MOC_Init (unsigned long long argp, int length, void *buffer) |
| Initialize the MPI execution environment. | |
| int MOC_Add_spu_thread | ( | spe_program_handle_t * | phandle, | |
| void * | argp | |||
| ) |
Adds a SPU-Thread.
The order of executions defines the order of the ranks of the SPU-Threads
| phandle | in Handle of the SPE-Program | |
| argp | in Pointer to some user-defined information in the main-memory |
| MOC_SUCCESS | No error; MPI routine completed successfully. | |
| MOC_ERR_BUFFER_OVERFLOW | A Buffer-Overflow occured. Mosst likely you tried to add more SPU-threads than defined by MOC_SPU_THREAD_MAX. | |
| MOC_ERR_INTERN | Internal Error |
Definition at line 11 of file moc_add_spu_thread_ppu.c.
References moc_spu_thread_struct::argp, MOC_ERR_BUFFER_OVERFLOW, MOC_ERR_INTERN, moc_spu_thread_count, moc_spu_thread_list, MOC_SPU_THREAD_MAX, and moc_spu_thread_struct::spe_entry_adress.
| int MOC_Finalize | ( | void | ) |
Terminates MPI execution environment.
| MOC_SUCCESS | No error; MPI routine completed successfully. |
Definition at line 11 of file moc_finalize_ppu.c.
References bmalloc_first_node, moc_node_handle_ppu_struct::buffer_base, moc_node_handle_ppu_struct::message_queue_base, MOC_ERR_INTERN, moc_node_handle_ppu_struct::moc_process_list, moc_spu_thread_count, moc_spu_thread_list, moc_internal_buffer_node_struct::next_node, node_handle, moc_node_handle_ppu_struct::rank, moc_node_handle_ppu_struct::signal_area, and moc_node_handle_ppu_struct::status_array_base.
| int MOC_Get_avail_spu_count | ( | int * | count | ) |
Returns the number of available SPUs.
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.
| count | out number of available SPUs |
| MOC_SUCCESS | No error; MPI routine completed successfully. | |
| ... | error-code |
Definition at line 4 of file moc_get_avail_spu_ppu.c.
References MOC_ERR_INTERN.
| int MOC_Get_max_spu_count | ( | int * | count | ) |
Returns the number of SPUs.
| count | out SPU-count |
| MOC_SUCCESS | No error; MPI routine completed successfully. | |
| ... | error-code |
Definition at line 4 of file moc_get_max_spu_ppu.c.
References MOC_ERR_INTERN.
| int MOC_Init | ( | unsigned long long | argp, | |
| int | length, | |||
| void * | buffer | |||
| ) |
Initialize the MPI execution environment.
| argp | in Pointer to user-defined information in the main-memory | |
| length | in Length of the user-defined information in bytes | |
| buffer | out Buffer into which the user-defined information should be copied |
| MOC_SUCCESS | No error; MPI routine completed successfully. | |
| MOC_ERR_NO_MEMORY | Insufficient Memory. | |
| MOC_ERR_INTERN | Internal Error |
| int MOC_Init | ( | int * | argc, | |
| char *** | argv | |||
| ) |
Initialize the MPI execution environment.
| argc | in Pointer to the number of arguments | |
| argv | in Pointer to the argument vector |
| MOC_SUCCESS | No error; MPI routine completed successfully. | |
| MOC_ERR_NO_MEMORY | Insufficient Memory. | |
| MOC_ERR_INTERN | Internal Error |
| int MOC_Set_buffer_size | ( | uint32_t | size | ) |
Sets the size of the buffer used for buffered communication.
| size | buffer-size |
Definition at line 3 of file moc_set_buffer_size_ppu.c.
References moc_spu_buffer_size.
| int MOC_Set_queue_size | ( | uint8_t | size | ) |
Sets the size of the message-queues.
| size | queue-size |
Definition at line 3 of file moc_set_queue_size_ppu.c.
References moc_spu_queue_size.
1.5.6