Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
SWIFTsim
Commits
28b96e65
Commit
28b96e65
authored
9 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
formatting.
parent
4c7c4bf8
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!136
Master
,
!113
Local variable cleanup
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/engine.c
+70
-69
70 additions, 69 deletions
src/engine.c
with
70 additions
and
69 deletions
src/engine.c
+
70
−
69
View file @
28b96e65
...
@@ -374,12 +374,10 @@ void engine_addtasks_send(struct engine *e, struct cell *ci, struct cell *cj) {
...
@@ -374,12 +374,10 @@ void engine_addtasks_send(struct engine *e, struct cell *ci, struct cell *cj) {
if
(
l
!=
NULL
)
{
if
(
l
!=
NULL
)
{
/* Create the tasks. */
/* Create the tasks. */
struct
task
*
t_xv
=
struct
task
*
t_xv
=
scheduler_addtask
(
s
,
task_type_send
,
task_subtype_none
,
scheduler_addtask
(
s
,
task_type_send
,
task_subtype_none
,
2
*
ci
->
tag
,
0
,
ci
,
cj
,
0
);
2
*
ci
->
tag
,
0
,
ci
,
cj
,
0
);
struct
task
*
t_rho
=
scheduler_addtask
(
s
,
task_type_send
,
task_subtype_none
,
struct
task
*
t_rho
=
2
*
ci
->
tag
+
1
,
0
,
ci
,
cj
,
0
);
scheduler_addtask
(
s
,
task_type_send
,
task_subtype_none
,
2
*
ci
->
tag
+
1
,
0
,
ci
,
cj
,
0
);
/* The send_rho task depends on the cell's ghost task. */
/* The send_rho task depends on the cell's ghost task. */
scheduler_addunlock
(
s
,
ci
->
super
->
ghost
,
t_rho
);
scheduler_addunlock
(
s
,
ci
->
super
->
ghost
,
t_rho
);
...
@@ -421,12 +419,10 @@ void engine_addtasks_recv(struct engine *e, struct cell *c, struct task *t_xv,
...
@@ -421,12 +419,10 @@ void engine_addtasks_recv(struct engine *e, struct cell *c, struct task *t_xv,
if
(
t_xv
==
NULL
&&
c
->
nr_density
>
0
)
{
if
(
t_xv
==
NULL
&&
c
->
nr_density
>
0
)
{
/* Create the tasks. */
/* Create the tasks. */
t_xv
=
c
->
recv_xv
=
t_xv
=
c
->
recv_xv
=
scheduler_addtask
(
s
,
task_type_recv
,
task_subtype_none
,
scheduler_addtask
(
s
,
task_type_recv
,
task_subtype_none
,
2
*
c
->
tag
,
0
,
c
,
NULL
,
0
);
2
*
c
->
tag
,
0
,
c
,
NULL
,
0
);
t_rho
=
c
->
recv_rho
=
scheduler_addtask
(
t_rho
=
c
->
recv_rho
=
s
,
task_type_recv
,
task_subtype_none
,
2
*
c
->
tag
+
1
,
0
,
c
,
NULL
,
0
);
scheduler_addtask
(
s
,
task_type_recv
,
task_subtype_none
,
2
*
c
->
tag
+
1
,
0
,
c
,
NULL
,
0
);
}
}
/* Add dependencies. */
/* Add dependencies. */
...
@@ -686,7 +682,7 @@ int engine_exchange_strays(struct engine *e, int offset, int *ind, int N) {
...
@@ -686,7 +682,7 @@ int engine_exchange_strays(struct engine *e, int offset, int *ind, int N) {
// message( "request from proxy %i has arrived." , pid );
// message( "request from proxy %i has arrived." , pid );
if
(
reqs_in
[
pid
&
~
1
]
==
MPI_REQUEST_NULL
&&
if
(
reqs_in
[
pid
&
~
1
]
==
MPI_REQUEST_NULL
&&
reqs_in
[
pid
|
1
]
==
MPI_REQUEST_NULL
)
{
reqs_in
[
pid
|
1
]
==
MPI_REQUEST_NULL
)
{
struct
proxy
*
p
=
&
e
->
proxies
[
pid
>>
1
];
struct
proxy
*
p
=
&
e
->
proxies
[
pid
>>
1
];
memcpy
(
&
s
->
parts
[
offset
+
count
],
p
->
parts_in
,
memcpy
(
&
s
->
parts
[
offset
+
count
],
p
->
parts_in
,
sizeof
(
struct
part
)
*
p
->
nr_parts_in
);
sizeof
(
struct
part
)
*
p
->
nr_parts_in
);
memcpy
(
&
s
->
xparts
[
offset
+
count
],
p
->
xparts_in
,
memcpy
(
&
s
->
xparts
[
offset
+
count
],
p
->
xparts_in
,
...
@@ -744,7 +740,7 @@ void engine_maketasks(struct engine *e) {
...
@@ -744,7 +740,7 @@ void engine_maketasks(struct engine *e) {
for
(
int
k
=
0
;
k
<
cdim
[
2
];
k
++
)
{
for
(
int
k
=
0
;
k
<
cdim
[
2
];
k
++
)
{
int
cid
=
cell_getid
(
cdim
,
i
,
j
,
k
);
int
cid
=
cell_getid
(
cdim
,
i
,
j
,
k
);
if
(
cells
[
cid
].
count
==
0
)
continue
;
if
(
cells
[
cid
].
count
==
0
)
continue
;
struct
cell
*
ci
=
&
cells
[
cid
];
struct
cell
*
ci
=
&
cells
[
cid
];
if
(
ci
->
count
==
0
)
continue
;
if
(
ci
->
count
==
0
)
continue
;
if
(
ci
->
nodeID
==
nodeID
)
if
(
ci
->
nodeID
==
nodeID
)
scheduler_addtask
(
sched
,
task_type_self
,
task_subtype_density
,
0
,
0
,
scheduler_addtask
(
sched
,
task_type_self
,
task_subtype_density
,
0
,
0
,
...
@@ -762,7 +758,7 @@ void engine_maketasks(struct engine *e) {
...
@@ -762,7 +758,7 @@ void engine_maketasks(struct engine *e) {
if
(
!
s
->
periodic
&&
(
kkk
<
0
||
kkk
>=
cdim
[
2
]))
continue
;
if
(
!
s
->
periodic
&&
(
kkk
<
0
||
kkk
>=
cdim
[
2
]))
continue
;
kkk
=
(
kkk
+
cdim
[
2
])
%
cdim
[
2
];
kkk
=
(
kkk
+
cdim
[
2
])
%
cdim
[
2
];
int
cjd
=
cell_getid
(
cdim
,
iii
,
jjj
,
kkk
);
int
cjd
=
cell_getid
(
cdim
,
iii
,
jjj
,
kkk
);
struct
cell
*
cj
=
&
cells
[
cjd
];
struct
cell
*
cj
=
&
cells
[
cjd
];
if
(
cid
>=
cjd
||
cj
->
count
==
0
||
if
(
cid
>=
cjd
||
cj
->
count
==
0
||
(
ci
->
nodeID
!=
nodeID
&&
cj
->
nodeID
!=
nodeID
))
(
ci
->
nodeID
!=
nodeID
&&
cj
->
nodeID
!=
nodeID
))
continue
;
continue
;
...
@@ -819,7 +815,7 @@ void engine_maketasks(struct engine *e) {
...
@@ -819,7 +815,7 @@ void engine_maketasks(struct engine *e) {
for
(
int
k
=
0
;
k
<
sched
->
nr_tasks
;
k
++
)
{
for
(
int
k
=
0
;
k
<
sched
->
nr_tasks
;
k
++
)
{
/* Get the current task. */
/* Get the current task. */
struct
task
*
t
=
&
sched
->
tasks
[
k
];
struct
task
*
t
=
&
sched
->
tasks
[
k
];
if
(
t
->
skip
)
continue
;
if
(
t
->
skip
)
continue
;
/* Link sort tasks together. */
/* Link sort tasks together. */
...
@@ -883,7 +879,7 @@ void engine_maketasks(struct engine *e) {
...
@@ -883,7 +879,7 @@ void engine_maketasks(struct engine *e) {
for
(
int
k
=
0
;
k
<
sched_nr_tasks
;
k
++
)
{
for
(
int
k
=
0
;
k
<
sched_nr_tasks
;
k
++
)
{
/* Get a pointer to the task. */
/* Get a pointer to the task. */
struct
task
*
t
=
&
sched
->
tasks
[
k
];
struct
task
*
t
=
&
sched
->
tasks
[
k
];
/* Skip? */
/* Skip? */
if
(
t
->
skip
)
continue
;
if
(
t
->
skip
)
continue
;
...
@@ -892,8 +888,8 @@ void engine_maketasks(struct engine *e) {
...
@@ -892,8 +888,8 @@ void engine_maketasks(struct engine *e) {
if
(
t
->
type
==
task_type_self
&&
t
->
subtype
==
task_subtype_density
)
{
if
(
t
->
type
==
task_type_self
&&
t
->
subtype
==
task_subtype_density
)
{
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
init
,
t
);
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
init
,
t
);
scheduler_addunlock
(
sched
,
t
,
t
->
ci
->
super
->
ghost
);
scheduler_addunlock
(
sched
,
t
,
t
->
ci
->
super
->
ghost
);
struct
task
*
t2
=
scheduler_addtask
(
sched
,
task_type_self
,
task_subtype_force
,
0
,
0
,
struct
task
*
t2
=
scheduler_addtask
(
t
->
ci
,
NULL
,
0
);
sched
,
task_type_self
,
task_subtype_force
,
0
,
0
,
t
->
ci
,
NULL
,
0
);
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
ghost
,
t2
);
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
ghost
,
t2
);
scheduler_addunlock
(
sched
,
t2
,
t
->
ci
->
super
->
kick
);
scheduler_addunlock
(
sched
,
t2
,
t
->
ci
->
super
->
kick
);
t
->
ci
->
force
=
engine_addlink
(
e
,
t
->
ci
->
force
,
t2
);
t
->
ci
->
force
=
engine_addlink
(
e
,
t
->
ci
->
force
,
t2
);
...
@@ -902,8 +898,8 @@ void engine_maketasks(struct engine *e) {
...
@@ -902,8 +898,8 @@ void engine_maketasks(struct engine *e) {
/* Otherwise, pair interaction? */
/* Otherwise, pair interaction? */
else
if
(
t
->
type
==
task_type_pair
&&
t
->
subtype
==
task_subtype_density
)
{
else
if
(
t
->
type
==
task_type_pair
&&
t
->
subtype
==
task_subtype_density
)
{
struct
task
*
t2
=
scheduler_addtask
(
sched
,
task_type_pair
,
task_subtype_force
,
0
,
0
,
struct
task
*
t2
=
scheduler_addtask
(
t
->
ci
,
t
->
cj
,
0
);
sched
,
task_type_pair
,
task_subtype_force
,
0
,
0
,
t
->
ci
,
t
->
cj
,
0
);
if
(
t
->
ci
->
nodeID
==
nodeID
)
{
if
(
t
->
ci
->
nodeID
==
nodeID
)
{
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
init
,
t
);
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
init
,
t
);
scheduler_addunlock
(
sched
,
t
,
t
->
ci
->
super
->
ghost
);
scheduler_addunlock
(
sched
,
t
,
t
->
ci
->
super
->
ghost
);
...
@@ -924,8 +920,9 @@ void engine_maketasks(struct engine *e) {
...
@@ -924,8 +920,9 @@ void engine_maketasks(struct engine *e) {
/* Otherwise, sub interaction? */
/* Otherwise, sub interaction? */
else
if
(
t
->
type
==
task_type_sub
&&
t
->
subtype
==
task_subtype_density
)
{
else
if
(
t
->
type
==
task_type_sub
&&
t
->
subtype
==
task_subtype_density
)
{
struct
task
*
t2
=
scheduler_addtask
(
sched
,
task_type_sub
,
task_subtype_force
,
t
->
flags
,
struct
task
*
t2
=
0
,
t
->
ci
,
t
->
cj
,
0
);
scheduler_addtask
(
sched
,
task_type_sub
,
task_subtype_force
,
t
->
flags
,
0
,
t
->
ci
,
t
->
cj
,
0
);
if
(
t
->
ci
->
nodeID
==
nodeID
)
{
if
(
t
->
ci
->
nodeID
==
nodeID
)
{
scheduler_addunlock
(
sched
,
t
,
t
->
ci
->
super
->
ghost
);
scheduler_addunlock
(
sched
,
t
,
t
->
ci
->
super
->
ghost
);
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
ghost
,
t2
);
scheduler_addunlock
(
sched
,
t
->
ci
->
super
->
ghost
,
t2
);
...
@@ -1005,15 +1002,15 @@ int engine_marktasks(struct engine *e) {
...
@@ -1005,15 +1002,15 @@ int engine_marktasks(struct engine *e) {
for
(
int
k
=
0
;
k
<
nr_tasks
;
k
++
)
{
for
(
int
k
=
0
;
k
<
nr_tasks
;
k
++
)
{
/* Get a handle on the kth task. */
/* Get a handle on the kth task. */
struct
task
*
t
=
&
tasks
[
ind
[
k
]];
struct
task
*
t
=
&
tasks
[
ind
[
k
]];
/* Pair? */
/* Pair? */
if
(
t
->
type
==
task_type_pair
||
if
(
t
->
type
==
task_type_pair
||
(
t
->
type
==
task_type_sub
&&
t
->
cj
!=
NULL
))
{
(
t
->
type
==
task_type_sub
&&
t
->
cj
!=
NULL
))
{
/* Local pointers. */
/* Local pointers. */
const
struct
cell
*
ci
=
t
->
ci
;
const
struct
cell
*
ci
=
t
->
ci
;
const
struct
cell
*
cj
=
t
->
cj
;
const
struct
cell
*
cj
=
t
->
cj
;
/* Too much particle movement? */
/* Too much particle movement? */
if
(
t
->
tight
&&
if
(
t
->
tight
&&
...
@@ -1039,7 +1036,7 @@ int engine_marktasks(struct engine *e) {
...
@@ -1039,7 +1036,7 @@ int engine_marktasks(struct engine *e) {
for
(
int
k
=
0
;
k
<
nr_tasks
;
k
++
)
{
for
(
int
k
=
0
;
k
<
nr_tasks
;
k
++
)
{
/* Get a handle on the kth task. */
/* Get a handle on the kth task. */
struct
task
*
t
=
&
tasks
[
ind
[
k
]];
struct
task
*
t
=
&
tasks
[
ind
[
k
]];
/* Sort-task? Note that due to the task ranking, the sorts
/* Sort-task? Note that due to the task ranking, the sorts
will all come before the pairs. */
will all come before the pairs. */
...
@@ -1064,8 +1061,8 @@ int engine_marktasks(struct engine *e) {
...
@@ -1064,8 +1061,8 @@ int engine_marktasks(struct engine *e) {
(
t
->
type
==
task_type_sub
&&
t
->
cj
!=
NULL
))
{
(
t
->
type
==
task_type_sub
&&
t
->
cj
!=
NULL
))
{
/* Local pointers. */
/* Local pointers. */
const
struct
cell
*
ci
=
t
->
ci
;
const
struct
cell
*
ci
=
t
->
ci
;
const
struct
cell
*
cj
=
t
->
cj
;
const
struct
cell
*
cj
=
t
->
cj
;
/* Set this task's skip. */
/* Set this task's skip. */
t
->
skip
=
(
ci
->
ti_end_min
>
ti_end
&&
cj
->
ti_end_min
>
ti_end
);
t
->
skip
=
(
ci
->
ti_end_min
>
ti_end
&&
cj
->
ti_end_min
>
ti_end
);
...
@@ -1113,7 +1110,8 @@ int engine_marktasks(struct engine *e) {
...
@@ -1113,7 +1110,8 @@ int engine_marktasks(struct engine *e) {
}
}
}
}
// message( "took %.3f %s." , clocks_from_ticks(getticks() - tic), clocks_getunit());
// message( "took %.3f %s." , clocks_from_ticks(getticks() - tic),
// clocks_getunit());
/* All is well... */
/* All is well... */
return
0
;
return
0
;
...
@@ -1141,7 +1139,8 @@ void engine_print_task_counts(struct engine *e) {
...
@@ -1141,7 +1139,8 @@ void engine_print_task_counts(struct engine *e) {
printf
(
"[%03i] engine_print_task_counts: task counts are [ %s=%i"
,
e
->
nodeID
,
printf
(
"[%03i] engine_print_task_counts: task counts are [ %s=%i"
,
e
->
nodeID
,
taskID_names
[
0
],
counts
[
0
]);
taskID_names
[
0
],
counts
[
0
]);
#else
#else
printf
(
"engine_print_task_counts: task counts are [ %s=%i"
,
taskID_names
[
0
],
counts
[
0
]);
printf
(
"engine_print_task_counts: task counts are [ %s=%i"
,
taskID_names
[
0
],
counts
[
0
]);
#endif
#endif
for
(
int
k
=
1
;
k
<
task_type_count
;
k
++
)
for
(
int
k
=
1
;
k
<
task_type_count
;
k
++
)
printf
(
" %s=%i"
,
taskID_names
[
k
],
counts
[
k
]);
printf
(
" %s=%i"
,
taskID_names
[
k
],
counts
[
k
]);
...
@@ -1163,29 +1162,29 @@ void engine_rebuild(struct engine *e) {
...
@@ -1163,29 +1162,29 @@ void engine_rebuild(struct engine *e) {
/* Re-build the space. */
/* Re-build the space. */
// tic = getticks();
// tic = getticks();
space_rebuild
(
e
->
s
,
0
.
0
,
e
->
nodeID
==
0
);
space_rebuild
(
e
->
s
,
0
.
0
,
e
->
nodeID
==
0
);
// message( "space_rebuild took %.3f %s." ,
// message( "space_rebuild took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
//
clocks_from_ticks(getticks() - tic), clocks_getunit());
/* If in parallel, exchange the cell structure. */
/* If in parallel, exchange the cell structure. */
#ifdef WITH_MPI
#ifdef WITH_MPI
// tic = getticks();
// tic = getticks();
engine_exchange_cells
(
e
);
engine_exchange_cells
(
e
);
// message( "engine_exchange_cells took %.3f %s." ,
// message( "engine_exchange_cells took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
//
clocks_from_ticks(getticks() - tic), clocks_getunit());
#endif
#endif
/* Re-build the tasks. */
/* Re-build the tasks. */
// tic = getticks();
// tic = getticks();
engine_maketasks
(
e
);
engine_maketasks
(
e
);
// message( "engine_maketasks took %.3f %s." ,
// message( "engine_maketasks took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
//
clocks_from_ticks(getticks() - tic), clocks_getunit());
/* Run through the tasks and mark as skip or not. */
/* Run through the tasks and mark as skip or not. */
// tic = getticks();
// tic = getticks();
if
(
engine_marktasks
(
e
))
if
(
engine_marktasks
(
e
))
error
(
"engine_marktasks failed after space_rebuild."
);
error
(
"engine_marktasks failed after space_rebuild."
);
// message( "engine_marktasks took %.3f %s." ,
// message( "engine_marktasks took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
//
clocks_from_ticks(getticks() - tic), clocks_getunit());
/* Print the status of the system */
/* Print the status of the system */
engine_print_task_counts
(
e
);
engine_print_task_counts
(
e
);
...
@@ -1204,8 +1203,8 @@ void engine_prepare(struct engine *e) {
...
@@ -1204,8 +1203,8 @@ void engine_prepare(struct engine *e) {
/* Run through the tasks and mark as skip or not. */
/* Run through the tasks and mark as skip or not. */
// tic = getticks();
// tic = getticks();
int
rebuild
=
(
e
->
forcerebuild
||
engine_marktasks
(
e
));
int
rebuild
=
(
e
->
forcerebuild
||
engine_marktasks
(
e
));
// message( "space_marktasks took %.3f %s." ,
// message( "space_marktasks took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
//
clocks_from_ticks(getticks() - tic), clocks_getunit());
/* Collect the values of rebuild from all nodes. */
/* Collect the values of rebuild from all nodes. */
#ifdef WITH_MPI
#ifdef WITH_MPI
...
@@ -1215,8 +1214,8 @@ void engine_prepare(struct engine *e) {
...
@@ -1215,8 +1214,8 @@ void engine_prepare(struct engine *e) {
MPI_SUCCESS
)
MPI_SUCCESS
)
error
(
"Failed to aggregate the rebuild flag across nodes."
);
error
(
"Failed to aggregate the rebuild flag across nodes."
);
rebuild
=
buff
;
rebuild
=
buff
;
// message( "rebuild allreduce took %.3f %s." ,
// message( "rebuild allreduce took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
//
clocks_from_ticks(getticks() - tic), clocks_getunit());
#endif
#endif
e
->
tic_step
=
getticks
();
e
->
tic_step
=
getticks
();
...
@@ -1225,7 +1224,7 @@ void engine_prepare(struct engine *e) {
...
@@ -1225,7 +1224,7 @@ void engine_prepare(struct engine *e) {
// tic = getticks();
// tic = getticks();
engine_rebuild
(
e
);
engine_rebuild
(
e
);
// message( "engine_rebuild took %.3f %s." ,
// message( "engine_rebuild took %.3f %s." ,
//clocks_from_ticks(getticks() - tic), clocks_getunit());
//
clocks_from_ticks(getticks() - tic), clocks_getunit());
}
}
/* Re-rank the tasks every now and then. */
/* Re-rank the tasks every now and then. */
...
@@ -1233,7 +1232,7 @@ void engine_prepare(struct engine *e) {
...
@@ -1233,7 +1232,7 @@ void engine_prepare(struct engine *e) {
// tic = getticks();
// tic = getticks();
scheduler_reweight
(
&
e
->
sched
);
scheduler_reweight
(
&
e
->
sched
);
// message( "scheduler_reweight took %.3f %s." ,
// message( "scheduler_reweight took %.3f %s." ,
//clocks_from_ticks(getticks() -tic), clocks_getunit());
//
clocks_from_ticks(getticks() -tic), clocks_getunit());
}
}
e
->
tasks_age
+=
1
;
e
->
tasks_age
+=
1
;
...
@@ -1504,31 +1503,33 @@ void engine_step(struct engine *e) {
...
@@ -1504,31 +1503,33 @@ void engine_step(struct engine *e) {
/* Aggregate the data from the different nodes. */
/* Aggregate the data from the different nodes. */
#ifdef WITH_MPI
#ifdef WITH_MPI
{
{
int
in_i
[
4
],
out_i
[
4
];
int
in_i
[
4
],
out_i
[
4
];
out_i
[
0
]
=
ti_end_min
;
out_i
[
0
]
=
ti_end_min
;
if
(
MPI_Allreduce
(
out_i
,
in_i
,
1
,
MPI_INT
,
MPI_MIN
,
MPI_COMM_WORLD
)
!=
if
(
MPI_Allreduce
(
out_i
,
in_i
,
1
,
MPI_INT
,
MPI_MIN
,
MPI_COMM_WORLD
)
!=
MPI_SUCCESS
)
MPI_SUCCESS
)
error
(
"Failed to aggregate t_end_min."
);
error
(
"Failed to aggregate t_end_min."
);
ti_end_min
=
in_i
[
0
];
ti_end_min
=
in_i
[
0
];
out_i
[
0
]
=
ti_end_max
;
out_i
[
0
]
=
ti_end_max
;
if
(
MPI_Allreduce
(
out_i
,
in_i
,
1
,
MPI_INT
,
MPI_MAX
,
MPI_COMM_WORLD
)
!=
if
(
MPI_Allreduce
(
out_i
,
in_i
,
1
,
MPI_INT
,
MPI_MAX
,
MPI_COMM_WORLD
)
!=
MPI_SUCCESS
)
MPI_SUCCESS
)
error
(
"Failed to aggregate t_end_max."
);
error
(
"Failed to aggregate t_end_max."
);
ti_end_max
=
in_i
[
0
];
ti_end_max
=
in_i
[
0
];
}{
}
double
in_d
[
4
],
out_d
[
4
];
{
out_d
[
0
]
=
updates
;
double
in_d
[
4
],
out_d
[
4
];
out_d
[
1
]
=
e_kin
;
out_d
[
0
]
=
updates
;
out_d
[
2
]
=
e_int
;
out_d
[
1
]
=
e_kin
;
out_d
[
3
]
=
e_pot
;
out_d
[
2
]
=
e_int
;
if
(
MPI_Allreduce
(
out_d
,
in_d
,
4
,
MPI_DOUBLE
,
MPI_SUM
,
MPI_COMM_WORLD
)
!=
out_d
[
3
]
=
e_pot
;
MPI_SUCCESS
)
if
(
MPI_Allreduce
(
out_d
,
in_d
,
4
,
MPI_DOUBLE
,
MPI_SUM
,
MPI_COMM_WORLD
)
!=
error
(
"Failed to aggregate energies."
);
MPI_SUCCESS
)
updates
=
in_d
[
0
];
error
(
"Failed to aggregate energies."
);
e_kin
=
in_d
[
1
];
updates
=
in_d
[
0
];
e_int
=
in_d
[
2
];
e_kin
=
in_d
[
1
];
e_pot
=
in_d
[
3
];}
e_int
=
in_d
[
2
];
e_pot
=
in_d
[
3
];
}
#endif
#endif
// message("\nDRIFT\n");
// message("\nDRIFT\n");
...
@@ -1620,7 +1621,7 @@ void engine_step(struct engine *e) {
...
@@ -1620,7 +1621,7 @@ void engine_step(struct engine *e) {
clocks_gettime
(
&
time2
);
clocks_gettime
(
&
time2
);
e
->
wallclock_time
=
(
float
)
clocks_diff
(
&
time1
,
&
time2
);
e
->
wallclock_time
=
(
float
)
clocks_diff
(
&
time1
,
&
time2
);
// printParticle(e->s->parts, e->s->xparts,1000, e->s->nr_parts);
// printParticle(e->s->parts, e->s->xparts,1000, e->s->nr_parts);
// printParticle(e->s->parts, e->s->xparts,515050, e->s->nr_parts);
// printParticle(e->s->parts, e->s->xparts,515050, e->s->nr_parts);
}
}
...
...
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