Presentasi sedang didownload. Silahkan tunggu

Presentasi sedang didownload. Silahkan tunggu

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. 2004.

Presentasi serupa


Presentasi berjudul: "Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. 2004."— Transcript presentasi:

1 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Embarrassingly Parallel Computations Partitioning and Divide-and-Conquer Strategies Pipelined Computations Synchronous Computations Asynchronous Computations Load Balancing and Termination Detection Teknik-teknik Paralel 3.1

2 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Chapter 3 Embarrassingly Parallel Computations 3.2

3 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Embarrassingly Parallel Computations Komputasi yang jelas dapat dibagi menjadi sejumlah bagian yang benar-benar independen, masing-masing dieksekusi oleh prosesor yang terpisah. Tidak ada atau hanya sedikit komunikasi antar proses. Setiap proses dapat melakukan tugasnya tanpa interaksi dengan proses lain. 3.3

4 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Practical embarrassingly parallel computation with static process creation and master-slave approach 3.4

5 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Practical embarrassingly parallel computation with dynamic process creation and master-slave approach 3.5

6 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Embarrassingly Parallel Computation Examples Low level image processing Mandelbrot set Monte Carlo Calculations 3.6

7 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Low level image processing Banyak operasi low level image processing yang hanya memakai data lokal dengan komunikasi yang sangat terbatas atau bahkan tidak ada sama sekali antara bagian-bagian yang terlibat. 3.7

8 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Beberapa operasi geometri Shifting Obyek shift (bergeser) sebesar  x pada dimensi-x dan  y pada dimensi-y: x = x +  x y = y +  y dengan x dan y merupakan posisi awal dan x dan y merupakan koordinat yang baru. Scaling Obyek di-skala sebesar faktor S x pada arah-x dan S y pada arah-y: x = xS x y = yS y 3.8

9 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Rotasi Obyek dirotasi sebesar sudut q dari titik awal sistem koordinat: x = x cos  + y sin  y = -x sin  + y cos  3.8

10 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Partisi menjadi bagian-bagian (region) untuk proses individu Square region untuk setiap proses 3.9

11 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Mandelbrot Set Satu set titik pada bidang kompleks yang quasi-stable (akan naik dan turun, tetapi tidak melampaui satu batas tertentu) ketika dihitung dengan meng-iterasi fungsi dengan z k +1 adalah iterasi ke-(k + 1) dari bilangan kompleks z = a + bi dan c adalah bilangan kompleks yang memberikan posisi titik di bidang kompleks. Nilai awal z adalah nol. Iterasi berlanjut sampai nilai z lebih besar dari 2 atau jumlah iterasi mencapai batar arbitrary. Besar z adalah panjang vektor yang dinyatakan dengan 3.10

12 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Rutin sekuensial untuk menghitung nilai satu titik yang merupakan jumlah iterasi structure complex { float real; float imag; }; int cal_pixel(complex c) { int count, max; complex z; float temp, lengthsq; max = 256; z.real = 0; z.imag = 0; count = 0; /* jumlah iterasi */ do { temp = z.real * z.real - z.imag * z.imag + c.real; z.imag = 2 * z.real * z.imag + c.imag; z.real = temp; lengthsq = z.real * z.real + z.imag * z.imag; count++; } while ((lengthsq < 4.0) && (count < max)); return count; } 3.11

13 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Mandelbrot set 3.12

14 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Memparalelkan Komputasi Mandelbrot Set Static Task Assignment Bagi region menjadi sejumlah tetap bagian, masing- masing dihitung oleh prosesor yang terpisah. Tidak begitu berhasil karena region yang berbeda membutuhkan jumlah dan waktu iterasi yang berbeda. Dynamic Task Assignment Prosesor meminta region setelah menghitung region sebelumnya. 3.13

15 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Dynamic Task Assignment Work Pool/Processor Farms 3.14

16 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Metode Monte Carlo Another embarrassingly parallel computation. Metode Monte Carlo menggunakan pemilihan random. 3.15

17 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Lingkaran dibentuk dengan persegi 2 x 2. Rasio luas lingkaran terhadap persegi dinyatakan dengan: Titik-titik di dalam persegi dipilih secara acak. Catat berapa titik ada dalam lingkaran. Bagian titik di dalam lingkaran menjadi, jika diberikan jumlah sample yang sesuai. 3.16

18 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. 3.17

19 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Menghitung Integral Satu kuadran dapat dideskripsikan oleh integral Pasangan bilangan acak, (xr,yr) dibandingkan, masing- masing antara 0 dan 1. Dihitung sebagai lingkaran jika 3.18

20 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Metode Alternatif (yang lebih baik) Gunakan nilai acak x untuk menghitung f(x) dan jumlah nilai f(x): dengan xr merupakan nilai x yang dibangkitkan secara acak antara x 1 dan x 2. Metode Monte Carlo sangat berguna jika fungsi tidak bisa diintegrasikan secara numerik (mungkin memiliki variabel yang banyak) 3.19

21 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. Contoh Menghitung integral Kode sekuensial sum = 0; for (i = 0; i < N; i++) { /* N random samples */ xr = rand_v(x1, x2); /* generate next random value */ sum = sum + xr * xr - 3 * xr; /* compute f(xr) */ } area = (sum / N) * (x2 - x1); Rutin randv(x1, x2) mengembalikan bilangan pseudorandom antara x1 dan x

22 Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M Pearson Education Inc. All rights reserved. For parallelizing Monte Carlo code, must address best way to generate random numbers in parallel - see textbook 3.21


Download ppt "Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. 2004."

Presentasi serupa


Iklan oleh Google