multicore_expo-darryl-gove

multicore_expo-darryl-gove - Coding for Multiple Threads on...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Coding for Multiple Threads on a CMT System Darryl Gove Senior Staff Engineer Sun Microsystems Inc. 2 Darryl Gove - Coding for Multiple Threads on a CMT System - Sun Microsystems Inc - Multicore Expo 23 rd March 2006 Outline Multiple processes Simple problem fork - multi-process pthreads - multi-thread OpenMP - multi-thread Autopar - multi-thread Compiler options Supporting tools 3 Darryl Gove - Coding for Multiple Threads on a CMT System - Sun Microsystems Inc - Multicore Expo 23 rd March 2006 Options for parallelism Style Task description Example Less Multiple Independent Consolidation Collaboration Processes Heterogeneous Multi-process Independent Web server Homogeneous Pthreads Shared tasks Web browser OpenMP Shared tasks Array Splitting Manipulation More Autopar Shared tasks Array Communication Splitting Manipulation 4 Darryl Gove - Coding for Multiple Threads on a CMT System - Sun Microsystems Inc - Multicore Expo 23 rd March 2006 Multiple processes Comparing > 6 core, 1 Ghz UltraSPARC-T1 > 2x 750 Mhz UltraSPARC-III N copies of: $ time gzip -c --best myfile | gunzip -c - >/dev/null 5 Darryl Gove - Coding for Multiple Threads on a CMT System - Sun Microsystems Inc - Multicore Expo 23 rd March 2006 Multiple processes scaling 1 2 3 4 5 6 7 8 9 1 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 3 3 1 1 2 3 4 Throughput UltraSPARC-T1 (6 core, 1GHz) UltraSPARC-III (2x750MHz) Number of copies Copies per second UltraSPARC-T1 over-subscribed 6 Darryl Gove - Coding for Multiple Threads on a CMT System - Sun Microsystems Inc - Multicore Expo 23 rd March 2006 Scaling - zoom 1 2 3 4 5 6 7 8 9 1 1 1 1 2 1 2 3 Throughput UltraSPARC-T1 (6 core, 1GHz) UltraSPARC-III (2x750MHz) Number of copies Copies per second Heading towards two copies per core 7 Darryl Gove - Coding for Multiple Threads on a CMT System - Sun Microsystems Inc - Multicore Expo 23 rd March 2006 Observations Scaling beyond number of cores. How CMT is implemented is not important Even over-subscribed performance doesn't drop 8 Darryl Gove - Coding for Multiple Threads on a CMT System - Sun Microsystems Inc - Multicore Expo 23 rd March 2006 A simple problem void main(int argc,const char** argv) { int i; hrtime_t start_time; array=(int*)malloc(sizeof(int)*SIZE); int sum=0; for (i=0; i<SIZE;i++) { array[i]=1; } start_time=gethrtime(); for (i=0; i<SIZE; i++) { sum+=array[i]; } printf("Elapsed time (seconds)=%5.3f ", (gethrtime()-start_time)/1000000000.0); printf("Total is %i\n",sum); } 9 Darryl Gove - Coding for Multiple Threads on a CMT System - Sun Microsystems Inc - Multicore Expo 23 rd March 2006 Using fork() rtn=1; start_time=gethrtime(); for (id=0;id<threads;id++) { if (rtn !=0) {rtn=fork();} /*Fork main thread*/ else {break;} /*Don't fork child*/ } if (rtn==0) { sum=0;/* Child thread*/ for (i=(id-1)*array_length; i<id*array_length; i++) { sum+=array[i]; } exit(0); } for (id=0; id<threads; id++) { wait(0); } printf("Elapsed time (seconds)=%5.3f \n", (gethrtime()-start_time)/1000000000.0); 10...
View Full Document

Page1 / 43

multicore_expo-darryl-gove - Coding for Multiple Threads on...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online