13.07.2015 Views

automatically exploiting cross-invocation parallelism using runtime ...

automatically exploiting cross-invocation parallelism using runtime ...

automatically exploiting cross-invocation parallelism using runtime ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Main thread:main() {init();create_threads(threads, attrs, SpecCross_parallel_func, args);cleanup();}Worker thread:SpecCross_parallel_func(threadID) {for (t = 0; t < STEP; t++) {enter_barrier(threadID, "L1");L1: for (i = threadID; i < M; i = i + THREADNUM) {enter_task(threadID, minimum_distance_L1);spec_access(threadID, callback, &A[i], &C[i]);A[i] = do_work(B[C[i]]);exit_task(threadID);}enter_barrier(threadID, "L2");L2: for (j = threadID; j < M; j = j + THREADNUM) {enter_task(threadID, minimum_distance_L2);spec_access(threadID, callback, &C[D[j]], &A[j]);B[j] = do_work(A[D[j]]);exit_task(threadID);}}send_end_token(threadID);}Figure 4.9: Demonstration of <strong>using</strong> SPECCROSS <strong>runtime</strong> library in a parallel program5. Task Initialization. Function enter task is inserted before each task. It is notused in profiling mode.In speculation mode, it collects epoch number and tasknumber of worker threads other than the caller thread and sends the number pairsto the checker thread. The value of spec distance specifies the speculation distancebetween two tasks. This value is set according to the minimum distance returned bythe profiling run. The worker thread is stalled if it is executing beyond the minimumdistance compared to other worker threads.6. Task Finalization. Once a task completes execution, exit task is called. Inprofiling mode, this function logs the access signature of the task, compares this ac-68

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!