Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openmp-lab-exercises
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pdc-summer-school
openmp-lab-exercises
Commits
86b490fc
Commit
86b490fc
authored
Jul 6, 2018
by
Xin Li
Browse files
Options
Downloads
Patches
Plain Diff
added hello.f90 and pi.f90
parent
0106bd2e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+3
-3
3 additions, 3 deletions
README.md
intro_lab/hello.f90
+9
-0
9 additions, 0 deletions
intro_lab/hello.f90
intro_lab/pi.f90
+41
-0
41 additions, 0 deletions
intro_lab/pi.f90
with
53 additions
and
3 deletions
README.md
+
3
−
3
View file @
86b490fc
...
...
@@ -48,9 +48,9 @@ The aim of these exercises is to give an introduction to OpenMP programming.
All examples are available in both C and Fortran90.
-
OpenMP Intro lab:
-
[
Instructions
](
intro_lab/OpenMPlab-assigment.pdf
)
]
-
Simple hello world program
[
in C
](
intro_lab/hello.c
)
and in Fortran
(TODO: add fortran
)
-
Calculate pi
[
in C
](
intro_lab/pi.c
)
and in Fortran
(TODO: add fortran
)
-
[
Instructions
](
intro_lab/OpenMPlab-assigment.pdf
)
-
Simple hello world program
[
in C
](
intro_lab/hello.c
)
and
[
in Fortran
](
intro_lab/hello.f90
)
-
Calculate pi
[
in C
](
intro_lab/pi.c
)
and
[
in Fortran
](
intro_lab/hello.f90
)
-
OpenMP Advanced Lab:
-
[
Instructions
](
advanced_lab/ompproj.pdf
)
-
In C:
[
shwater2d.c
](
advanced_lab/c/shwater2d.c
)
,
[
vtk_export.c
](
advanced_lab/c/vtk_export.c
)
and
[
Makefile
](
advanced_lab/c/Makefile
)
...
...
This diff is collapsed.
Click to expand it.
intro_lab/hello.f90
0 → 100644
+
9
−
0
View file @
86b490fc
program
hello
implicit
none
integer
::
thread_id
=
0
print
'("Hello World from thread ", i0)'
,
thread_id
end
program
This diff is collapsed.
Click to expand it.
intro_lab/pi.f90
0 → 100644
+
41
−
0
View file @
86b490fc
! This program will numerically compute the integral of
!
! 4/(1+x*x)
!
! from 0 to 1. The value of this integral is pi -- which
! is great since it gives us an easy way to check the answer.
!
! The is the original sequential program. It uses the timer
! from the OpenMP runtime library
!
! History: Written by Tim Mattson, 11/99.
program
calc_pi
use
omp_lib
implicit
none
integer
*
8
::
num_steps
=
100000000
real
*
8
step
integer
i
real
*
8
x
,
pi
,
raw_sum
real
*
8
start_time
,
run_time
step
=
1.0D0
/
num_steps
start_time
=
OMP_GET_WTIME
()
raw_sum
=
0.0
do
i
=
1
,
num_steps
x
=
(
i
-0.5
)
*
step
raw_sum
=
raw_sum
+
4.0
/(
1.0
+
x
*
x
)
enddo
pi
=
step
*
raw_sum
run_time
=
OMP_GET_WTIME
()
-
start_time
print
'(" pi with ", i0, " steps is ", f12.6, " in ", f12.6, " seconds")'
,
num_steps
,
pi
,
run_time
end
program
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment