Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
openMP-HW
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hasan.bahjat
openMP-HW
Commits
7bfcf87c
You need to sign in or sign up before continuing.
Commit
7bfcf87c
authored
Nov 04, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Time Rule
parent
a4e4bda8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
13 deletions
+35
-13
MakeFile
MakeFile
+35
-13
No files found.
MakeFile
View file @
7bfcf87c
# Compiler and flags
CC
=
g++
CFLAGS
=
-fopenmp
-O2
CFLAGS
=
-fopenmp
-O2
-lm
PROF_FLAGS
=
-pg
# Source file
SRC
=
$(Pr)
# Parameters
N_THREADS
=
$(n)
N_RECTS
=
$(r)
PARAM
=
$(Params)
# Targets
TARGET_INTEGRAL
=
integral
TARGET_MANDELBROT
=
mandelbrot
# Directories
PROFILE_DIR
=
profiles
OUT_DIR
=
out
# Default target (builds both programs)
all
:
$(TARGET_INTEGRAL) $(TARGET_MANDELBROT)
all
:
$(TARGET_INTEGRAL) $(TARGET_MANDELBROT)
# Conditional build target
build
:
$(CC)
$(CFLAGS)
-o
$(SRC
)
$(Pr)
.c
$(CC)
$(CFLAGS)
-o
$(OUT_DIR)
/
$(Pr
)
$(Pr)
.c
# Conditional run target
run
:
./
$(SRC)
./
$(OUT_DIR)
/
$(SRC)
$(n)
$(r)
# Profile the specified program
profile
:
$(CC)
$(CFLAGS)
$(PROF_FLAGS)
-o
$(Pr)
$(SRC)
.c
./
$(SRC)
gprof
$(SRC)
.exe gmon.out
>
$(Pr)
_profile.txt
type
$(Pr)
_profile.txt
# create a folder for the profile file if not exist
@mkdir
-p
$(OUT_DIR)
$(CC)
$(CFLAGS)
$(PROF_FLAGS)
-o
$(OUT_DIR)/$(SRC)
$(SRC).c
./$(OUT_DIR)/$(SRC)
$(n)
$(r)
gprof
$(OUT_DIR)/$(SRC)
gmon.out
>
$(PROFILE_DIR)/$(Pr)_profile.txt
cat
$(PROFILE_DIR)/$(Pr)_profile.txt
# Time measurement rule
time
:
@
echo
"Timing execution of
$(Pr)
with
$(n)
threads "
@
time
$(OUT_DIR)
/
$(Pr)
$(n)
$(r)
>>
/dev/null
# Build each program individually
$(TARGET_INTEGRAL)
:
integral.c
$(CC)
$(CFLAGS)
-o
$(TARGET_INTEGRAL)
integral.c
$(CC)
$(CFLAGS)
-o
$(
OUT_DIR)
/
$(
TARGET_INTEGRAL)
integral.c
$(TARGET_MANDELBROT)
:
mandelbrot.c
pp
$(CC)
$(CFLAGS)
-o
$(
TARGET_MANDELBROT)
mandelbrot.cpp
$(TARGET_MANDELBROT)
:
mandelbrot.c
$(CC)
$(CFLAGS)
-o
$(
OUT_DIR)
/
$(TARGET_MANDELBROT)
mandelbrot.c
# Clean command
clean
:
rm
-f
$(TARGET_INTEGRAL)
$(TARGET_MANDELBROT)
gmon.out integral_profile.txt mandelbrot_profile.txt
rm
-rf
$(OUT_DIR)
/
*
$(PROFILE_DIR)
/
*
gmon.out
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