Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Hailu, Dawit Abiy
ParallelPrimeSearch
Commits
b93d5115
Commit
b93d5115
authored
Jun 18, 2021
by
Behrens, Prof. Dr. Jörn
Browse files
initial commit of HelloMP
parent
aff2781d
Changes
4
Show whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
b93d5115
# compilation residuals
*.o
# main file
Hello
Hello.c
0 → 100644
View file @
b93d5115
/*****************************************************************
NAME:
Hello
Description:
this is about the simplest program thinkable to demonstrate
parallel execution with OpenMP
VERSION(S):
1. original version j. behrens 6/2021
*****************************************************************/
#include <stdio.h>
#include <omp.h>
int
main
(
int
argc
,
char
**
argv
)
{
/* local declarations */
int
thrd_id
;
/* this is the main print statement parallelized! */
#pragma omp parallel private(thrd_id)
{
thrd_id
=
omp_get_thread_num
();
printf
(
"Hello from process Number %d
\n
"
,
thrd_id
);
}
return
0
;
}
/* end of main */
Makefile
0 → 100644
View file @
b93d5115
# sample makefile for the C PPTemplate
# j. behrens 06/2021
CC
=
gcc
#
# THIS OPTION IS FOR THE DATA PARALLEL VERSION (-mp)
CCFLAGS
=
-fopenmp
-I
/opt/local/include
DATLIBS
=
-lgomp
-lm
OBJECTS
=
\
Hello.o
# default make
all
::
@
make Hello
@
make clear
# make object files
.c.o
:
${CC}
${CCFLAGS}
-c
$<
# make target (executable)
Hello
:
${OBJECTS}
${CC}
${CCFLAGS}
-o
$@
${OBJECTS}
${LIBS}
clear
::
@
rm
*
.o
README.md
View file @
b93d5115
# HelloMP
Yet another Hello World Program
## Description and Purpose
This O(1)-line code demonstrates parallelization with OpenMP
## Contents of this Project
```
README - this file
Makefile - Makefile tested for macOS
Hello.c - parallelized "Hello World" C-program
```
## What do do here
**First**
, build the executable by typing
```
%> make
```
If this fails, you have to adjust your path and settings, however,
I don't know how...
**Second**
, set up the number of threads (e.g. to four)
```
%> export OMP_NUM_THREADS=4
```
**Third**
, run the program
```
%> Hello
```
(c) 2021, Jörn Behrens (joern.behrens@uni-hamburg.de)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment