Ignore:
Timestamp:
05/16/18 15:56:55 (6 years ago)
Author:
yushan
Message:

debugging for memory leaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_reduce.cpp

    r1381 r1499  
    2929 
    3030  template<typename T> 
     31  T lor_op(T a, T b) 
     32  { 
     33    return a||b; 
     34  } 
     35 
     36  template<typename T> 
    3137  void reduce_max(const T * buffer, T* recvbuf, int count) 
    3238  { 
     
    4450  { 
    4551    transform(buffer, buffer+count, recvbuf, recvbuf, std::plus<T>()); 
     52  } 
     53 
     54  template<typename T> 
     55  void reduce_lor(const T * buffer, T* recvbuf, int count) 
     56  { 
     57    transform(buffer, buffer+count, recvbuf, recvbuf, lor_op<T>); 
    4658  } 
    4759 
     
    112124        } 
    113125 
     126        else if(datatype == MPI_UINT64_T) 
     127        { 
     128          assert(datasize == sizeof(uint64_t)); 
     129          for(int i=1; i<num_ep; i++) 
     130            reduce_max<uint64_t>(static_cast<uint64_t*>(comm.my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count); 
     131        } 
     132         
     133        else if(datatype == MPI_LONG_LONG_INT) 
     134        { 
     135          assert(datasize == sizeof(long long)); 
     136          for(int i=1; i<num_ep; i++) 
     137            reduce_max<long long>(static_cast<long long*>(comm.my_buffer->void_buffer[i]), static_cast<long long*>(recvbuf), count); 
     138        } 
     139 
    114140        else printf("datatype Error\n"); 
    115141 
     
    160186        } 
    161187 
     188        else if(datatype == MPI_UINT64_T) 
     189        { 
     190          assert(datasize == sizeof(uint64_t)); 
     191          for(int i=1; i<num_ep; i++) 
     192            reduce_min<uint64_t>(static_cast<uint64_t*>(comm.my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count); 
     193        } 
     194         
     195        else if(datatype == MPI_LONG_LONG_INT) 
     196        { 
     197          assert(datasize == sizeof(long long)); 
     198          for(int i=1; i<num_ep; i++) 
     199            reduce_min<long long>(static_cast<long long*>(comm.my_buffer->void_buffer[i]), static_cast<long long*>(recvbuf), count); 
     200        } 
     201 
    162202        else printf("datatype Error\n"); 
    163203 
     
    209249        } 
    210250 
     251        else if(datatype ==MPI_UINT64_T) 
     252        { 
     253          assert(datasize == sizeof(uint64_t)); 
     254          for(int i=1; i<num_ep; i++) 
     255            reduce_sum<uint64_t>(static_cast<uint64_t*>(comm.my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count); 
     256        } 
     257         
     258        else if(datatype ==MPI_LONG_LONG_INT) 
     259        { 
     260          assert(datasize == sizeof(long long)); 
     261          for(int i=1; i<num_ep; i++) 
     262            reduce_sum<long long>(static_cast<long long*>(comm.my_buffer->void_buffer[i]), static_cast<long long*>(recvbuf), count); 
     263        } 
     264 
    211265        else printf("datatype Error\n"); 
    212266 
     267      } 
     268 
     269      if(op == MPI_LOR) 
     270      { 
     271        if(datatype != MPI_INT) 
     272          printf("datatype Error, must be MPI_INT\n"); 
     273        else 
     274        { 
     275          assert(datasize == sizeof(int)); 
     276          for(int i=1; i<num_ep; i++) 
     277            reduce_lor<int>(static_cast<int*>(comm.my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count); 
     278        } 
    213279      } 
    214280    } 
Note: See TracChangeset for help on using the changeset viewer.