COMIC library consists of API functions for the PPE thread and API functions for the SPE threads.
1. COMIC API functions for the PPE thread
#define COMIC_shared( X )
A macro. Shared variable declarations are passed to the macro as an argument. This macro makes the type definition of the structure of shared variables.
#define COMIC_shared_region()
A macro. Declaration of the structure of shared variables.
#define COMIC access( X )
A macro. Each shared variable access in the PPE thread is marked by this macro.
void COMIC ppe init();
Initialize the COMIC runtime system and create SPE threads.
void COMIC ppe exit();
Terminate all SPE threads.
void COMIC_ppe_run( unsigned int func_id );
Call COMIC_ppe_run_assign( func_id ) and COMIC_ppe_run_wait( func_id ) successively.
void COMIC_ppe_run_assign( unsigned int func_id );
Assign the function whose ID is func_id to all SPE threads.
void COMIC_ppe_run_wait( unsigned int func_id );
Wait for the completion of assigned function whose ID is func_id. In this function, the PPE thread services the requests from SPEs.
void COMIC_ppe_run_barrier();
Handle only barrier requests from SPEs. Typically, all requests including barrier request are handled in COMIC_ppe_run_wait().
void COMIC_page_size( int page_size );
Set the page size of COMIC with page_size at runtime. Default page size is defined at compilation time. Users define the default size with -DCOMIC_PAGESIZE=value option at compilation in which value can be 256, 512, 1024, 2048, 4096, 8192, and 16384. Otherwise, the default value (8KB) of COMIC is used. Currently, this function can only set the page size equal to or greater than the default page size.
int COMIC_get_page_size();
Return the current page size.
2. COMIC API functions for the SPE thread
#define COMIC_shared( X )
A macro. Shared variable declarations are passed to the macro as an argument.
#define COMIC_access( X )
A macro. Each shared variable access in the SPE thread is marked by this macro.
#define COMIC_spe_main( X )
A macro. Case statements, each of which contains a task, are passed to the macro as an argument.
#define COMIC_get_page_size()
A macro. Return the current page size.
unsigned COMIC_get_spe_thread_id();
Obtain the ID of the calling SPE thread.
void COMIC_spe_barrier( unsigned id );
Block the calling thread until all other threads arrive at the barrier.
void COMIC_spe_lock_acquire( unsigned lock );
Block the calling thread until it acquires the lock.
void COMIC_spe_lock_release( unsigned lock );
Release the specified lock.
void COMIC_spe_flush_all();
Flush to main memory and invalidate all modified local copies of the pages in local store.
void COMIC_spe_flush( void *ptr );
Flush to main memory and invalidate the modified local copy of the page that contains the shared address ptr.
void *COMIC_spe_read_LSA( void *ptr );
In case of read request, return the address in local store that maps to the shared address ptr.
char COMIC_spe_read_char( char *ptr ); short COMIC_spe_read_short( short *ptr ); int COMIC_spe_read_int( int *ptr ); long COMIC_spe_read_long( long *ptr ); long long COMIC_spe_read_longlong( long long *ptr ); float COMIC_spe_read_float( float *ptr ); double COMIC_spe_read_double( double *ptr ); vector double COMIC_spe_read_vec_double( vector double *ptr );
Return the value of each variable at the shared address ptr.
void *COMIC_spe_read_only_LSA( void *ptr );
In case of read-only request, return the address in local store that maps to the shared address ptr.
char COMIC_spe_read_only_char( char *ptr ); short COMIC_spe_read_only_short( short *ptr ); int COMIC_spe_read_only_int( int *ptr ); long COMIC_spe_read_only_long( long *ptr ); long long COMIC_spe_read_only_longlong( long long *ptr ); float COMIC_spe_read_only_float( float *ptr ); double COMIC_spe_read_only_double( double *ptr ); vector double COMIC_spe_read_only_vec_double( vector double *ptr );
Return the value of each variable at the shared address ptr. These functions are valid only to read-only shared address.
void *COMIC_spe_write_LSA( void *ptr );
In case of write request, return the address in local store that maps to the shared address ptr.
void COMIC_spe_write( void *ea, void *lsa, int len ); void COMIC_spe_write_char( char *ptr, char v ); void COMIC_spe_write_short( short *ptr, short v ); void COMIC_spe_write_int( int *ptr, int v ); void COMIC_spe_write_long( long *ptr, long v ); void COMIC_spe_write_longlong( long long *ptr, long long v ); void COMIC_spe_write_float( float *ptr, float v ); void COMIC_spe_write_double( double *ptr, double v ); void COMIC_spe_write_vec_double( vector double *ptr, vector double v );
Write the value of variable v to the shared address ptr.
void *COMIC_spe_write_single_LSA( void *ptr );
In case of single-write request, return the address in local store that maps to the shared address ptr.
void COMIC_spe_write_single( void *ea, void *lsa, int len ); void COMIC_spe_write_single_char( char *ptr, char v ); void COMIC_spe_write_single_short( short *ptr, short v ); void COMIC_spe_write_single_int( int *ptr, int v ); void COMIC_spe_write_single_long( long *ptr, long v ); void COMIC_spe_write_single_longlong( long long *ptr, long long v ); void COMIC_spe_write_single_float( float *ptr, float v ); void COMIC_spe_write_single_double( double *ptr, double v ); void COMIC_spe_write_single_vec_double( vector double *ptr, vector double v );
Write the value of variable v to the shared address ptr. These functions are valid only to single-writable shared address.