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
a71b2058
Commit
a71b2058
authored
10 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
minor fixes.
parent
4c283d4f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/test_bh.c
+9
-16
9 additions, 16 deletions
examples/test_bh.c
with
9 additions
and
16 deletions
examples/test_bh.c
+
9
−
16
View file @
a71b2058
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
/* Some local constants. */
/* Some local constants. */
#define cell_pool_grow 1000
#define cell_pool_grow 1000
#define cell_maxparts 1
#define cell_maxparts 1
00
#define task_limit 1e8
#define task_limit 1e8
#define const_G 1 // 6.6738e-8
#define const_G 1 // 6.6738e-8
#define dist_min 0.5
/* Used for legacy walk only */
#define dist_min 0.5
/* Used for legacy walk only */
...
@@ -386,9 +386,10 @@ void cell_split(struct cell *c, struct qsched *s) {
...
@@ -386,9 +386,10 @@ void cell_split(struct cell *c, struct qsched *s) {
*/
*/
static
inline
void
make_interact_pc
(
struct
cell
*
leaf
,
struct
cell
*
cj
)
{
static
inline
void
make_interact_pc
(
struct
cell
*
leaf
,
struct
cell
*
cj
)
{
int
j
,
k
;
int
j
,
k
,
count
=
leaf
->
count
;
double
com
[
3
]
=
{
0
.
0
,
0
.
0
,
0
.
0
};
double
com
[
3
]
=
{
0
.
0
,
0
.
0
,
0
.
0
};
float
mcom
,
dx
[
3
]
=
{
0
.
0
,
0
.
0
,
0
.
0
},
r2
,
ir
,
w
;
float
mcom
,
dx
[
3
]
=
{
0
.
0
,
0
.
0
,
0
.
0
},
r2
,
ir
,
w
;
struct
part
*
parts
=
leaf
->
parts
;
#ifdef SANITY_CHECKS
#ifdef SANITY_CHECKS
...
@@ -413,18 +414,18 @@ static inline void make_interact_pc(struct cell *leaf, struct cell *cj) {
...
@@ -413,18 +414,18 @@ static inline void make_interact_pc(struct cell *leaf, struct cell *cj) {
mcom
=
cj
->
new
.
mass
;
mcom
=
cj
->
new
.
mass
;
/* Loop over every particle in leaf. */
/* Loop over every particle in leaf. */
for
(
j
=
0
;
j
<
leaf
->
count
;
j
++
)
{
for
(
j
=
0
;
j
<
count
;
j
++
)
{
/* Compute the pairwise distance. */
/* Compute the pairwise distance. */
for
(
r2
=
0
.
0
,
k
=
0
;
k
<
3
;
k
++
)
{
for
(
r2
=
0
.
0
,
k
=
0
;
k
<
3
;
k
++
)
{
dx
[
k
]
=
com
[
k
]
-
leaf
->
parts
[
j
].
x
[
k
];
dx
[
k
]
=
com
[
k
]
-
parts
[
j
].
x
[
k
];
r2
+=
dx
[
k
]
*
dx
[
k
];
r2
+=
dx
[
k
]
*
dx
[
k
];
}
}
/* Apply the gravitational acceleration. */
/* Apply the gravitational acceleration. */
ir
=
1
.
0
f
/
sqrtf
(
r2
);
ir
=
1
.
0
f
/
sqrtf
(
r2
);
w
=
mcom
*
const_G
*
ir
*
ir
*
ir
;
w
=
mcom
*
const_G
*
ir
*
ir
*
ir
;
for
(
k
=
0
;
k
<
3
;
k
++
)
leaf
->
parts
[
j
].
a
[
k
]
+=
w
*
dx
[
k
];
for
(
k
=
0
;
k
<
3
;
k
++
)
parts
[
j
].
a
[
k
]
+=
w
*
dx
[
k
];
#if ICHECK >= 0
#if ICHECK >= 0
if
(
leaf
->
parts
[
j
].
id
==
ICHECK
)
if
(
leaf
->
parts
[
j
].
id
==
ICHECK
)
...
@@ -1211,7 +1212,8 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) {
...
@@ -1211,7 +1212,8 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) {
for
(
k
=
0
;
k
<
task_type_count
;
k
++
)
task_timers
[
k
]
=
0
;
for
(
k
=
0
;
k
<
task_type_count
;
k
++
)
task_timers
[
k
]
=
0
;
/* Initialize the scheduler. */
/* Initialize the scheduler. */
qsched_init
(
&
s
,
nr_threads
,
qsched_flag_noreown
);
qsched_init
(
&
s
,
nr_threads
,
qsched_flag_noreown
|
qsched_flag_pthread
);
/* Init and fill the particle array. */
/* Init and fill the particle array. */
if
((
parts
=
(
struct
part
*
)
malloc
(
sizeof
(
struct
part
)
*
N
))
==
NULL
)
if
((
parts
=
(
struct
part
*
)
malloc
(
sizeof
(
struct
part
)
*
N
))
==
NULL
)
...
@@ -1349,16 +1351,7 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) {
...
@@ -1349,16 +1351,7 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) {
parts
[
i
].
a
[
1
]
=
0
.
0
;
parts
[
i
].
a
[
1
]
=
0
.
0
;
parts
[
i
].
a
[
2
]
=
0
.
0
;
parts
[
i
].
a
[
2
]
=
0
.
0
;
}
}
struct
cell
*
finger
=
root
;
while
(
finger
!=
NULL
)
{
finger
->
sorted
=
0
;
if
(
finger
->
split
)
finger
=
finger
->
firstchild
;
else
finger
=
finger
->
sibling
;
}
/* Execute the tasks. */
/* Execute the tasks. */
tic
=
getticks
();
tic
=
getticks
();
qsched_run
(
&
s
,
nr_threads
,
runner
);
qsched_run
(
&
s
,
nr_threads
,
runner
);
...
...
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