Parallel Computing Lecture 6 - Sorting Algorithms (2) PDF
Document Details
Uploaded by SpiritualNeon
University College Cork
Tags
Related
- Parallel Computing Lecture 3 PDF
- DS 642: Applications of Parallel Computing Lecture 6 PDF
- Parallel & Distributed Computing PDF
- 1- Introduction to Parallel Computing.pdf
- Parallel Computing: Designing Parallel Algorithms PDF
- Theoretical and Practical Foundations of Parallel Computing in Numerical Methods PDF
Summary
Lecture notes covering parallel sorting algorithms, including concepts like compare-and-exchange operations and sorting network implementations for parallel processors. The document likely details various parallel sorting techniques using messages passing interface (MPI).
Full Transcript
Parallel Computing Lecture 6 – Sorting Algorithms (2) Compare and Exchange Operation Compare and Exchange Sorting Shell Sort 1 Compare and Exchange Operation Place two variables A, B in the right order. if(A>B) {...
Parallel Computing Lecture 6 – Sorting Algorithms (2) Compare and Exchange Operation Compare and Exchange Sorting Shell Sort 1 Compare and Exchange Operation Place two variables A, B in the right order. if(A>B) { tmp=A;A=B;B=tmp; } Most internal sort algorithms use a sequence of compare and exchange. Can we introduce compare and exchange in parallel? 2 3 4 5 Compare and Exchange Operation Take place between processors rank1, rank2. Each processor keeps the array a=(a[i],i=0,1,…,n) sorted. if(rank == rank1){ MPI_Send(&a,n,MPI_INT,rank2, tag1,MPI_COMM_WORLD); MPI_Recv(&b,n,MPI_INT,rank2, tag2,MPI_COMM_WORLD,&status); c = merge(n,a,n,b); for(i=0;i