commit 599f6846cef0242944bb7616ae866324080b56b9 Author: gabrielkheisa Date: Mon Nov 14 14:26:50 2022 +0700 add diff --git a/no_reduction.f90 b/no_reduction.f90 new file mode 100644 index 0000000..3b61e99 --- /dev/null +++ b/no_reduction.f90 @@ -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 \ No newline at end of file diff --git a/no_reduction.sh b/no_reduction.sh new file mode 100644 index 0000000..400b2b8 --- /dev/null +++ b/no_reduction.sh @@ -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 \ No newline at end of file diff --git a/with_reduction.f90 b/with_reduction.f90 new file mode 100644 index 0000000..3b61e99 --- /dev/null +++ b/with_reduction.f90 @@ -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 \ No newline at end of file diff --git a/with_reduction.sh b/with_reduction.sh new file mode 100644 index 0000000..f229a96 --- /dev/null +++ b/with_reduction.sh @@ -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 \ No newline at end of file