/[escript]/trunk/paso/src/PasoUtil.c
ViewVC logotype

Diff of /trunk/paso/src/PasoUtil.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2130 by ksteube, Thu Sep 25 23:11:13 2008 UTC revision 2131 by artak, Thu Dec 4 06:09:50 2008 UTC
# Line 50  index_t Paso_Util_cumsum(dim_t N,index_t Line 50  index_t Paso_Util_cumsum(dim_t N,index_t
50     #ifdef _OPENMP     #ifdef _OPENMP
51        index_t *partial_sums=NULL,sum;        index_t *partial_sums=NULL,sum;
52        partial_sums=TMPMEMALLOC(omp_get_max_threads(),index_t);        partial_sums=TMPMEMALLOC(omp_get_max_threads(),index_t);
53        #pragma omp parallel private(sum,i,tmp)        #pragma omp parallel private(sum,i)
54        {        {
55          sum=0;          sum=0;
56          #pragma omp for schedule(static)          #pragma omp for schedule(static)
57          for (i=0;i<N;++i) sum+=array[i];          for (i=0;i<N;++i) sum+=array[i];
58    
59          partial_sums[omp_get_thread_num()]=sum;          partial_sums[omp_get_thread_num()]=sum;
60          #pragma omp barrier        }
61          #pragma omp single  
62          {          {
63            out=0;            out=0;
64            for (i=0;i<omp_get_max_threads();++i) {            for (i=0;i<omp_get_max_threads();++i) {
# Line 67  index_t Paso_Util_cumsum(dim_t N,index_t Line 67  index_t Paso_Util_cumsum(dim_t N,index_t
67               partial_sums[i]=tmp;               partial_sums[i]=tmp;
68             }             }
69          }          }
70        
71          #pragma omp parallel private(sum,tmp,i)
72          {
73          sum=partial_sums[omp_get_thread_num()];          sum=partial_sums[omp_get_thread_num()];
74          #pragma omp for schedule(static)          #pragma omp for schedule(static)
75          for (i=0;i<N;++i) {          for (i=0;i<N;++i) {

Legend:
Removed from v.2130  
changed lines
  Added in v.2131

  ViewVC Help
Powered by ViewVC 1.1.26