Changeset 1460 for XIOS/dev/branch_openmp/extern/src_ep_dev/ep_reduce.cpp
- Timestamp:
- 03/22/18 10:43:20 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_reduce.cpp
r1365 r1460 29 29 30 30 template<typename T> 31 T lor_op(T a, T b) 32 { 33 return a||b; 34 } 35 36 template<typename T> 31 37 void reduce_max(const T * buffer, T* recvbuf, int count) 32 38 { … … 44 50 { 45 51 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>); 46 58 } 47 59 … … 112 124 } 113 125 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 114 133 else printf("datatype Error\n"); 115 134 … … 160 179 } 161 180 181 else if(datatype == MPI_UINT64_T) 182 { 183 assert(datasize == sizeof(uint64_t)); 184 for(int i=1; i<num_ep; i++) 185 reduce_min<uint64_t>(static_cast<uint64_t*>(comm.my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count); 186 } 187 162 188 else printf("datatype Error\n"); 163 189 … … 209 235 } 210 236 237 else if(datatype ==MPI_UINT64_T) 238 { 239 assert(datasize == sizeof(uint64_t)); 240 for(int i=1; i<num_ep; i++) 241 reduce_sum<uint64_t>(static_cast<uint64_t*>(comm.my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count); 242 } 243 211 244 else printf("datatype Error\n"); 212 245 246 } 247 248 if(op == MPI_SUM) 249 { 250 if(datatype != MPI_INT) 251 printf("datatype Error, must be MPI_INT\n"); 252 else 253 { 254 assert(datasize == sizeof(int)); 255 for(int i=1; i<num_ep; i++) 256 reduce_lor<int>(static_cast<int*>(comm.my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count); 257 } 213 258 } 214 259 }
Note: See TracChangeset
for help on using the changeset viewer.