Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
57490cba
Commit
57490cba
authored
Aug 24, 2016
by
Matthieu Schaller
Browse files
Make the entty affinity pointer a static variable in a function rather a global
parent
1a7ca9b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/engine.c
View file @
57490cba
...
...
@@ -85,11 +85,6 @@ const char *engine_policy_names[13] = {"none",
/** The rank of the engine as a global variable (for messages). */
int
engine_rank
;
#ifdef HAVE_SETAFFINITY
/** The initial affinity of the main thread (set by engin_pin()) */
static
cpu_set_t
entry_affinity
;
#endif
/**
* @brief Link a density/force task to a cell.
*
...
...
@@ -3010,6 +3005,7 @@ void engine_dump_snapshot(struct engine *e) {
static
cpu_set_t
*
engine_entry_affinity
()
{
static
int
use_entry_affinity
=
0
;
static
cpu_set_t
entry_affinity
;
if
(
!
use_entry_affinity
)
{
pthread_t
engine
=
pthread_self
();
...
...
@@ -3050,7 +3046,8 @@ void engine_pin() {
void
engine_unpin
()
{
#ifdef HAVE_SETAFFINITY
pthread_t
main_thread
=
pthread_self
();
pthread_setaffinity_np
(
main_thread
,
sizeof
(
entry_affinity
),
&
entry_affinity
);
cpu_set_t
*
entry_affinity
=
engine_entry_affinity
();
pthread_setaffinity_np
(
main_thread
,
sizeof
(
*
entry_affinity
),
entry_affinity
);
#else
error
(
"SWIFT was not compiled with support for pinning."
);
#endif
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment