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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
0025151f
Commit
0025151f
authored
Aug 30, 2012
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
make sorting more memory-efficient.
Former-commit-id: 0b8d1b961353602dc0ec66a399cd1c4a7efb8f4c
parent
fa60b920
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
runner.c
+48
-27
48 additions, 27 deletions
runner.c
with
48 additions
and
27 deletions
runner.c
+
48
−
27
View file @
0025151f
...
...
@@ -882,7 +882,7 @@ void runner_dosort ( struct runner_thread *rt , struct cell *c , int flags ) {
int
j
,
k
,
count
=
c
->
count
;
int
cone
,
ctwo
;
int
i
,
ind
,
off
[
8
],
inds
[
8
],
temp_i
;
float
shift
[
3
];
//
float shift[3];
float
buff
[
8
];
struct
cell
*
temp_c
;
TIMER_TIC
...
...
@@ -998,34 +998,55 @@ void runner_dosort ( struct runner_thread *rt , struct cell *c , int flags ) {
}
/* progeny? */
/* Otherwise, just sort. */
else
{
/* Loop over the different cell axes. */
for
(
j
=
0
;
j
<
13
;
j
++
)
{
/* Has this sort array been flagged? */
if
(
!
(
flags
&
(
1
<<
j
)
)
)
continue
;
// else {
//
// /* Loop over the different cell axes. */
// for ( j = 0 ; j < 13 ; j++ ) {
//
// /* Has this sort array been flagged? */
// if ( !( flags & (1 << j) ) )
// continue;
//
// /* Get the shift vector. */
// shift[0] = runner_shift[ 3*j + 0 ];
// shift[1] = runner_shift[ 3*j + 1 ];
// shift[2] = runner_shift[ 3*j + 2 ];
//
// /* Fill the sort array. */
// finger = &c->sort[ j*(count + 1) ];
// for ( k = 0 ; k < count ; k++ ) {
// finger[k].i = k;
// finger[k].d = parts[k].x[0]*shift[0] + parts[k].x[1]*shift[1] + parts[k].x[2]*shift[2];
// }
//
// /* Add the sentinel. */
// finger[ c->count ].d = FLT_MAX;
// finger[ c->count ].i = 0;
//
// /* Sort descending. */
// runner_dosort_ascending( finger , c->count );
//
// }
//
// }
/* Get the shift vector. */
shift
[
0
]
=
runner_shift
[
3
*
j
+
0
];
shift
[
1
]
=
runner_shift
[
3
*
j
+
1
];
shift
[
2
]
=
runner_shift
[
3
*
j
+
2
];
/* Otherwise, just sort. */
else
{
/* Fill the sort array. */
finger
=
&
c
->
sort
[
j
*
(
count
+
1
)
];
for
(
k
=
0
;
k
<
count
;
k
++
)
{
finger
[
k
].
i
=
k
;
finger
[
k
].
d
=
parts
[
k
].
x
[
0
]
*
shift
[
0
]
+
parts
[
k
].
x
[
1
]
*
shift
[
1
]
+
parts
[
k
].
x
[
2
]
*
shift
[
2
]
;
}
/* Add the sentinel. */
finger
[
c
->
count
].
d
=
FLT_MAX
;
finger
[
c
->
count
].
i
=
0
;
/* Sort descending. */
runner_dosort_ascending
(
finger
,
c
->
count
)
;
for
(
k
=
0
;
k
<
count
;
k
++
)
for
(
j
=
0
;
j
<
13
;
j
++
)
if
(
flags
&
(
1
<<
j
)
)
{
c
->
sort
[
j
*
(
count
+
1
)
+
k
].
i
=
k
;
c
->
sort
[
j
*
(
count
+
1
)
+
k
].
d
=
parts
[
k
].
x
[
0
]
*
runner_shift
[
3
*
j
+
0
]
+
parts
[
k
].
x
[
1
]
*
runner_shift
[
3
*
j
+
1
]
+
parts
[
k
].
x
[
2
]
*
runner_shift
[
3
*
j
+
2
];
}
/* Add the sentinel and sort. */
for
(
j
=
0
;
j
<
13
;
j
++
)
if
(
flags
&
(
1
<<
j
)
)
{
c
->
sort
[
j
*
(
count
+
1
)
+
c
->
count
].
d
=
FLT_MAX
;
c
->
sort
[
j
*
(
count
+
1
)
+
c
->
count
].
i
=
0
;
runner_dosort_ascending
(
&
c
->
sort
[
j
*
(
count
+
1
)
]
,
c
->
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
sign in
to comment