{"id":441,"date":"2023-01-27T08:17:28","date_gmt":"2023-01-27T08:17:28","guid":{"rendered":"https:\/\/thunder.snu.ac.kr\/wordpress\/?page_id=441"},"modified":"2023-04-03T15:19:49","modified_gmt":"2023-04-03T15:19:49","slug":"comic-api-functions","status":"publish","type":"page","link":"https:\/\/thunder.snu.ac.kr\/?page_id=441","title":{"rendered":"COMIC API Functions"},"content":{"rendered":"\n<p>COMIC library consists of API functions for the PPE thread and API functions for the SPE threads.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. COMIC API functions for the PPE thread<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">#define COMIC_shared( X )<\/pre>\n\n\n\n<p>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.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">#define COMIC_shared_region()<\/pre>\n\n\n\n<p>A macro. Declaration of the structure of shared variables.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">#define COMIC access( X )<\/pre>\n\n\n\n<p>A macro. Each shared variable access in the PPE thread is marked by this macro.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC ppe init();<\/pre>\n\n\n\n<p>Initialize the COMIC runtime system and create SPE threads.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC ppe exit();<\/pre>\n\n\n\n<p>Terminate all SPE threads.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC_ppe_run( unsigned int func_id );<\/pre>\n\n\n\n<p>Call COMIC_ppe_run_assign( func_id ) and COMIC_ppe_run_wait( func_id ) successively.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC_ppe_run_assign( unsigned int func_id );<\/pre>\n\n\n\n<p>Assign the function whose ID is func_id to all SPE threads.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC_ppe_run_wait( unsigned int func_id );<\/pre>\n\n\n\n<p>Wait for the completion of assigned function whose ID is func_id. In this function, the PPE thread services the requests from SPEs.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC_ppe_run_barrier();<\/pre>\n\n\n\n<p>Handle only barrier requests from SPEs. Typically, all requests including barrier request are handled in COMIC_ppe_run_wait().<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC_page_size( int page_size );<\/pre>\n\n\n\n<p>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.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">int COMIC_get_page_size();<\/pre>\n\n\n\n<p>Return the current page size.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. COMIC API functions for the SPE thread<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">#define COMIC_shared( X )<\/pre>\n\n\n\n<p>A macro. Shared variable declarations are passed to the macro as an argument.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">#define COMIC_access( X )<\/pre>\n\n\n\n<p>A macro. Each shared variable access in the SPE thread is marked by this macro.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">#define COMIC_spe_main( X )<\/pre>\n\n\n\n<p>A macro. Case statements, each of which contains a task, are passed to the macro as an argument.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">#define COMIC_get_page_size()<\/pre>\n\n\n\n<p>A macro. Return the current page size.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">unsigned COMIC_get_spe_thread_id();<\/pre>\n\n\n\n<p>Obtain the ID of the calling SPE thread.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC_spe_barrier( unsigned id );<\/pre>\n\n\n\n<p>Block the calling thread until all other threads arrive at the barrier.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC_spe_lock_acquire( unsigned lock );<\/pre>\n\n\n\n<p>Block the calling thread until it acquires the lock.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC_spe_lock_release( unsigned lock );<\/pre>\n\n\n\n<p>Release the specified lock.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC_spe_flush_all();<\/pre>\n\n\n\n<p>Flush to main memory and invalidate all modified local copies of the pages in local store.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC_spe_flush( void *ptr );<\/pre>\n\n\n\n<p>Flush to main memory and invalidate the modified local copy of the page that contains the shared address ptr.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void *COMIC_spe_read_LSA( void *ptr );<\/pre>\n\n\n\n<p>In case of read request, return the address in local store that maps to the shared address ptr.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">char COMIC_spe_read_char( char *ptr );\nshort COMIC_spe_read_short( short *ptr );\nint COMIC_spe_read_int( int *ptr );\nlong COMIC_spe_read_long( long *ptr );\nlong long COMIC_spe_read_longlong( long long *ptr );\nfloat COMIC_spe_read_float( float *ptr );\ndouble COMIC_spe_read_double( double *ptr );\nvector double COMIC_spe_read_vec_double( vector double *ptr );<\/pre>\n\n\n\n<p>Return the value of each variable at the shared address ptr.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void *COMIC_spe_read_only_LSA( void *ptr );<\/pre>\n\n\n\n<p>In case of read-only request, return the address in local store that maps to the shared address ptr.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">char COMIC_spe_read_only_char( char *ptr );\nshort COMIC_spe_read_only_short( short *ptr );\nint COMIC_spe_read_only_int( int *ptr );\nlong COMIC_spe_read_only_long( long *ptr );\nlong long COMIC_spe_read_only_longlong( long long *ptr );\nfloat COMIC_spe_read_only_float( float *ptr );\ndouble COMIC_spe_read_only_double( double *ptr );\nvector double COMIC_spe_read_only_vec_double( vector double *ptr );<\/pre>\n\n\n\n<p>Return the value of each variable at the shared address ptr. These functions are valid only to read-only shared address.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void *COMIC_spe_write_LSA( void *ptr );<\/pre>\n\n\n\n<p>In case of write request, return the address in local store that maps to the shared address ptr.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC_spe_write( void *ea, void *lsa, int len );\nvoid COMIC_spe_write_char( char *ptr, char v );\nvoid COMIC_spe_write_short( short *ptr, short v );\nvoid COMIC_spe_write_int( int *ptr, int v );\nvoid COMIC_spe_write_long( long *ptr, long v );\nvoid COMIC_spe_write_longlong( long long *ptr, long long v );\nvoid COMIC_spe_write_float( float *ptr, float v );\nvoid COMIC_spe_write_double( double *ptr, double v );\nvoid COMIC_spe_write_vec_double( vector double *ptr, vector double v );<\/pre>\n\n\n\n<p>Write the value of variable v to the shared address ptr.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void *COMIC_spe_write_single_LSA( void *ptr );<\/pre>\n\n\n\n<p>In case of single-write request, return the address in local store that maps to the shared address ptr.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background\">void COMIC_spe_write_single( void *ea, void *lsa, int len );\nvoid COMIC_spe_write_single_char( char *ptr, char v );\nvoid COMIC_spe_write_single_short( short *ptr, short v );\nvoid COMIC_spe_write_single_int( int *ptr, int v );\nvoid COMIC_spe_write_single_long( long *ptr, long v );\nvoid COMIC_spe_write_single_longlong( long long *ptr, long long v );\nvoid COMIC_spe_write_single_float( float *ptr, float v );\nvoid COMIC_spe_write_single_double( double *ptr, double v );\nvoid COMIC_spe_write_single_vec_double( vector double *ptr, vector double v );<\/pre>\n\n\n\n<p>Write the value of variable v to the shared address ptr. These functions are valid only to single-writable shared address.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"footnotes":""},"class_list":["post-441","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/thunder.snu.ac.kr\/index.php?rest_route=\/wp\/v2\/pages\/441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thunder.snu.ac.kr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/thunder.snu.ac.kr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/thunder.snu.ac.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thunder.snu.ac.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=441"}],"version-history":[{"count":2,"href":"https:\/\/thunder.snu.ac.kr\/index.php?rest_route=\/wp\/v2\/pages\/441\/revisions"}],"predecessor-version":[{"id":1122,"href":"https:\/\/thunder.snu.ac.kr\/index.php?rest_route=\/wp\/v2\/pages\/441\/revisions\/1122"}],"wp:attachment":[{"href":"https:\/\/thunder.snu.ac.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}