From 599f6846cef0242944bb7616ae866324080b56b9 Mon Sep 17 00:00:00 2001 From: gabrielkheisa Date: Mon, 14 Nov 2022 14:26:50 +0700 Subject: [PATCH] add --- no_reduction.f90 | 15 +++++++++++++++ no_reduction.sh | 12 ++++++++++++ with_reduction.f90 | 15 +++++++++++++++ with_reduction.sh | 12 ++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 no_reduction.f90 create mode 100644 no_reduction.sh create mode 100644 with_reduction.f90 create mode 100644 with_reduction.sh 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