Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Multicore GPU programming
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ylva Selling
Multicore GPU programming
Commits
958dd5c1
Commit
958dd5c1
authored
4 years ago
by
ylvse560
Browse files
Options
Downloads
Patches
Plain Diff
Better variable names
parent
bc1458cf
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Lab2/test.c
+8
-8
8 additions, 8 deletions
Lab2/test.c
with
8 additions
and
8 deletions
Lab2/test.c
+
8
−
8
View file @
958dd5c1
...
@@ -84,7 +84,7 @@ assert_fun(int expr, const char *str, const char *file, const char* function, si
...
@@ -84,7 +84,7 @@ assert_fun(int expr, const char *str, const char *file, const char* function, si
stack_t
*
stack
;
stack_t
*
stack
;
data_t
data
;
data_t
data
;
stack_t
*
empty
_stacks
[
NB_THREADS
];
stack_t
*
free
_stacks
[
NB_THREADS
];
#if MEASURE != 0
#if MEASURE != 0
struct
stack_measure_arg
struct
stack_measure_arg
...
@@ -106,7 +106,7 @@ stack_measure_pop(void* arg)
...
@@ -106,7 +106,7 @@ stack_measure_pop(void* arg)
for
(
i
=
0
;
i
<
MAX_PUSH_POP
/
NB_THREADS
;
i
++
)
for
(
i
=
0
;
i
<
MAX_PUSH_POP
/
NB_THREADS
;
i
++
)
{
{
// See how fast your implementation can pop MAX_PUSH_POP elements in parallel
// See how fast your implementation can pop MAX_PUSH_POP elements in parallel
stack_pop
(
stack
,
empty
_stacks
[
args
->
id
]);
stack_pop
(
stack
,
free
_stacks
[
args
->
id
]);
}
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
t_stop
[
args
->
id
]);
clock_gettime
(
CLOCK_MONOTONIC
,
&
t_stop
[
args
->
id
]);
...
@@ -123,7 +123,7 @@ stack_measure_push(void* arg)
...
@@ -123,7 +123,7 @@ stack_measure_push(void* arg)
for
(
i
=
0
;
i
<
MAX_PUSH_POP
/
NB_THREADS
;
i
++
)
for
(
i
=
0
;
i
<
MAX_PUSH_POP
/
NB_THREADS
;
i
++
)
{
{
// See how fast your implementation can push MAX_PUSH_POP elements in parallel
// See how fast your implementation can push MAX_PUSH_POP elements in parallel
stack_push
(
stack
,
empty
_stacks
[
args
->
id
],
i
);
stack_push
(
stack
,
free
_stacks
[
args
->
id
],
i
);
}
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
t_stop
[
args
->
id
]);
clock_gettime
(
CLOCK_MONOTONIC
,
&
t_stop
[
args
->
id
]);
...
@@ -159,12 +159,12 @@ test_setup()
...
@@ -159,12 +159,12 @@ test_setup()
//Allocate memory for many stacks
//Allocate memory for many stacks
for
(
int
i
=
0
;
i
<
NB_THREADS
;
i
++
)
for
(
int
i
=
0
;
i
<
NB_THREADS
;
i
++
)
{
{
empty
_stacks
[
i
]
=
malloc
(
sizeof
(
stack_t
));
free
_stacks
[
i
]
=
malloc
(
sizeof
(
stack_t
));
#if MEASURE == 1
#if MEASURE == 1
stack_init
(
empty
_stacks
[
i
],
0
);
stack_init
(
free
_stacks
[
i
],
0
);
#else
#else
stack_init
(
empty
_stacks
[
i
],
MAX_PUSH_POP
/
NB_THREADS
);
stack_init
(
free
_stacks
[
i
],
MAX_PUSH_POP
/
NB_THREADS
);
#endif
#endif
}
}
}
}
...
@@ -178,8 +178,8 @@ test_teardown()
...
@@ -178,8 +178,8 @@ test_teardown()
for
(
int
i
=
0
;
i
<
NB_THREADS
;
i
++
)
for
(
int
i
=
0
;
i
<
NB_THREADS
;
i
++
)
{
{
free_nodes
(
empty
_stacks
[
i
]);
free_nodes
(
free
_stacks
[
i
]);
free
(
empty
_stacks
[
i
]);
free
(
free
_stacks
[
i
]);
}
}
free_nodes
(
stack
);
free_nodes
(
stack
);
...
...
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