Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ScalFMM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
ScalFMM
Commits
70462345
Commit
70462345
authored
Oct 02, 2015
by
BRAMAS Berenger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update binding functions
parent
29204aaa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
Src/Utils/FBinding.hpp
Src/Utils/FBinding.hpp
+11
-3
No files found.
Src/Utils/FBinding.hpp
View file @
70462345
...
...
@@ -17,15 +17,23 @@ namespace FBinding {
#define FBINDING_ENABLE
#endif
inline
int
GetThreadBinding
(){
inline
long
GetThreadBinding
(){
// Mask will contain the current affinity
#ifdef FBINDING_ENABLE
unsigned
long
mask
=
0
;
cpu_set_t
mask
;
CPU_ZERO
(
&
mask
);
// We need the thread pid (even if we are in openmp)
pid_t
tid
=
(
pid_t
)
syscall
(
SYS_gettid
);
// Get the affinity
FAssertLF
(
sched_getaffinity
(
tid
,
sizeof
(
mask
),
(
cpu_set_t
*
)
&
mask
)
!=
-
1
);
return
int
(
mask
>>
1
);
long
cpus
=
0
;
for
(
size_t
idxCpu
=
0
;
idxCpu
<
sizeof
(
long
)
*
8
-
1
;
++
idxCpu
){
if
(
CPU_ISSET
(
idxCpu
,
&
mask
)){
cpus
|=
(
1
<<
idxCpu
);
}
}
return
cpus
;
#endif
return
-
1
;
}
...
...
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