This commit is contained in:
gabrielkheisa 2022-11-14 14:26:50 +07:00
commit 599f6846ce
4 changed files with 54 additions and 0 deletions

15
no_reduction.f90 Normal file
View File

@ -0,0 +1,15 @@
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

12
no_reduction.sh Normal file
View File

@ -0,0 +1,12 @@
#!/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

15
with_reduction.f90 Normal file
View File

@ -0,0 +1,15 @@
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

12
with_reduction.sh Normal file
View File

@ -0,0 +1,12 @@
#!/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