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
88efa2b2
Commit
88efa2b2
authored
11 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
num_threads is not a maximum, hack it a bit.
Former-commit-id: d3f471ae41aa56cda563101427acf170d3abad9d
parent
6a6f4b10
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/space.c
+11
-9
11 additions, 9 deletions
src/space.c
with
11 additions
and
9 deletions
src/space.c
+
11
−
9
View file @
88efa2b2
...
...
@@ -310,15 +310,16 @@ void space_rebuild ( struct space *s , double cell_max ) {
sure that the parts in each cell are ok. */
// tic = getticks();
k
=
0
;
#pragma omp parallel
num_threads(8)
shared(s,k)
#pragma omp parallel shared(s,k)
{
while
(
1
)
{
int
myk
=
atomic_inc
(
&
k
);
if
(
myk
<
s
->
nr_cells
)
space_split
(
s
,
&
s
->
cells
[
myk
]
);
else
break
;
}
if
(
omp_get_thread_num
()
<
8
)
while
(
1
)
{
int
myk
=
atomic_inc
(
&
k
);
if
(
myk
<
s
->
nr_cells
)
space_split
(
s
,
&
s
->
cells
[
myk
]
);
else
break
;
}
}
// printf( "space_rebuild: space_split took %.3f ms.\n" , (double)(getticks() - tic) / CPU_TPS * 1000 );
...
...
@@ -357,10 +358,11 @@ void parts_sort ( struct part *parts , int *ind , int N , int min , int max ) {
first
=
0
;
last
=
1
;
waiting
=
1
;
/* Parallel bit. */
#pragma omp parallel
num_threads(8)
default(shared) private(pivot,i,ii,j,jj,min,max,temp_i,qid,temp_p)
#pragma omp parallel default(shared) private(pivot,i,ii,j,jj,min,max,temp_i,qid,temp_p)
{
/* Main loop. */
if
(
omp_get_thread_num
()
<
8
)
while
(
waiting
>
0
)
{
/* Grab an interval off the queue. */
...
...
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