Skip to content
Snippets Groups Projects
Commit 88efa2b2 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

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
...@@ -310,15 +310,16 @@ void space_rebuild ( struct space *s , double cell_max ) { ...@@ -310,15 +310,16 @@ void space_rebuild ( struct space *s , double cell_max ) {
sure that the parts in each cell are ok. */ sure that the parts in each cell are ok. */
// tic = getticks(); // tic = getticks();
k = 0; k = 0;
#pragma omp parallel num_threads(8) shared(s,k) #pragma omp parallel shared(s,k)
{ {
while ( 1 ) { if ( omp_get_thread_num() < 8 )
int myk = atomic_inc( &k ); while ( 1 ) {
if ( myk < s->nr_cells ) int myk = atomic_inc( &k );
space_split( s , &s->cells[myk] ); if ( myk < s->nr_cells )
else space_split( s , &s->cells[myk] );
break; else
} break;
}
} }
// printf( "space_rebuild: space_split took %.3f ms.\n" , (double)(getticks() - tic) / CPU_TPS * 1000 ); // 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 ) { ...@@ -357,10 +358,11 @@ void parts_sort ( struct part *parts , int *ind , int N , int min , int max ) {
first = 0; last = 1; waiting = 1; first = 0; last = 1; waiting = 1;
/* Parallel bit. */ /* 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. */ /* Main loop. */
if ( omp_get_thread_num() < 8 )
while ( waiting > 0 ) { while ( waiting > 0 ) {
/* Grab an interval off the queue. */ /* Grab an interval off the queue. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment