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
6547e61f
Commit
6547e61f
authored
10 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Removed commented-out routines not used in this version of the test.
parent
c7065bef
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/test_fmm.c
+8
-198
8 additions, 198 deletions
examples/test_fmm.c
with
8 additions
and
198 deletions
examples/test_fmm.c
+
8
−
198
View file @
6547e61f
...
@@ -362,21 +362,11 @@ void cell_split(struct cell *c, struct qsched *s) {
...
@@ -362,21 +362,11 @@ void cell_split(struct cell *c, struct qsched *s) {
qsched_addunlock
(
s
,
progenitors
[
k
]
->
com_tid
,
c
->
com_tid
);
qsched_addunlock
(
s
,
progenitors
[
k
]
->
com_tid
,
c
->
com_tid
);
#endif
#endif
/* /\* Otherwise, we're at a leaf, so create the cell's particle-cell task. *\/ */
/* } else { */
/* struct cell *data[2] = {root, c}; */
/* int tid = qsched_addtask(s, task_type_self_pc, task_flag_none, data, */
/* 2 * sizeof(struct cell *), 1); */
/* qsched_addlock(s, tid, c->res); */
/* #ifdef COM_AS_TASK */
/* qsched_addunlock(s, root->com_tid, tid); */
/* #endif */
}
/* does the cell need to be split? */
}
/* does the cell need to be split? */
/* Compute the cell's center of mass. */
#ifndef COM_AS_TASK
#ifndef COM_AS_TASK
/* Compute the cell's center of mass. */
comp_com
(
c
);
comp_com
(
c
);
#endif
#endif
...
@@ -438,33 +428,6 @@ static inline void make_interact_pc(struct part *parts, int count,
...
@@ -438,33 +428,6 @@ static inline void make_interact_pc(struct part *parts, int count,
}
/* loop over every particle. */
}
/* loop over every particle. */
}
}
/**
* @brief Checks whether the cell leaf is a subvolume of the cell c
*/
static
inline
int
is_inside
(
struct
cell
*
leaf
,
struct
cell
*
c
)
{
return
(
leaf
->
parts
>=
c
->
parts
)
&&
(
leaf
->
parts
<
c
->
parts
+
c
->
count
);
}
/**
* @brief Checks whether the cells are direct neighbours ot not
*/
static
inline
int
are_neighbours_different_size
(
struct
cell
*
ci
,
struct
cell
*
cj
)
{
double
cih
=
ci
->
h
,
cjh
=
cj
->
h
;
/* Maximum allowed distance */
float
min_dist
=
0
.
5
*
(
cih
+
cjh
);
/* (Manhattan) Distance between the cells */
for
(
int
k
=
0
;
k
<
3
;
k
++
)
{
float
center_i
=
ci
->
loc
[
k
]
+
0
.
5
*
cih
;
float
center_j
=
cj
->
loc
[
k
]
+
0
.
5
*
cjh
;
if
(
fabsf
(
center_i
-
center_j
)
>
min_dist
)
return
0
;
}
return
1
;
}
/**
/**
* @brief Checks whether the cells are direct neighbours ot not. Both cells have
* @brief Checks whether the cells are direct neighbours ot not. Both cells have
...
@@ -490,150 +453,14 @@ static inline int are_neighbours(struct cell *ci, struct cell *cj) {
...
@@ -490,150 +453,14 @@ static inline int are_neighbours(struct cell *ci, struct cell *cj) {
return
1
;
return
1
;
}
}
/* /\** */
/* * @brief Compute the interactions between all particles in a cell leaf */
/* * and the center of mass of all the cells in a part of the tree */
/* * described by ci and cj */
/* * */
/* * @param ci The #cell containing the particle */
/* * @param cj The #cell containing the center of mass. */
/* *\/ */
/* static inline void iact_pair_pc(struct cell *ci, struct cell *cj, */
/* struct cell *leaf, struct part_local *parts, */
/* int count, double *loc) { */
/* struct cell *cp, *cps; */
/* #ifdef SANITY_CHECKS */
/* /\* Early abort? *\/ */
/* if (ci->count == 0 || cj->count == 0) error("Empty cell !"); */
/* /\* Sanity check *\/ */
/* if (ci == cj) */
/* error("The impossible has happened: pair interaction between a cell and " */
/* "itself."); */
/* /\* Sanity check *\/ */
/* if (!is_inside(leaf, ci)) */
/* error("The impossible has happened: The leaf is not within ci"); */
/* /\* Are the cells direct neighbours? *\/ */
/* if (!are_neighbours(ci, cj)) error("Cells are not neighours"); */
/* /\* Are both cells split ? *\/ */
/* if (!ci->split || !cj->split) error("One of the cells is not split !"); */
/* #endif */
/* /\* Let's find in which subcell of ci the leaf is *\/ */
/* for (cp = ci->firstchild; cp != ci->sibling; cp = cp->sibling) { */
/* if (is_inside(leaf, cp)) break; */
/* } */
/* if (are_neighbours_different_size(cp, cj)) { */
/* /\* Now interact this subcell with all subcells of cj *\/ */
/* for (cps = cj->firstchild; cps != cj->sibling; cps = cps->sibling) { */
/* /\* Check whether we have to recurse or can directly jump to the multipole */
/* * calculation *\/ */
/* if (are_neighbours(cp, cps)) { */
/* /\* We only recurse if the children are split *\/ */
/* if (cp->split && cps->split) { */
/* iact_pair_pc(cp, cps, leaf, parts, count, loc); */
/* } */
/* } else { */
/* make_interact_pc(parts, count, loc, cps); */
/* } */
/* } */
/* } else { */
/* /\* If cp is not a neoghbour of cj, we can directly interact with the */
/* * multipoles *\/ */
/* for (cps = cj->firstchild; cps != cj->sibling; cps = cps->sibling) { */
/* make_interact_pc(parts, count, loc, cps); */
/* } */
/* } */
/* } */
/* /\** */
/* * @brief Compute the interactions between all particles in a leaf and */
/* * and all the monopoles in the cell c */
/* * */
/* * @param c The #cell containing the monopoles */
/* * @param leaf The #cell containing the particles */
/* *\/ */
/* static inline void iact_self_pc(struct cell *c, struct cell *leaf, */
/* struct part_local *parts) { */
/* struct cell *cp, *cps; */
/* int collect_part_data = 0; */
/* #ifdef SANITY_CHECKS */
/* /\* Early abort? *\/ */
/* if (c->count == 0) error("Empty cell !"); */
/* if (!c->split) error("Cell is not split !"); */
/* #endif */
/* /\* Get local copies of the particle data. *\/ */
/* if (parts == NULL) { */
/* int count = leaf->count; */
/* if ((parts = */
/* (struct part_local *)malloc(sizeof(struct part_local) * count)) == */
/* NULL) */
/* error("Failed to allocate local parts."); */
/* for (int k = 0; k < count; k++) { */
/* for (int j = 0; j < 3; j++) { */
/* parts[k].x[j] = leaf->parts[k].x[j] - leaf->loc[j]; */
/* parts[k].a[j] = 0.0f; */
/* } */
/* parts[k].mass = leaf->parts[k].mass; */
/* } */
/* collect_part_data = 1; */
/* } */
/* /\* Find in which subcell of c the leaf is *\/ */
/* for (cp = c->firstchild; cp != c->sibling; cp = cp->sibling) { */
/* /\* Only recurse if the leaf is in this part of the tree *\/ */
/* if (is_inside(leaf, cp)) break; */
/* } */
/* if (cp->split) { */
/* /\* Recurse if the cell can be split *\/ */
/* iact_self_pc(cp, leaf, parts); */
/* /\* Now, interact with every other subcell *\/ */
/* for (cps = c->firstchild; cps != c->sibling; cps = cps->sibling) { */
/* /\* Since cp and cps will be direct neighbours it is only worth recursing */
/* *\/ */
/* /\* if the cells can both be split *\/ */
/* if (cp != cps && cps->split) */
/* iact_pair_pc(cp, cps, leaf, parts, leaf->count, leaf->loc); */
/* } */
/* } */
/* /\* Clean up local parts? *\/ */
/* if (collect_part_data) { */
/* for (int k = 0; k < leaf->count; k++) { */
/* for (int j = 0; j < 3; j++) leaf->parts[k].a[j] += parts[k].a[j]; */
/* } */
/* free(parts); */
/* } */
/* } */
static
inline
void
iact_pair_pc
(
struct
cell
*
ci
,
struct
cell
*
cj
)
{
static
inline
void
iact_pair_pc
(
struct
cell
*
ci
,
struct
cell
*
cj
)
{
#ifdef SANITY_CHECKS
if
(
ci
->
h
!=
cj
->
h
)
error
(
" Cells of different size in distance calculation."
);
#endif
make_interact_pc
(
ci
->
parts
,
ci
->
count
,
ci
->
loc
,
cj
);
make_interact_pc
(
ci
->
parts
,
ci
->
count
,
ci
->
loc
,
cj
);
make_interact_pc
(
cj
->
parts
,
cj
->
count
,
cj
->
loc
,
ci
);
make_interact_pc
(
cj
->
parts
,
cj
->
count
,
cj
->
loc
,
ci
);
...
@@ -956,18 +783,6 @@ void create_tasks(struct qsched *s, struct cell *ci, struct cell *cj) {
...
@@ -956,18 +783,6 @@ void create_tasks(struct qsched *s, struct cell *ci, struct cell *cj) {
#endif
#endif
/* /\* Create the other task. *\/ */
/* data[1] = ci; */
/* data[0] = cj; */
/* tid = qsched_addtask(s, task_type_pair_pc, task_flag_none, data, */
/* sizeof(struct cell *) * 2, cj->count); */
/* /\* Add the resource and dependance *\/ */
/* qsched_addlock(s, tid, cj->res); */
/* #ifdef COM_AS_TASK */
/* qsched_addunlock(s, ci->com_tid, tid); */
/* #endif */
}
else
{
/* Cells are direct neighbours */
}
else
{
/* Cells are direct neighbours */
/* Are both cells split and we are above the task limit ? */
/* Are both cells split and we are above the task limit ? */
...
@@ -1414,13 +1229,8 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) {
...
@@ -1414,13 +1229,8 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) {
// fprintf(fileTime, "%lli %e\n", toc_run - tic, (float)(toc_run - tic));
// fprintf(fileTime, "%lli %e\n", toc_run - tic, (float)(toc_run - tic));
}
}
// fclose(fileTime);
// fclose(fileTime);
/* #if ICHECK >= 0 */
/* message("[check] accel of part %i is [%.3e,%.3e,%.3e]", ICHECK, */
/* root->parts[ICHECK].a_legacy[0], root->parts[ICHECK].a_legacy[1], */
/* root->parts[ICHECK].a_legacy[2]); */
/* #endif */
printf
(
"task counts: [ %10s %10s %10s %10s %10s ]
\n
"
,
"self"
,
"pair"
,
"m-poles"
,
printf
(
"task counts: [ %10s %10s %10s %10s %10s ]
\n
"
,
"self"
,
"pair"
,
"m-poles"
,
"direct"
,
"CoMs"
);
"direct"
,
"CoMs"
);
printf
(
"task counts: [ %10i %10i %10i %10i %10i ] (legacy).
\n
"
,
0
,
0
,
printf
(
"task counts: [ %10i %10i %10i %10i %10i ] (legacy).
\n
"
,
0
,
0
,
...
...
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