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
ccc5a424
Commit
ccc5a424
authored
11 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
better criteria for qsort stack size.
Former-commit-id: 55ba997429976684254c1bab363e7036ae6a6d4d
parent
51970d7d
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/space.c
+7
-3
7 additions, 3 deletions
src/space.c
with
7 additions
and
3 deletions
src/space.c
+
7
−
3
View file @
ccc5a424
...
@@ -520,13 +520,17 @@ void parts_sort ( struct part *parts , struct xpart *xparts , int *ind , int N ,
...
@@ -520,13 +520,17 @@ void parts_sort ( struct part *parts , struct xpart *xparts , int *ind , int N ,
volatile
int
ready
;
volatile
int
ready
;
};
};
struct
qstack
*
qstack
;
struct
qstack
*
qstack
;
int
qstack_size
=
(
max
-
min
)
/
2
+
10
;
int
qstack_size
=
2
*
(
max
-
min
)
+
10
;
volatile
unsigned
int
first
,
last
,
waiting
;
volatile
unsigned
int
first
,
last
,
waiting
;
int
pivot
;
int
pivot
;
int
i
,
ii
,
j
,
jj
,
temp_i
,
qid
;
int
i
,
ii
,
j
,
jj
,
temp_i
,
qid
;
struct
part
temp_p
;
struct
part
temp_p
;
struct
xpart
temp_xp
;
struct
xpart
temp_xp
;
/* for ( int k = 0 ; k < N ; k++ )
if ( ind[k] > max || ind[k] < min )
error( "ind[%i]=%i is not in [%i,%i]." , k , ind[k] , min , max ); */
/* Allocate the stack. */
/* Allocate the stack. */
if
(
(
qstack
=
malloc
(
sizeof
(
struct
qstack
)
*
qstack_size
)
)
==
NULL
)
if
(
(
qstack
=
malloc
(
sizeof
(
struct
qstack
)
*
qstack_size
)
)
==
NULL
)
...
@@ -543,7 +547,7 @@ void parts_sort ( struct part *parts , struct xpart *xparts , int *ind , int N ,
...
@@ -543,7 +547,7 @@ void parts_sort ( struct part *parts , struct xpart *xparts , int *ind , int N ,
first
=
0
;
last
=
1
;
waiting
=
1
;
first
=
0
;
last
=
1
;
waiting
=
1
;
/* Parallel bit. */
/* Parallel bit. */
#pragma omp parallel default(none) shared(first,last,waiting,qstack,parts,xparts,ind,qstack_size,stderr,engine_rank) private(pivot,i,ii,j,jj,min,max,temp_i,qid,temp_xp,temp_p)
#pragma omp parallel default(none) shared(
N,
first,last,waiting,qstack,parts,xparts,ind,qstack_size,stderr,engine_rank) private(pivot,i,ii,j,jj,min,max,temp_i,qid,temp_xp,temp_p)
{
{
/* Main loop. */
/* Main loop. */
...
@@ -662,7 +666,7 @@ void parts_sort ( struct part *parts , struct xpart *xparts , int *ind , int N ,
...
@@ -662,7 +666,7 @@ void parts_sort ( struct part *parts , struct xpart *xparts , int *ind , int N ,
/* Verify sort. */
/* Verify sort. */
/* for ( i = 1 ; i < N ; i++ )
/* for ( i = 1 ; i < N ; i++ )
if ( ind[i-1] > ind[i] )
if ( ind[i-1] > ind[i] )
error( "Sorting failed
!"
); */
error( "Sorting failed
(ind[%i]=%i,ind[%i]=%i)." , i-1 , ind[i-1] , i , ind[i]
); */
/* Clean up. */
/* Clean up. */
free
(
qstack
);
free
(
qstack
);
...
...
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