/[escript]/branches/doubleplusgood/paso/src/PasoUtil.cpp
ViewVC logotype

Diff of /branches/doubleplusgood/paso/src/PasoUtil.cpp

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

revision 4323 by jfenwick, Wed Feb 27 06:09:33 2013 UTC revision 4324 by jfenwick, Wed Mar 20 00:55:44 2013 UTC
# Line 108  index_t Paso_Util_cumsum(dim_t N,index_t Line 108  index_t Paso_Util_cumsum(dim_t N,index_t
108     int thread_num;     int thread_num;
109        
110     if (num_threads>1) {     if (num_threads>1) {
111        partial_sums=TMPMEMALLOC(num_threads, index_t);        partial_sums=new index_t[num_threads];
112        #pragma omp parallel private(sum,thread_num ,i,tmp)        #pragma omp parallel private(sum,thread_num ,i,tmp)
113        {        {
114          sum=0;          sum=0;
# Line 136  index_t Paso_Util_cumsum(dim_t N,index_t Line 136  index_t Paso_Util_cumsum(dim_t N,index_t
136            array[i]=tmp;            array[i]=tmp;
137          }          }
138        }        }
139        TMPMEMFREE(partial_sums);        delete[] partial_sums;
140     } else {     } else {
141        for (i=0;i<N;++i) {        for (i=0;i<N;++i) {
142           tmp=out;           tmp=out;
# Line 155  index_t Paso_Util_cumsum_maskedTrue(dim_ Line 155  index_t Paso_Util_cumsum_maskedTrue(dim_
155     int thread_num;     int thread_num;
156    
157     if (num_threads>1) {     if (num_threads>1) {
158        partial_sums=TMPMEMALLOC(num_threads, index_t);        partial_sums=new index_t[num_threads];
159        #pragma omp parallel private(sum,i,thread_num,tmp)        #pragma omp parallel private(sum,i,thread_num,tmp)
160        {        {
161           sum=0;           sum=0;
# Line 193  index_t Paso_Util_cumsum_maskedTrue(dim_ Line 193  index_t Paso_Util_cumsum_maskedTrue(dim_
193              }              }
194           }           }
195        }        }
196        TMPMEMFREE(partial_sums);        delete[] partial_sums;
197     } else { /* num_threads=1 */     } else { /* num_threads=1 */
198        for (i=0;i<N;++i) {        for (i=0;i<N;++i) {
199           if (mask[i]) {           if (mask[i]) {
# Line 215  index_t Paso_Util_cumsum_maskedFalse(dim Line 215  index_t Paso_Util_cumsum_maskedFalse(dim
215     int thread_num=0;     int thread_num=0;
216    
217     if (num_threads>1) {     if (num_threads>1) {
218        partial_sums=TMPMEMALLOC(num_threads,index_t);        partial_sums=new index_t[num_threads];
219        #pragma omp parallel private(sum,i,thread_num,tmp)        #pragma omp parallel private(sum,i,thread_num,tmp)
220        {        {
221           sum=0;           sum=0;
# Line 253  index_t Paso_Util_cumsum_maskedFalse(dim Line 253  index_t Paso_Util_cumsum_maskedFalse(dim
253              }              }
254           }           }
255        }        }
256        TMPMEMFREE(partial_sums);        delete[] partial_sums;
257     } else {     } else {
258        for (i=0;i<N;++i) {        for (i=0;i<N;++i) {
259           if (! mask[i]) {           if (! mask[i]) {

Legend:
Removed from v.4323  
changed lines
  Added in v.4324

  ViewVC Help
Powered by ViewVC 1.1.26