




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















Topics for Today
**- Dissemination barrier
Dissemination Barrier in Action
Round 2
Round 1 Round 3
Dissemination Pattern
- Strength —avoids reduction tree + broadcast tree - reduction + broadcast tree: critical path length = 2 log 2 P **—faster by a factor of two in practice for that reason
7 Productive Parallel 1D FFT (n = 2 k ) subroutine fft(c, n) implicit complex(c) dimension c(0:n-1), irev(0:n-1) !HPF$ processors p(number_of_processors()) !HPF$ template t(0:n-1) !HPF$ align c(i) with t(i) !HPF$ align irev(i) with t(i) !HPF$ distribute t(block) onto p two_pi = 2.0d0 * acos(-1.0d0) levels = number_of_bits(n) - 1 irev = (/ (bitreverse(i,levels), i= 0, n-1) /) forall (i=0:n-1) c(i) = c(irev(i)) do l = 1, levels! --- for each level in the FFT m = ishft(1, l) m2 = ishft(1, l - 1) do k = 0, n - 1, m! --- for each butterfly in a level do j = k, k + m2 - 1! --- for each point in a half bfly ce = exp(cmplx(0.0,(j - k) * -two_pi/real(m))) cr = ce * c(j + m2) cl = c(j) c(j) = cl + cr c(j + m2) = cl - cr end do end do enddo end subroutine fft Two stages: —bit reversal permutation —butterfly pattern of element combinations
8 1D FFT Support Code pure function number_of_bits(i) number_of_bits = 0 i_tmp = i do while (i_tmp .gt. 0) number_of_bits = number_of_bits + 1 i_tmp = ishft(i_tmp, -1) end do end function number_of_bits pure function bitreverse(i, n) interchange_bits(ival,imask,ishift) = & ior(ishft(iand(ival, imask), -ishift), & ishft(iand(ival, not(imask)), ishift)) parameter (mask32 = Z'FFFFFFFF00000000') parameter (mask16 = Z'FFFF0000FFFF0000') parameter (mask8 = Z'FF00FF00FF00FF00') parameter (mask4 = Z'F0F0F0F0F0F0F0F0') parameter (mask2 = Z'CCCCCCCCCCCCCCCC') parameter (mask1 = Z'AAAAAAAAAAAAAAAA') integer bitreverse itmp = interchange_bits(i, mask32, 32) itmp = interchange_bits(itmp, mask16, 16) itmp = interchange_bits(itmp, mask8, 8) itmp = interchange_bits(itmp, mask4, 4) itmp = interchange_bits(itmp, mask2, 2) itmp = interchange_bits(itmp, mask1, 1) bitreverse = ishft(itmp, n - 64) end function bitreverse bit level parallelism
**- Radix 2 FFT implementation
SPMD Implementation of FFT in CAF 2.
SPMD Element-wise Bitreverse in CAF Each processor performs reversal of a block [ rank * n / npe ... (rank + 1) * n/npe -1] local_n = n / npe global_j = rank * local_n do local_j = 0, local_n - 1 jrev = bitreverse(global_j, n_bits) processor = ishft(jrev, -local_n_bits) index = iand(jrev, local_mask) crev(index)[processor] = c(local_j) global_j = global_j + 1 enddo 11 log n - log p bits log P bits
FFT Performance 13
CAF 2.0 FFT Relative Parallel Efficiency
Course Objectives
- Learn fundamentals of parallel computing —principles of parallel algorithm design —programming models and methods —parallel computer architectures —modeling and analysis of parallel programs and systems **—parallel algorithms
Principles of Parallel Algorithm Design
- Algorithm models —data-parallel, task graph, work pool **—master slave, pipeline, hybrid
Programming Models
- Shared-memory parallel programming —Cilk/Cilk++ —OpenMP **—Pthreads
Parallel Architectures
- Control structure and communication models —control structure: SIMD, MIMD —communication models - shared address space - **message passing platforms