Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QuickSched
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
QuickSched
Commits
d2dfab47
Commit
d2dfab47
authored
11 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
add qsched_flag_noreown and function qsched_res_own.
parent
a4d606e9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/test.c
+2
-2
2 additions, 2 deletions
examples/test.c
examples/test_bh.c
+14
-5
14 additions, 5 deletions
examples/test_bh.c
examples/test_qr.c
+1
-1
1 addition, 1 deletion
examples/test_qr.c
with
17 additions
and
8 deletions
examples/test.c
+
2
−
2
View file @
d2dfab47
...
...
@@ -118,7 +118,7 @@ void test2 ( int m , int n , int k , int nr_threads ) {
/* Build a task for each tile of the matrix c. */
for
(
i
=
0
;
i
<
m
;
i
++
)
for
(
j
=
0
;
j
<
n
;
j
++
)
{
rid
=
qsched_addres
(
&
s
,
-
1
);
rid
=
qsched_addres
(
&
s
,
qsched_owner_none
,
qsched_res_none
);
data
[
0
]
=
i
;
data
[
1
]
=
j
;
for
(
kk
=
0
;
kk
<
k
;
kk
++
)
{
data
[
2
]
=
kk
;
...
...
@@ -222,7 +222,7 @@ void test1 ( int m , int n , int k , int nr_threads ) {
for
(
i
=
0
;
i
<
m
;
i
++
)
for
(
j
=
0
;
j
<
n
;
j
++
)
{
data
[
0
]
=
i
;
data
[
1
]
=
j
;
rid
=
qsched_addres
(
&
s
,
-
1
);
rid
=
qsched_addres
(
&
s
,
qsched_owner_none
,
qsched_res_none
);
tid
=
qsched_addtask
(
&
s
,
1
,
task_flag_none
,
data
,
2
*
sizeof
(
int
)
,
1
);
qsched_addlock
(
&
s
,
tid
,
rid
);
}
...
...
This diff is collapsed.
Click to expand it.
examples/test_bh.c
+
14
−
5
View file @
d2dfab47
...
...
@@ -121,6 +121,7 @@ struct cell *cell_get ( ) {
* to the sched.
*
* @param c The #cell to be split.
* @param N The total number of parts.
* @param s The #sched to store the resources.
*/
...
...
@@ -131,10 +132,15 @@ void cell_split ( struct cell *c , struct qsched *s ) {
struct
cell
*
cp
;
int
left
[
8
],
right
[
8
];
double
pivot
[
3
];
static
struct
cell
*
root
=
NULL
;
/* Set the root cell. */
if
(
root
==
NULL
)
root
=
c
;
/* Add a resource for this cell if it doesn't have one yet. */
if
(
c
->
res
==
qsched_res_none
)
c
->
res
=
qsched_addres
(
s
,
qsched_res_none
);
c
->
res
=
qsched_addres
(
s
,
qsched_owner_none
,
qsched_res_none
);
/* Attach a center-of-mass task to the cell. */
c
->
com_tid
=
qsched_addtask
(
s
,
task_type_com
,
task_flag_none
,
&
c
,
sizeof
(
struct
cell
*
)
,
1
);
...
...
@@ -155,7 +161,7 @@ void cell_split ( struct cell *c , struct qsched *s ) {
cp
->
h
[
0
]
=
c
->
h
[
0
]
/
2
;
cp
->
h
[
1
]
=
c
->
h
[
1
]
/
2
;
cp
->
h
[
2
]
=
c
->
h
[
2
]
/
2
;
cp
->
res
=
qsched_addres
(
s
,
c
->
res
);
cp
->
res
=
qsched_addres
(
s
,
qsched_owner_none
,
c
->
res
);
if
(
k
&
4
)
cp
->
loc
[
0
]
+=
cp
->
h
[
0
];
if
(
k
&
2
)
...
...
@@ -230,6 +236,9 @@ void cell_split ( struct cell *c , struct qsched *s ) {
}
/* does the cell need to be split? */
/* Set this cell's resources ownership. */
qsched_res_own
(
s
,
c
->
res
,
s
->
nr_queues
*
(
c
->
parts
-
root
->
parts
)
/
root
->
count
);
}
...
...
@@ -644,7 +653,7 @@ void test_bh ( int N , int nr_threads , int runs ) {
}
/* Initialize the scheduler. */
qsched_init
(
&
s
,
nr_threads
,
qsched_flag_
yield
);
qsched_init
(
&
s
,
nr_threads
,
qsched_flag_
noreown
);
/* Init and fill the particle array. */
if
(
(
parts
=
(
struct
part
*
)
malloc
(
sizeof
(
struct
part
)
*
N
)
)
==
NULL
)
...
...
@@ -679,8 +688,8 @@ void test_bh ( int N , int nr_threads , int runs ) {
/* Execute the tasks. */
tic
=
getticks
();
qsched_run
(
&
s
,
nr_threads
,
runner
);
toc_run
=
getticks
();
message
(
"%ith run took %lli ticks..."
,
k
,
toc_run
-
tic
);
toc_run
=
getticks
();
message
(
"%ith run took %lli ticks..."
,
k
,
toc_run
-
tic
);
tot_run
+=
toc_run
-
tic
;
}
...
...
This diff is collapsed.
Click to expand it.
examples/test_qr.c
+
1
−
1
View file @
d2dfab47
...
...
@@ -309,7 +309,7 @@ void test_qr ( int m , int n , int K , int nr_threads , int runs ) {
error
(
"Failed to allocate tid/rid matrix."
);
for
(
k
=
0
;
k
<
m
*
n
;
k
++
)
{
tid
[
k
]
=
qsched_task_none
;
rid
[
k
]
=
qsched_addres
(
&
s
,
qsched_res_none
);
rid
[
k
]
=
qsched_addres
(
&
s
,
qsched_owner_none
,
qsched_res_none
);
}
/* Build the tasks. */
...
...
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