diff --git a/examples/test.c b/examples/test.c index e3aec83990aa07caf9351527dbf1141875728e88..e798e69cd8c1cabff9cb531e23819f11e5d5277f 100644 --- a/examples/test.c +++ b/examples/test.c @@ -32,7 +32,6 @@ #include <float.h> #include <limits.h> #include <fenv.h> -#include <omp.h> /* Conditional headers. */ #ifdef HAVE_LIBZ @@ -271,7 +270,6 @@ void pairs_n2 ( double *dim , struct part *__restrict__ parts , int N , int peri double rho_max = 0.0, rho_min = 100; /* Loop over all particle pairs. */ - #pragma omp parallel for schedule(dynamic), default(none), private(k,i,dx,r2), shared(periodic,parts,dim,N,stdout) for ( j = 0 ; j < N ; j++ ) { if ( j % 1000 == 0 ) { printf( "pairs_n2: j=%i.\n" , j ); @@ -291,13 +289,11 @@ void pairs_n2 ( double *dim , struct part *__restrict__ parts , int N , int peri if ( r2 < parts[j].h*parts[j].h || r2 < parts[k].h*parts[k].h ) { runner_iact_density( r2 , NULL , parts[j].h , parts[k].h , &parts[j] , &parts[k] ); /* if ( parts[j].h / parts[k].h > maxratio ) - #pragma omp critical { maxratio = parts[j].h / parts[k].h; mj = j; mk = k; } else if ( parts[k].h / parts[j].h > maxratio ) - #pragma omp critical { maxratio = parts[k].h / parts[j].h; mj = j; mk = k; @@ -658,7 +654,6 @@ int main ( int argc , char *argv[] ) { case 't': if ( sscanf( optarg , "%d" , &nr_threads ) != 1 ) error( "Error parsing number of threads." ); - omp_set_num_threads( nr_threads ); break; case 'w': if ( sscanf( optarg , "%d" , &space_subsize ) != 1 ) diff --git a/src/engine.c b/src/engine.c index 2633acdd7857978ff6ac90e63442546ae6660480..36b6215772f2220788aed71eeef7f89c94e0cdb6 100644 --- a/src/engine.c +++ b/src/engine.c @@ -29,7 +29,6 @@ #include <math.h> #include <float.h> #include <limits.h> -#include <omp.h> #include <sched.h> /* MPI headers. */ @@ -1041,7 +1040,6 @@ void engine_maketasks ( struct engine *e ) { /* Count the number of tasks associated with each cell and store the density tasks in each cell, and make each sort depend on the sorts of its progeny. */ - // #pragma omp parallel for private(t,j) for ( k = 0 ; k < sched->nr_tasks ; k++ ) { /* Get the current task. */ @@ -1112,7 +1110,6 @@ void engine_maketasks ( struct engine *e ) { Each force task depends on the cell ghosts and unlocks the kick2 task of its super-cell. */ kk = sched->nr_tasks; - // #pragma omp parallel for private(t,t2) for ( k = 0 ; k < kk ; k++ ) { /* Get a pointer to the task. */ diff --git a/src/proxy.c b/src/proxy.c index 2f1873029046325d114260c7e7c565b5f520ab99..a90ebc68e29566c00136e3189cd9fc024a37cb5e 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -29,7 +29,6 @@ #include <math.h> #include <float.h> #include <limits.h> -#include <omp.h> #include <sched.h> /* MPI headers. */ diff --git a/src/runner.c b/src/runner.c index 78171f4345d95925b90e83e27c2eafb4b38ff3df..71f425196622a99636118e62f6e4e1fef4f117e3 100644 --- a/src/runner.c +++ b/src/runner.c @@ -28,7 +28,6 @@ #include <math.h> #include <float.h> #include <limits.h> -#include <omp.h> /* MPI headers. */ #ifdef WITH_MPI diff --git a/src/scheduler.c b/src/scheduler.c index 91bde065d1c644b1b398aef908e34f44b03008c0..4c45303f1fb60a4ae2daf80dfda70de1c21361bc 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -27,7 +27,6 @@ #include <math.h> #include <pthread.h> #include <limits.h> -#include <omp.h> /* MPI headers. */ #ifdef WITH_MPI @@ -725,7 +724,6 @@ void scheduler_reweight ( struct scheduler *s ) { /* Run throught the tasks backwards and set their waits and weights. */ // tic = getticks(); - // #pragma omp parallel for schedule(static) private(t,j) for ( k = nr_tasks-1 ; k >= 0 ; k-- ) { t = &tasks[ tid[k] ]; t->weight = 0; @@ -810,7 +808,6 @@ void scheduler_start ( struct scheduler *s , unsigned int mask ) { /* Run throught the tasks and set their waits. */ // tic = getticks(); - // #pragma omp parallel for schedule(static) private(t,j) for ( k = nr_tasks - 1 ; k >= 0 ; k-- ) { t = &tasks[ tid[k] ]; t->wait = 0; diff --git a/src/space.c b/src/space.c index c91f920531735beff8e5e13227ffaef4438be402..15305c9265ebf504236e3f937a32cd137f43cb40 100644 --- a/src/space.c +++ b/src/space.c @@ -28,7 +28,7 @@ #include <float.h> #include <limits.h> #include <math.h> -#include <omp.h> + /* MPI headers. */ #ifdef WITH_MPI @@ -327,7 +327,6 @@ void space_rebuild ( struct space *s , double cell_max ) { ih[0] = s->ih[0]; ih[1] = s->ih[1]; ih[2] = s->ih[2]; dim[0] = s->dim[0]; dim[1] = s->dim[1]; dim[2] = s->dim[2]; cdim[0] = s->cdim[0]; cdim[1] = s->cdim[1]; cdim[2] = s->cdim[2]; - #pragma omp parallel for private(p,j) for ( k = 0 ; k < nr_parts ; k++ ) { p = &parts[k]; for ( j = 0 ; j < 3 ; j++ ) @@ -414,7 +413,6 @@ void space_rebuild ( struct space *s , double cell_max ) { // tic = getticks(); if ( ( ind = (int *)malloc( sizeof(int) * s->size_gparts ) ) == NULL ) error( "Failed to allocate temporary particle indices." ); - #pragma omp parallel for private(gp,j) for ( k = 0 ; k < nr_gparts ; k++ ) { gp = &gparts[k]; for ( j = 0 ; j < 3 ; j++ ) @@ -464,17 +462,15 @@ 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 shared(s,k) - { - if ( omp_get_thread_num() < 8 ) - while ( 1 ) { - int myk = atomic_inc( &k ); - if ( myk < s->nr_cells ) - space_split( 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 , &cells[myk] ); + else + break; + } + // message( "space_split took %.3f ms." , (double)(getticks() - tic) / CPU_TPS * 1000 ); } @@ -855,19 +851,9 @@ void space_map_parts ( struct space *s , void (*fun)( struct part *p , struct ce } /* Call the recursive function on all higher-level cells. */ - #pragma omp parallel shared(cid) - { - int mycid; - while ( 1 ) { - #pragma omp critical - mycid = cid++; - if ( mycid < s->nr_cells ) - rec_map( &s->cells[mycid] ); - else - break; - } - } - + for( cid = 0; cid < s->nr_cells; cid++ ) + rec_map( &s->cells[cid] ); + } @@ -901,18 +887,8 @@ void space_map_cells_post ( struct space *s , int full , void (*fun)( struct cel } /* Call the recursive function on all higher-level cells. */ - // #pragma omp parallel shared(s,cid) - { - int mycid; - while ( 1 ) { - // #pragma omp critical - mycid = cid++; - if ( mycid < s->nr_cells ) - rec_map( &s->cells[mycid] ); - else - break; - } - } + for ( cid = 0; cid < s->nr_cells; cid++ ) + rec_map( &s->cells[cid] ); } @@ -938,18 +914,9 @@ void space_map_cells_pre ( struct space *s , int full , void (*fun)( struct cell } /* Call the recursive function on all higher-level cells. */ - // #pragma omp parallel shared(s,cid) - { - int mycid; - while ( 1 ) { - // #pragma omp critical - mycid = cid++; - if ( mycid < s->nr_cells ) - rec_map( &s->cells[mycid] ); - else - break; - } - } + for (cid = 0; cid < s->nr_cells; cid++ ) + rec_map( &s->cells[cid] ); + } diff --git a/src/task.c b/src/task.c index ba15bf956f5ee87280da9e48cd4cbe7cb03e2ba4..94bacd3766d33865da8a6cbf64a0eb2f3aa2bad2 100644 --- a/src/task.c +++ b/src/task.c @@ -28,7 +28,6 @@ #include <math.h> #include <float.h> #include <limits.h> -#include <omp.h> #include <sched.h> /* MPI headers. */