Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
02e400ac
Commit
02e400ac
authored
12 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
add affinity.
Former-commit-id: c8a5f35fc4f66fe2d023b713896c7c7f82ef25f3
parent
08693c54
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+2
-2
2 additions, 2 deletions
Makefile
runner.c
+13
-0
13 additions, 0 deletions
runner.c
with
15 additions
and
2 deletions
Makefile
+
2
−
2
View file @
02e400ac
...
...
@@ -22,10 +22,10 @@
CC
=
gcc
FC
=
gfortran
OPTS
=
-DTIMER
-DCOUNTER
-DCPU_TPS
=
2.67e9
-DHAVE_ZLIB
OPTS
=
-DTIMER
-DCOUNTER
-DCPU_TPS
=
2.67e9
-DHAVE_ZLIB
-DHAVE_SETAFFINITY
-D_GNU_SOURCE
CFLAGS
=
-O3
-g
-std
=
gnu99
-Wall
-Werror
-march
=
native
-mtune
=
native
-ffast-math
-fomit-frame-pointer
-malign-double
-fstrict-aliasing
-fopenmp
# CFLAGS=-O0 -g -std=gnu99 -Wall -Werror -fopenmp
LDFLAGS
=
-lm
-lpthread
-fopenmp
-lz
LDFLAGS
=
-std
=
gnu99
-lm
-lpthread
-fopenmp
-lz
FFLAGS
=
$(
CFLAGS
)
...
...
This diff is collapsed.
Click to expand it.
runner.c
+
13
−
0
View file @
02e400ac
...
...
@@ -27,6 +27,7 @@
#include
<float.h>
#include
<limits.h>
#include
<omp.h>
#include
<sched.h>
/* Local headers. */
#include
"cycle.h"
...
...
@@ -1582,6 +1583,9 @@ struct task *queue_gettask ( struct queue *q , int blocking , int keep ) {
void
runner_init
(
struct
runner
*
r
,
struct
space
*
s
,
int
nr_threads
,
int
nr_queues
,
int
policy
)
{
#if defined(HAVE_SETAFFINITY)
cpu_set_t
cpuset
;
#endif
int
k
,
qid
,
nrq
;
/* Store the values. */
...
...
@@ -1647,6 +1651,15 @@ void runner_init ( struct runner *r , struct space *s , int nr_threads , int nr_
r
->
threads
[
k
].
r
=
r
;
if
(
pthread_create
(
&
r
->
threads
[
k
].
thread
,
NULL
,
&
runner_main
,
&
r
->
threads
[
k
]
)
!=
0
)
error
(
"Failed to create runner thread."
);
#if defined(HAVE_SETAFFINITY)
/* Set the cpu mask to zero | r->id. */
CPU_ZERO
(
&
cpuset
);
CPU_SET
(
r
->
threads
[
k
].
id
,
&
cpuset
);
/* Apply this mask to the runner's pthread. */
if
(
pthread_setaffinity_np
(
r
->
threads
[
k
].
thread
,
sizeof
(
cpu_set_t
)
,
&
cpuset
)
!=
0
)
error
(
"Failed to set thread affinity."
);
#endif
}
/* Wait for the runner threads to be in place. */
...
...
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