add pdf and zip
This commit is contained in:
parent
73509fd875
commit
fa5d7b2105
61
README.md
61
README.md
@ -1,61 +0,0 @@
|
|||||||
<p>
|
|
||||||
Gabriel Possenti Kheisa Drianasta<br>
|
|
||||||
19/442374/PA/19123
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
<h1>Hasil Tugas OpenMP</h1>
|
|
||||||
<h3>Pengujian terhadap 1, 2, 4, 8, 16, 32, hingga 64 thread</h3>
|
|
||||||
<h2>Hasil</h2>
|
|
||||||
<p>Matrix size: 4096</p>
|
|
||||||
<ul>
|
|
||||||
<li>1 Thread: 227.454 sec</li>
|
|
||||||
<li>2 Thread: 115.605 sec</li>
|
|
||||||
<li>4 Thread: 60.744 sec</li>
|
|
||||||
<li>8 Thread: 30.498 sec</li>
|
|
||||||
<li>16 Thread: 26.556 sec</li>
|
|
||||||
<li>32 Thread: 24.960 sec</li>
|
|
||||||
<li>64 Thread: 24.707 sec</li>
|
|
||||||
</ul>
|
|
||||||
<br>
|
|
||||||
<h3>Waktu (detik)</h3>
|
|
||||||
<img src="https://media.discordapp.net/attachments/1003173519879847966/1041940259719618560/image.png">
|
|
||||||
|
|
||||||
<h3>Selisih waktu terhadap jumlah core sebelumnya (detik)</h3>
|
|
||||||
<img src="https://cdn.discordapp.com/attachments/1003173519879847966/1042339831071657994/image.png">
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
<h1>Pertanyaan</h1>
|
|
||||||
<h3>1. What is the maximum speed up compared to single thread
|
|
||||||
execution?</h3>
|
|
||||||
<p>Dengan menghitung perbandingan selisih waktu yang di dapat antara 1 thread dengan 2 thread, yakni ( 227 / 115 ) detik, maka speedup yang di dapat adalah <b>1.97</b> kali. Dengan menggunakan rumus perhitungan speedup berikut:</p>
|
|
||||||
|
|
||||||
<img src="https://cdn.discordapp.com/attachments/1003173519879847966/1042413697986994176/image.png">
|
|
||||||
|
|
||||||
<p>Maka program bersifat <b>98.4%</b> parallel. Dengan persentase berikut,maka, perbandingan performa dengan program yang bersifat parallel sempurna adalah sebagai berikut:</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
Parallel 100% = [1, 2, 4, 8, 16, 32, 64]
|
|
||||||
Parallel 98.4% = [1, 1.97, 3.8, 7.19, 12.9, 21.4, 31.8]
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<img src="https://media.discordapp.net/attachments/1003173519879847966/1042418071593304117/image.png">
|
|
||||||
|
|
||||||
<p>Selisih speedup terbesar tampak pada jumlah thread <b>8 ke 16</b>, sama seperti hasil percobaan sebelumnya, sehingga penambahan jumlah core dari 8, ke 16, ke 32, dan seterusnya menjadi relatif lebih tidak efektif.</p>
|
|
||||||
|
|
||||||
<h3>2. As we increase the number of threads, the execution time starts to
|
|
||||||
saturate at one point (cannot get any faster). Explain why this
|
|
||||||
happens.</h3>
|
|
||||||
|
|
||||||
<p>Karena program tidak bersifat parallel sempurna (100%). Program bersifat 98.4% parallel, dimana <b>1.6%</b> bersifat serial. Bagian serial ini merupakan bagian yang tidak dapat dikerjakan secara parallel karena berbagai faktor. Meskipun angka tersebut kecil, selisih speedup dengan program yang dapat dijalankan secara parallel sempurna akan semakin terlihat dengan jumlah core atau thread yang semakin banyak.</p>
|
|
||||||
|
|
||||||
<img src="https://media.discordapp.net/attachments/1003173519879847966/1042420674385416202/image.png">
|
|
||||||
<img src="https://media.discordapp.net/attachments/1003173519879847966/1042421381591203871/image.png">
|
|
||||||
|
|
||||||
<h3>3. Find the exact number of threads where saturation begins. What is its relationship with the number of physical cores of the system?
|
|
||||||
Explain.</h3>
|
|
||||||
|
|
||||||
<p>Berdasarkan hasil yang terlampir, baik hasil eksperimen maupun perhitungan dengan Hukum Amdahl, <b>8 thread</b> merupakan jumlah core terbaik karena selisih waktu eksekusi (hasil percobaan) tidak begitu besar, sedangkan selisih speedup (perhitungan menggunakan Hukum Amdahl) sangat besar. Dengan kata lain, 8 thread ke 16 thread dan seterusnya relatif tidak efektif. Hubungan antara jumlah thread program dengan jumlah core adalah berbanding lurus dalam hal speedup dan berbanding terbalik dengan waktu eksekusi, dengan program yang bersifat 100% parallel.</p>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<p>Lampiran program dan hasil: https://repo.gabrielkheisa.xyz/gabrielkheisa/tugas3-openMP</p>
|
|
46
graph.html
46
graph.html
@ -1,46 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>
|
|
||||||
<body>
|
|
||||||
<canvas id="myChart" style="width:100%;max-width:600px"></canvas>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
var xValues = [1,2,4,8,16,32,64];
|
|
||||||
var data = [227.454, 115.605, 60.774, 30.498, 26.556, 24.960, 24.707];
|
|
||||||
var d_data = [];
|
|
||||||
|
|
||||||
var speedup = [1, 1.97, 3.8, 7.19, 12.9, 21.4, 31.8];
|
|
||||||
|
|
||||||
var i = 1;
|
|
||||||
|
|
||||||
while(i < data.length){
|
|
||||||
d_data[i] = data[i+1] - data[i];
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
1 Thread: 227.454 sec
|
|
||||||
2 Thread: 115.605 sec
|
|
||||||
4 Thread: 60.744 sec
|
|
||||||
8 Thread: 30.498 sec
|
|
||||||
16 Thread: 26.556 sec
|
|
||||||
32 Thread: 24.960 sec
|
|
||||||
64 Thread: 24.707 sec
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
new Chart("myChart", {
|
|
||||||
type: "line",
|
|
||||||
data: {
|
|
||||||
labels: xValues,
|
|
||||||
datasets: [{
|
|
||||||
data: data,
|
|
||||||
borderColor: "black",
|
|
||||||
fill: false
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
legend: {display: false}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
@ -1,15 +0,0 @@
|
|||||||
program summ
|
|
||||||
implicit none
|
|
||||||
integer :: sum = 0
|
|
||||||
integer :: n
|
|
||||||
!$OMP parallel do
|
|
||||||
do n = 0, 1000
|
|
||||||
sum = sum + n
|
|
||||||
print*, n, " ", sum
|
|
||||||
end do
|
|
||||||
!$OMP end parallel do
|
|
||||||
print*, " "
|
|
||||||
print*, " "
|
|
||||||
print*, " "
|
|
||||||
print*, "hasilnya adalah ", sum
|
|
||||||
end program summ
|
|
@ -1,12 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#SBATCH --nodes=1
|
|
||||||
#SBATCH --time=00:01:10
|
|
||||||
#SBATCH --job-name=Gabriel
|
|
||||||
|
|
||||||
whoami
|
|
||||||
hostname
|
|
||||||
|
|
||||||
gfortran -fopenmp no_reduction.f90 -o no_reduction.x
|
|
||||||
export OMP_NUM_THREADS=4
|
|
||||||
./no_reduction.x
|
|
BIN
no_reduction.x
BIN
no_reduction.x
Binary file not shown.
@ -1,4 +0,0 @@
|
|||||||
mahasiswa2
|
|
||||||
komputasi06
|
|
||||||
Matrix Size = 4096
|
|
||||||
Execution Time = 227.454 sec A(n,n) = 0.102092747142180D+04
|
|
@ -1,4 +0,0 @@
|
|||||||
mahasiswa2
|
|
||||||
komputasi06
|
|
||||||
Matrix Size = 4096
|
|
||||||
Execution Time = 115.605 sec A(n,n) = 0.102437460360345D+04
|
|
@ -1,4 +0,0 @@
|
|||||||
mahasiswa2
|
|
||||||
komputasi06
|
|
||||||
Matrix Size = 4096
|
|
||||||
Execution Time = 60.744 sec A(n,n) = 0.102843459928075D+04
|
|
@ -1,4 +0,0 @@
|
|||||||
mahasiswa2
|
|
||||||
komputasi06
|
|
||||||
Matrix Size = 4096
|
|
||||||
Execution Time = 30.498 sec A(n,n) = 0.100725125084073D+04
|
|
@ -1,4 +0,0 @@
|
|||||||
mahasiswa2
|
|
||||||
komputasi06
|
|
||||||
Matrix Size = 4096
|
|
||||||
Execution Time = 26.556 sec A(n,n) = 0.100253761446337D+04
|
|
@ -1,4 +0,0 @@
|
|||||||
mahasiswa2
|
|
||||||
komputasi03
|
|
||||||
Matrix Size = 4096
|
|
||||||
Execution Time = 24.960 sec A(n,n) = 0.101898724293035D+04
|
|
@ -1,4 +0,0 @@
|
|||||||
mahasiswa2
|
|
||||||
komputasi03
|
|
||||||
Matrix Size = 4096
|
|
||||||
Execution Time = 24.707 sec A(n,n) = 0.101964571498883D+04
|
|
29
tugas3.f90
29
tugas3.f90
@ -1,29 +0,0 @@
|
|||||||
program sample3
|
|
||||||
use omp_lib
|
|
||||||
|
|
||||||
implicit real(8)(a-h,o-z)
|
|
||||||
parameter (n=4096)
|
|
||||||
real(8) a(n,n), c(n,n)
|
|
||||||
real(4) b(n,n)
|
|
||||||
real*8 t1, t2
|
|
||||||
a=0.0d0
|
|
||||||
call random_number(b)
|
|
||||||
call random_number(c)
|
|
||||||
write(6,50) ' Matrix Size = ', n
|
|
||||||
50 format(1x,a,i5)
|
|
||||||
t1 = omp_get_wtime()
|
|
||||||
!$OMP PARALLEL DO
|
|
||||||
do j=1,n
|
|
||||||
do k=1,n
|
|
||||||
do i=1,n
|
|
||||||
a(i,j)=a(i,j)+b(i,k)*c(k,j)
|
|
||||||
end do
|
|
||||||
end do
|
|
||||||
end do
|
|
||||||
!$OMP END PARALLEL DO
|
|
||||||
t2 = omp_get_wtime()
|
|
||||||
write(6, 60) ' Execution Time = ',t2-t1,' sec',' A(n,n) = ',a(n,n)
|
|
||||||
60 format(1x,a,f10.3,a,1x,a,d24.15)
|
|
||||||
stop
|
|
||||||
|
|
||||||
end
|
|
13
tugas3.sh
13
tugas3.sh
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#SBATCH --nodes=1
|
|
||||||
#SBATCH --time=00:01:10
|
|
||||||
#SBATCH --job-name=Gabriel
|
|
||||||
|
|
||||||
whoami
|
|
||||||
hostname
|
|
||||||
|
|
||||||
gfortran -fopenmp tugas3.f90
|
|
||||||
export OMP_NUM_THREADS=512
|
|
||||||
ulimit -s unlimited
|
|
||||||
./a.out
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#SBATCH --nodes=1
|
|
||||||
#SBATCH --time=00:05:00
|
|
||||||
#SBATCH --job-name=Gabriel
|
|
||||||
|
|
||||||
whoami
|
|
||||||
hostname
|
|
||||||
|
|
||||||
gfortran -fopenmp tugas3.f90
|
|
||||||
export OMP_NUM_THREADS=16
|
|
||||||
ulimit -s unlimited
|
|
||||||
./a.out
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#SBATCH --nodes=1
|
|
||||||
#SBATCH --time=00:05:00
|
|
||||||
#SBATCH --job-name=Gabriel
|
|
||||||
|
|
||||||
whoami
|
|
||||||
hostname
|
|
||||||
|
|
||||||
gfortran -fopenmp tugas3.f90
|
|
||||||
export OMP_NUM_THREADS=1
|
|
||||||
ulimit -s unlimited
|
|
||||||
./a.out
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#SBATCH --nodes=1
|
|
||||||
#SBATCH --time=00:05:00
|
|
||||||
#SBATCH --job-name=Gabriel
|
|
||||||
|
|
||||||
whoami
|
|
||||||
hostname
|
|
||||||
|
|
||||||
gfortran -fopenmp tugas3.f90
|
|
||||||
export OMP_NUM_THREADS=2
|
|
||||||
ulimit -s unlimited
|
|
||||||
./a.out
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#SBATCH --nodes=1
|
|
||||||
#SBATCH --time=00:05:00
|
|
||||||
#SBATCH --job-name=Gabriel
|
|
||||||
|
|
||||||
whoami
|
|
||||||
hostname
|
|
||||||
|
|
||||||
gfortran -fopenmp tugas3.f90
|
|
||||||
export OMP_NUM_THREADS=32
|
|
||||||
ulimit -s unlimited
|
|
||||||
./a.out
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#SBATCH --nodes=1
|
|
||||||
#SBATCH --time=00:05:00
|
|
||||||
#SBATCH --job-name=Gabriel
|
|
||||||
|
|
||||||
whoami
|
|
||||||
hostname
|
|
||||||
|
|
||||||
gfortran -fopenmp tugas3.f90
|
|
||||||
export OMP_NUM_THREADS=4
|
|
||||||
ulimit -s unlimited
|
|
||||||
./a.out
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#SBATCH --nodes=1
|
|
||||||
#SBATCH --time=00:05:00
|
|
||||||
#SBATCH --job-name=Gabriel
|
|
||||||
|
|
||||||
whoami
|
|
||||||
hostname
|
|
||||||
|
|
||||||
gfortran -fopenmp tugas3.f90
|
|
||||||
export OMP_NUM_THREADS=64
|
|
||||||
ulimit -s unlimited
|
|
||||||
./a.out
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#SBATCH --nodes=1
|
|
||||||
#SBATCH --time=00:05:00
|
|
||||||
#SBATCH --job-name=Gabriel
|
|
||||||
|
|
||||||
whoami
|
|
||||||
hostname
|
|
||||||
|
|
||||||
gfortran -fopenmp tugas3.f90
|
|
||||||
export OMP_NUM_THREADS=8
|
|
||||||
ulimit -s unlimited
|
|
||||||
./a.out
|
|
@ -1,15 +0,0 @@
|
|||||||
program summ
|
|
||||||
implicit none
|
|
||||||
integer :: sum = 0
|
|
||||||
integer :: n
|
|
||||||
!$OMP parallel do
|
|
||||||
do n = 0, 1000
|
|
||||||
sum = sum + n
|
|
||||||
print*, n, " ", sum
|
|
||||||
end do
|
|
||||||
!$OMP end parallel do
|
|
||||||
print*, " "
|
|
||||||
print*, " "
|
|
||||||
print*, " "
|
|
||||||
print*, "hasilnya adalah ", sum
|
|
||||||
end program summ
|
|
@ -1,12 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#SBATCH --nodes=1
|
|
||||||
#SBATCH --time=00:01:10
|
|
||||||
#SBATCH --job-name=Gabriel
|
|
||||||
|
|
||||||
whoami
|
|
||||||
hostname
|
|
||||||
|
|
||||||
gfortran -fopenmp with_reduction.f90 -o with_reduction.x
|
|
||||||
export OMP_NUM_THREADS=4
|
|
||||||
./with_reduction.x
|
|
BIN
with_reduction.x
BIN
with_reduction.x
Binary file not shown.
Loading…
Reference in New Issue
Block a user