本文整理匯總了C++中Event_init函數的典型用法代碼示例。如果您正苦於以下問題:C++ Event_init函數的具體用法?C++ Event_init怎麽用?C++ Event_init使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Event_init函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: cudaMemcpy
cudaError_t cudaMemcpy (void * a1, const void * a2, size_t a3, enum cudaMemcpyKind a4)
{
cudaError_t retVal;
Record_Event Event = Event_init ();
Event.event_name = "cudaMemcpy";
Event.eid = 326;
Event.type = CUDA_MEM;
Event.memcpy_size = a3;
Event.memcpy_type = a4;
Event.memcpy_kind = SYNC;
cudaMemcpy_real = (cudaError_t (*)(void*, const void*, size_t, enum cudaMemcpyKind)) dlsym(RTLD_NEXT, "cudaMemcpy");
Event.starttime = gettime ();
retVal = (*cudaMemcpy_real)( a1, a2, a3, a4);
Event.endtime = gettime ();
#ifdef DEBUG
printf("[DEBUG]:\t%s\tlu\t%lu\n",
Event.event_name,
Event.starttime,
Event.endtime
);
#endif
Record (&Event, CMPI_TRACE);
return retVal;
}
示例2: GOMP_loop_dynamic_start
/*
指導語句: #pragma omp for
結構功能: for開始函數(無parallel時)
函數功能: 創建一個任務共享結構
*/
int GOMP_loop_dynamic_start (long p1, long p2, long p3, long p4, long *p5, long *p6)
{
int res = 0;
Record_Event Event = Event_init ();
Event.event_name = "GOMP_loop_dynamic_start";
Event.eid = 220;
Event.type = NONE;
Event.omp_rank = get_thread_num ();
Event.omp_level = get_level ();
Event.p_rank = omp_get_ancestor_thread_num (get_level () - 1);
GOMP_loop_dynamic_start_real = (int(*)(long,long,long,long,long*,long*)) dlsym (RTLD_NEXT, "GOMP_loop_dynamic_start");
if (GOMP_loop_dynamic_start_real != NULL)
{
Event.starttime = gettime ();
res = GOMP_loop_dynamic_start_real (p1, p2, p3, p4, p5, p6);
Event.endtime = gettime ();
Record (&Event, OMPI_TRACE);
}
else
{
printf_d("GOMP_loop_dynamic_start is not hooked! exiting!!\n");
}
return res;
}
示例3: GOMP_sections_next
/*
指導語句: #pragma omp sections
結構功能: section調度函數
函數功能: 當一個線程結束其執行的任務時,調用該函數分配下一個任務
*/
unsigned GOMP_sections_next (void)
{
Record_Event Event = Event_init ();
Event.event_name = "GOMP_sections_next";
Event.eid = 224;
Event.type = NONE;
Event.omp_rank = get_thread_num ();
Event.omp_level = get_level ();
Event.p_rank = omp_get_ancestor_thread_num (get_level () - 1);
unsigned res = 0;
GOMP_sections_next_real=(unsigned(*)(void)) dlsym (RTLD_NEXT, "GOMP_sections_next");
if (GOMP_sections_next_real != NULL)
{
Event.starttime=gettime();
res = GOMP_sections_next_real();
Event.endtime=gettime();
Record(&Event, OMPI_TRACE);
}
else
{
printf_d("GOMP_sections_next is not hooked! exiting!!\n");
}
return res;
}
示例4: GOMP_parallel_loop_guided_start
/*
指導語句: #pragma omp for
結構功能: for預初始化函數(有parallel時)
函數功能: 預初始化一個任務共享結構
*/
void GOMP_parallel_loop_guided_start(void *p1, void *p2, unsigned p3, long p4, long p5, long p6, long p7)
{
TaskInfo old_task;
Record_Event Event = Event_init ();
Event.event_name = "GOMP_parallel_loop_guided_start";
Event.eid = 212;
Event.type = NONE;
Event.omp_rank = get_thread_num ();
Event.omp_level = get_level ();
Event.p_rank = omp_get_ancestor_thread_num (get_level () - 1);
old_task = current_task;
//If current task is not exist, create a new task
if (current_task.flag == 0)
{
current_task = create_itask ();
Event.task_state_start = TASK_CREATE;
}
else
Event.task_state_start = TASK_SUSPEND;
create_team (current_task);
Event.p_task_id_start = current_task.task_parent_id;
Event.task_id_start = current_task.task_id;
GOMP_parallel_loop_guided_start_real=(void(*)(void*,void*,unsigned, long, long, long, long)) dlsym (RTLD_NEXT, "GOMP_parallel_loop_guided_start");
if (GOMP_parallel_loop_guided_start_real != NULL)
{
pardo_uf = (void(*)(void*))p1;
pardo_uf_id++;
/*if (PAPI == PAPI_ON)
retVal = PAPI_thread_init(get_thread_num());
if (retVal != PAPI_OK)
ERROR_RETURN(retVal);*/
Event.starttime=gettime();
GOMP_parallel_loop_guided_start_real (callme_pardo, p2, p3, p4, p5, p6, p7);
Event.endtime=gettime();
}
else
{
printf_d("GOMP_parallel_loop_guided_start is not hooked! exiting!!\n");
}
Event.p_task_id_end = current_task.task_parent_id;
Event.task_id_end = current_task.task_id;
if (old_task.flag == 0)
Event.task_state_end = TASK_START;
else
Event.task_state_end = TASK_RESUME;
Record(&Event, OMPI_TRACE);
}
示例5: callme_par
/*
指導語句: #pragma omp parallel
結構功能: parallel用戶子函數
函數功能: parallel中調用的用戶子函數
*/
static void callme_par (void *p1)
{
TaskInfo old_task;
char fun_name[30] = "Parallel_User_fun_";
char id [10];
Record_Event Event = Event_init ();
old_task = current_task;
current_task = create_itask ();
//Is it necessary to add this task to the thread team ?
add_itask (current_task);
itoa (par_uf_id, id);
strcat (fun_name, id);
Event.event_name = fun_name;
Event.eid = 234;
Event.type = NONE;
Event.omp_rank = get_thread_num ();
Event.omp_level = get_level ();
Event.p_rank = omp_get_ancestor_thread_num (get_level () - 1);
Event.p_task_id_start = current_task.task_parent_id;
Event.task_id_start = current_task.task_id;
Event.task_state_start = TASK_CREATE;
if (par_uf == NULL)
{
printf_d("Error! Invalid initialization of 'par_uf'\n");
return ;
}
if (PAPI == PAPI_ON)
{
PAPI_get_info (fun_name, 0, PAPI_THREAD);
Event.starttime = gettime ();
par_uf (p1);
Event.endtime = gettime ();
PAPI_get_info (fun_name, 1, PAPI_THREAD);
}
else
{
Event.starttime = gettime ();
par_uf (p1);
Event.endtime = gettime ();
}
Event.p_task_id_end = current_task.task_parent_id;
Event.task_id_end = current_task.task_id;
Event.task_state_end = TASK_END;
remove_itask (current_task);
current_task = old_task;
Record (&Event, OMPI_TRACE);
}
示例6: callme_task
/*
指導語句: #pragma omp task
結構功能: task用戶子函數
函數功能: task中調用的用戶子函數
*/
static void callme_task (void *p1)
{
TaskInfo old_task;
struct eTask *task;
char fun_name[30] = "Task_User_do_fun_";
char id [10];
Record_Event Event = Event_init ();
old_task = current_task;
task = etask_schedule ();
current_task = task.task_info;
current_task.thread_id = get_thread_id (get_level ());
// current_etask = task;
itoa (task_uf_id, id);
strcat (fun_name, id);
Event.event_name = fun_name;
Event.eid = 235;
Event.type = NONE;
Event.omp_rank = get_thread_num ();
Event.omp_level = get_level ();
Event.p_rank = omp_get_ancestor_thread_num (get_level () - 1);
Event.p_task_id_start = current_task.task_parent_id;
Event.task_id_start = current_task.task_id;
Event.task_state_start = TASK_START;
if (task_uf == NULL)
{
printf_d("Error! Invalid initialization of 'task_uf'\n");
return ;
}
if (PAPI == PAPI_ON)
{
PAPI_get_info (fun_name, 0, PAPI_THREAD);
Event.starttime = gettime ();
task_uf (p1);
Event.endtime = gettime ();
PAPI_get_info (fun_name, 1, PAPI_THREAD);
}
else
{
Event.starttime = gettime ();
task_uf (p1);
Event.endtime = gettime ();
}
Event.p_task_id_end = current_task.task_parent_id;
Event.task_id_end = current_task.task_id;
Event.task_state_end = TASK_END;
remove_etask (task);
current_task = old_task;
Record (&Event, OMPI_TRACE);
}
示例7: GOMP_task
void GOMP_task (void *p1, void *p2, void *p3,long p4, long p5, _Bool p6, unsigned p7)
{
struct eTask *task;
int old_block = block_statue;
Record_Event Event = Event_init ();
Event.event_name = "GOMP_task";
Event.eid = 229;
Event.type = NONE;
Event.omp_rank = get_thread_num ();
Event.omp_level = get_level ();
Event.p_rank = omp_get_ancestor_thread_num (get_level () - 1);
if (current_task.flag == 1)
{
Event.p_task_id_start = current_task.task_parent_id;
Event.task_id_start = current_task.task_id;
Event.task_state_start = TASK_CREATE;
}
if (p6)
{
/*Create a task that will be executed immediately*/
block_statue = RUN_AT_ONCE_BLOCK;
}
else
{
task = create_etask ();
add_etask (task);
}
GOMP_task_real = (void(*)(void *,void *,void *,long,long,_Bool,unsigned))dlsym(RTLD_NEXT,"GOMP_task");
if(GOMP_task_real != NULL)
{
task_uf = (void(*)(void*))p1;
task_uf_id++;
Event.starttime = gettime();
GOMP_task_real (callme_task, p2, p3, p4, p5, p6, p7);
Event.endtime = gettime();
}
block_statue = old_block;
if (current_task.flag == 1)
{
Event.p_task_id_end = current_task.task_parent_id;
Event.task_id_end = current_task.task_id;
Event.task_state_end = TASK_RESUME;
}
Record(&Event, OMPI_TRACE);
}
示例8: GOMP_parallel_start
/*
指導語句: #pragma omp parallel
結構功能: parallel開始函數
函數功能: 初始化一個parallel並行結構
*/
void GOMP_parallel_start (void *p1, void *p2, unsigned p3)
{
TaskInfo old_task;
Record_Event Event = Event_init (); //初始化
Event.event_name = "GOMP_parallel_start"; //獲取函數名
Event.eid = 200;
Event.type = NONE;
Event.omp_rank = get_thread_num (); //獲取線程編號
Event.omp_level = get_level ();
Event.p_rank = omp_get_ancestor_thread_num (get_level () - 1);
old_task = current_task;
//If current task is not exist, create a new task
if (current_task.flag == 0)
{
current_task = create_itask ();
Event.task_state_start = TASK_CREATE;
}
else
Event.task_state_start = TASK_SUSPEND;
create_team (current_task);
Event.p_task_id_start = current_task.task_parent_id;
Event.task_id_start = current_task.task_id;
/*dlsym函數返回 GOMP_parallel_start 在動態鏈接庫中的下一個地址,供調用使用*/
GOMP_parallel_start_real = (void(*)(void*,void*,unsigned))dlsym (RTLD_NEXT, "GOMP_parallel_start");
if (GOMP_parallel_start_real != NULL)
{
par_uf = (void(*)(void*))p1; //調用子函數的包裝函數
par_uf_id++;
Event.starttime = gettime(); //獲取開始時間
GOMP_parallel_start_real (callme_par, p2, p3); //調用OpenMP庫中的GOMP_parallel_start()實現功能
Event.endtime = gettime (); //獲取結束時間
}
else
{
printf_d ("GOMP_parallel_start is not hooked! exiting!!\n");
}
Event.p_task_id_end = current_task.task_parent_id;
Event.task_id_end = current_task.task_id;
if (old_task.flag == 0)
Event.task_state_end = TASK_START;
else
Event.task_state_end = TASK_RESUME;
Record (&Event, OMPI_TRACE);
}
示例9: GOMP_loop_guided_next
/*
指導語句: #pragma omp parallel for
結構功能: for調度函數
函數功能: 當一個線程完成指定給它的任務時,調用該函數分配下個任務
*/
int GOMP_loop_guided_next(long *p1, long *p2)
{
int res = 0;
Record_Event Event = Event_init ();
Event.event_name = "GOMP_loop_guided_next";
Event.eid = 216;
Event.type = NONE;
Event.omp_rank = get_thread_num ();
Event.omp_level = get_level ();
Event.p_rank = omp_get_ancestor_thread_num (get_level () - 1);
Event.p_task_id_start = current_task.task_parent_id;
Event.task_id_start = current_task.task_id;
Event.task_state_start= TASK_END;
GOMP_loop_guided_next_real=(int(*)(long*,long*)) dlsym (RTLD_NEXT, "GOMP_loop_guided_next");
if (GOMP_loop_guided_next_real != NULL)
{
Event.starttime=gettime();
res = GOMP_loop_guided_next_real (p1, p2);
Event.endtime=gettime();
Record(&Event, OMPI_TRACE);
}
else
{
printf_d("GOMP_loop_guided_next is not hooked! exiting!!\n");
}
if (res == 1) //Create a new task for this thread
{
current_task = create_itask ();
Event.p_task_id_end = current_task.task_parent_id;
Event.task_id_end= current_task.task_id;
Event.task_state_end = TASK_CREATE;
}
else
{
current_task = get_current_task ();
if (current_task.flag == 1)
{
Event.p_task_id_end = current_task.task_parent_id;
Event.task_id_end= current_task.task_id;
Event.task_state_end = TASK_RESUME;
}
}
Record (&Event, OMPI_TRACE);
return res;
}
示例10: Event_Send
int Event_Send(unsigned int Flags)
{
if (!bInitialized) Event_init();
if (mt_o.bEventDMsg) printf("%lu Event_Send(0x%08X), Flag = 0x%08X\n", pthread_self(), Flags, Flag | Flags);
pthread_mutex_lock(&EventLock);
Flag |= Flags;
pthread_cond_broadcast(&EventSig);
pthread_mutex_unlock(&EventLock);
if (mt_o.bEventYields) sched_yield();
return 0;
}
示例11: cudaEventCreateWithFlags
cudaError_t cudaEventCreateWithFlags (cudaEvent_t *a1, unsigned int a2)
{
cudaError_t retVal;
Record_Event Event = Event_init ();
Event.event_name = "cudaEventCreateWithFlags";
Event.eid = 316;
Event.type = NONE;
cudaEventCreateWithFlags_real = (cudaError_t (*)(cudaEvent_t *, unsigned int a2)) dlsym (RTLD_NEXT, "cudaEventCreateWithFlags");
Event.starttime = gettime ();
retVal = cudaEventCreateWithFlags_real (a1, a2);
Event.endtime = gettime ();
Record (&Event, CMPI_TRACE);
return retVal;
}
示例12: cudaEventDestroy
cudaError_t cudaEventDestroy (cudaEvent_t a1)
{
cudaError_t retVal;
Record_Event Event = Event_init ();
Event.event_name = "cudaEventDestroy";
Event.eid = 321;
Event.type = NONE;
cudaEventDestroy_real = (cudaError_t (*)(cudaEvent_t)) dlsym (RTLD_NEXT, "cudaEventDestroy");
Event.starttime = gettime ();
retVal = cudaEventDestroy_real (a1);
Event.endtime = gettime ();
Record (&Event, CMPI_TRACE);
return retVal;
}
示例13: cudaEventRecord
cudaError_t cudaEventRecord (cudaEvent_t a1, cudaStream_t a2)
{
cudaError_t retVal;
Record_Event Event = Event_init ();
Event.event_name = "cudaEventRecord";
Event.eid = 317;
Event.type = NONE;
cudaEventRecord_real = (cudaError_t (*)(cudaEvent_t, cudaStream_t)) dlsym (RTLD_NEXT, "cudaEventRecord");
Event.starttime = gettime ();
retVal = cudaEventRecord_real (a1, a2);
Event.endtime = gettime ();
Record (&Event, CMPI_TRACE);
return retVal;
}
示例14: cudaMemGetInfo
cudaError_t cudaMemGetInfo (size_t * a1, size_t * a2)
{
cudaError_t retVal;
Record_Event Event = Event_init ();
Event.event_name = "cudaMemGetInfo";
Event.eid = 341;
Event.type = NONE;
cudaMemGetInfo_real = (cudaError_t (*)(size_t *, size_t *)) dlsym (RTLD_NEXT, "cudaMemGetInfo");
Event.starttime = gettime ();
retVal = cudaMemGetInfo_real (a1, a2);
Event.endtime = gettime ();
Record (&Event, CMPI_TRACE);
return retVal;
}
示例15: cudaEventElapsedTime
cudaError_t cudaEventElapsedTime (float *a1, cudaEvent_t a2, cudaEvent_t a3)
{
cudaError_t retVal;
Record_Event Event = Event_init ();
Event.event_name = "cudaEventElapsedTime";
Event.eid = 322;
Event.type = NONE;
cudaEventElapsedTime_real = (cudaError_t (*)(float *, cudaEvent_t, cudaEvent_t)) dlsym (RTLD_NEXT, "cudaEventElapsedTime");
Event.starttime = gettime ();
retVal = cudaEventElapsedTime_real (a1, a2, a3);
Event.endtime = gettime ();
Record (&Event, CMPI_TRACE);
return retVal;
}