Parallel Computing: see us at a conference near you
I've been getting periodic reports back from the team this week on how things are going at PDC. Customers seem to be very jazzed about parallel computing, our sessions have been enthusiastically received, and my team's debugger and profiler work seems especially popular. The team also tells me that those customers interested in parallel computing are particularly intelligent and attractive people. Okay, I made up that last bit; even the homely and dull-witted are interesting in parallel computing. Okay, I should really stop now. Anyhow, if you're like me and didn't have the opportunity to attend PDC in person this year, there are still a few more opportunities this month to meet the team and see first hand what we're doing for Visual Studio 2010:
- Nov 10-14: TechEd EMEA in Barcelona, Spain
- Nov 15-21: SC08 in Austin, TX
- Nov 19-21: Technical Summit in Berlin, Germany
I'll be speaking at the two European events, so feel free to get in touch if you'd like to chat in person.
Comments
Anonymous
November 03, 2008
In case you are already in Berlin Nov 15, WWE Smackdown will be there ;) I think a match against Big Show would be fair for what you did with the MFC!Anonymous
November 04, 2008
The comment has been removedAnonymous
November 05, 2008
The comment has been removedAnonymous
November 06, 2008
The comment has been removedAnonymous
November 06, 2008
It's actually quite tempting to attend in person, but my keynote in the next morning, so I'll probably have to admire the match from afar. :)Anonymous
January 17, 2009
hi sir, we're trying develop parallel program for merge sort. But in parallel taking more time than sequential time. We tried for 2 processor. If anybody give solution it will be very helpfull .....tnanks & regards .... Samir Kumar Ghosh & Srinivas Karur. Follow our code...
/******************************************************************************
FILE: mergesort.c
DESCRIPTION:
The master task distributes an array to the workers in chunks, zero pads for equal load balancing
The workers sort and return to the master, which does a final merge ***************************************************************/ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <mpi.h> //#define N 100000 #define MASTER 0 / taskid of first task / void showVector(int v, int n, int id); int * merge(int A, int asize, int B, int bsize); void swap(int v, int i, int j); void m_sort(int A, int min, int max); double startT, stopT; double startTime; /function to print a vector/ void showVector(int v, int n, int id) { int i; printf("%d: ",id); for(i=0;i<n;i++) printf("%d ",v[i]); putchar('n'); } /function to merge vectors/ int * merge(int A, int asize, int B, int bsize) { int ai, bi, ci, i; int C; int csize = asize+bsize; ai = 0; bi = 0; ci = 0; / printf("asize=%d bsize=%dn", asize, bsize); / C = (int )malloc(csizesizeof(int)); /the array can be statically allocated too/ while ((ai < asize) && (bi < bsize)) { if (A[ai] <= B[bi]) { C[ci] = A[ai]; ci++; ai++; } else { C[ci] = B[bi]; ci++; bi++; } } if (ai >= asize) /if A is shorter/ for (i = ci; i < csize; i++, bi++) C[i] = B[bi]; else if (bi >= bsize) /if B is shorter/ for (i = ci; i < csize; i++, ai++) C[i] = A[ai]; for (i = 0; i < asize; i++) A[i] = C[i]; for (i = 0; i < bsize; i++) B[i] = C[asize+i]; / showVector(C, csize, 0); / return C; } void swap(int v, int i, int j) { int t; t = v[i]; v[i] = v[j]; v[j] = t; } void m_sort(int A, int min, int max) { int C; / dummy, just to fit the function / int mid = (min+max)/2; int lowerCount = mid - min + 1; int upperCount = max - mid; / If the range consists of a single element, it's already sorted / if (max == min) { return; } else { / Otherwise, sort the first half / m_sort(A, min, mid); / Now sort the second half / m_sort(A, mid+1, max); / Now merge the two halves / C = merge(A + min, lowerCount, A + mid + 1, upperCount); } } main(int argc, char argv) { int * data; int * chunk; int * other; int m,n; int id,p; int s = 0; int i; int step; MPI_Status status; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD,&id); MPI_Comm_size(MPI_COMM_WORLD,&p); n=atoi(argv[1]); startT = MPI_Wtime(); / master task ********/ if(id == MASTER) { int r; srandom(MPI_Wtime()); s = n/p; r = n%p; data = (int )malloc((n+s-r)sizeof(int)); for(i=0;i<n;i++) data[i] = random(); if(r!=0) { for(i=n;i<n+s-r;i++) data[i]=0; s=s+1; } MPI_Bcast(&s,1,MPI_INT,0,MPI_COMM_WORLD); chunk = (int )malloc(ssizeof(int)); MPI_Scatter(data,s,MPI_INT,chunk,s,MPI_INT,0,MPI_COMM_WORLD); m_sort(chunk, 0, s-1); / showVector(chunk, s, id); / } / worker task ***********************************/ else { MPI_Bcast(&s,1,MPI_INT,0,MPI_COMM_WORLD); chunk = (int )malloc(ssizeof(int)); MPI_Scatter(data,s,MPI_INT,chunk,s,MPI_INT,0,MPI_COMM_WORLD); m_sort(chunk, 0, s-1); / showVector(chunk, s, id);/ } /data propagation in a tree fashion/ step = 1; while(step<p) { if(id%(2step)==0) { if(id+step<p) { MPI_Recv(&m,1,MPI_INT,id+step,0,MPI_COMM_WORLD,&status); other = (int )malloc(msizeof(int)); MPI_Recv(other,m,MPI_INT,id+step,0,MPI_COMM_WORLD,&status); chunk = merge(chunk,s,other,m); s = s+m; } } else { int near = id-step; MPI_Send(&s,1,MPI_INT,near,0,MPI_COMM_WORLD); MPI_Send(chunk,s,MPI_INT,near,0,MPI_COMM_WORLD); break; } step = step2; } stopT = MPI_Wtime(); if(id==0) { FILE * fout; printf("%d; %d processors; %f secsn", s, p, (stopT-startT)); fout = fopen("result.txt","w"); for(i=0;i<s;i++) fprintf(fout,"%dn",chunk[i]); fclose(fout); } MPI_Finalize(); }
Anonymous
January 19, 2009
I'm afraid code debugging is not one of the many services I am able to offer on this blog. :) However, you might consider picking up a CTP version of Visual Studio 2010 so that you can diagnose the parallel performance of your code in the profiler.Anonymous
January 25, 2009
Samir Kumar Ghosh & Srinivas Karur, Using MPI adds a great overhead. If you want to develop for a multicore or multiprocessor computer, use C# instead, with threaded programming. Or, you can also use Parallel extensions, but they are still in CTP (means risks). There are many interesting books to learn threaded and multithreaded programming with C#. See http://www.multicoreinfo.com/books/ C# 2008 and 2005 Threaded Programming: Beginner’s Guide Author: Gastón C. Hillar 395 pages, Expected January 2009 ISBN 1847197108, ISBN 13 978-1-847197-10-8 Concurrent Programming on Windows [Amazon Link] Author: Joe Duffy Publisher: Addison Wesley, Pages: 1,008, November 2008 ISBN: 0-3214-3482-X Programming the Cell Broadband Engine™ Architecture: Examples and Best Practices (.pdf) Authors: Abraham Arevalo, Ricardo M. Matinata, Maharaja Pandian, Eitan Peri, Kurtis Ruby, Francois Thomas, Chris Almond Publisher: IBM® Redbooks® Programming Clojure (Beta) Author: Stuart Halloway Programming in Scala: Tackle multi-core complexity on the JVM Author: Venkat Subramaniam This title will be available on or about March 30, 2009