Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
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
wenyuanbo
tic
Commits
e374abf8
Commit
e374abf8
authored
Mar 10, 2018
by
Pariksheet Pinjari
Committed by
Tianqi Chen
Mar 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix for Android platforms (
https://github.com/dmlc/tvm/pull/971
) (#986)
parent
f11f6b4e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
src/runtime/thread_pool.cc
+6
-0
No files found.
src/runtime/thread_pool.cc
View file @
e374abf8
...
...
@@ -355,6 +355,7 @@ class ThreadPool {
// bind worker threads to disjoint cores
void
SetThreadAffinity
()
{
#if defined(__ANDROID__)
#ifndef CPU_SET
#define CPU_SETSIZE 1024
#define __NCPUBITS (8 * sizeof (uint64_t))
typedef
struct
{
...
...
@@ -366,14 +367,19 @@ class ThreadPool {
#define CPU_ZERO(cpusetp) \
memset((cpusetp), 0, sizeof(cpu_set_t))
#endif
#endif
for
(
int
i
=
0
;
i
<
num_workers_
;
++
i
)
{
#if defined(__linux__) || defined(__ANDROID__)
cpu_set_t
cpuset
;
CPU_ZERO
(
&
cpuset
);
CPU_SET
(
i
,
&
cpuset
);
#if defined(__ANDROID__)
sched_setaffinity
(
threads_
[
i
].
native_handle
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
#else
pthread_setaffinity_np
(
threads_
[
i
].
native_handle
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
#endif
#endif
}
}
// Number of workers
...
...
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