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
fda05e36
Commit
fda05e36
authored
12 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
take particle and task init into prepare.
Former-commit-id: db2a9a4f05f5fc86ef660e0861aaf7de341ae317
parent
7019f7b4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/engine.c
+25
-25
25 additions, 25 deletions
src/engine.c
with
25 additions
and
25 deletions
src/engine.c
+
25
−
25
View file @
fda05e36
...
...
@@ -60,7 +60,7 @@
void
engine_prepare
(
struct
engine
*
e
,
int
force
)
{
int
k
,
qid
,
changes
;
int
j
,
k
,
qid
,
changes
;
struct
space
*
s
=
e
->
s
;
/* Rebuild the space. */
...
...
@@ -88,6 +88,28 @@ void engine_prepare ( struct engine *e , int force ) {
}
/* Re-set the particle data. */
#pragma omp parallel for
for
(
k
=
0
;
k
<
s
->
nr_parts
;
k
++
)
{
s
->
parts
[
k
].
wcount
=
0
.
0
f
;
s
->
parts
[
k
].
wcount_dh
=
0
.
0
f
;
s
->
parts
[
k
].
rho
=
0
.
0
f
;
s
->
parts
[
k
].
rho_dh
=
0
.
0
f
;
}
/* Run throught the tasks and get all the waits right. */
#pragma omp parallel for private(j)
for
(
k
=
0
;
k
<
s
->
nr_tasks
;
k
++
)
{
for
(
j
=
0
;
j
<
s
->
tasks
[
k
].
nr_unlock_tasks
;
j
++
)
__sync_add_and_fetch
(
&
s
->
tasks
[
k
].
unlock_tasks
[
j
]
->
wait
,
1
);
for
(
j
=
0
;
j
<
s
->
tasks
[
k
].
nr_unlock_cells
;
j
++
)
__sync_add_and_fetch
(
&
s
->
tasks
[
k
].
unlock_cells
[
j
]
->
wait
,
1
);
}
/* Re-set the queues.*/
for
(
k
=
0
;
k
<
e
->
nr_queues
;
k
++
)
e
->
queues
[
k
].
next
=
0
;
}
...
...
@@ -193,27 +215,8 @@ void engine_barrier( struct engine *e ) {
void
engine_run
(
struct
engine
*
e
,
int
sort_queues
)
{
int
j
,
k
;
struct
space
*
s
=
e
->
s
;
/* Re-set the particle data. */
#pragma omp parallel for
for
(
k
=
0
;
k
<
s
->
nr_parts
;
k
++
)
{
s
->
parts
[
k
].
wcount
=
0
.
0
f
;
s
->
parts
[
k
].
wcount_dh
=
0
.
0
f
;
s
->
parts
[
k
].
rho
=
0
.
0
f
;
s
->
parts
[
k
].
rho_dh
=
0
.
0
f
;
}
/* Run throught the tasks and get all the waits right. */
#pragma omp parallel for private(j)
for
(
k
=
0
;
k
<
s
->
nr_tasks
;
k
++
)
{
for
(
j
=
0
;
j
<
s
->
tasks
[
k
].
nr_unlock_tasks
;
j
++
)
__sync_add_and_fetch
(
&
s
->
tasks
[
k
].
unlock_tasks
[
j
]
->
wait
,
1
);
for
(
j
=
0
;
j
<
s
->
tasks
[
k
].
nr_unlock_cells
;
j
++
)
__sync_add_and_fetch
(
&
s
->
tasks
[
k
].
unlock_cells
[
j
]
->
wait
,
1
);
}
int
k
;
/* Re-set the queues.*/
if
(
sort_queues
)
{
#pragma omp parallel for default(none), shared(e)
...
...
@@ -222,9 +225,6 @@ void engine_run ( struct engine *e , int sort_queues ) {
e
->
queues
[
k
].
next
=
0
;
}
}
else
for
(
k
=
0
;
k
<
e
->
nr_queues
;
k
++
)
e
->
queues
[
k
].
next
=
0
;
/* Cry havoc and let loose the dogs of war. */
e
->
barrier_count
=
-
e
->
barrier_count
;
...
...
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