Changeset 1499 for XIOS/dev/branch_openmp/extern/ep_dev/ep_reduce.cpp
- Timestamp:
- 05/16/18 15:56:55 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/ep_dev/ep_reduce.cpp
r1381 r1499 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 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 114 140 else printf("datatype Error\n"); 115 141 … … 160 186 } 161 187 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 162 202 else printf("datatype Error\n"); 163 203 … … 209 249 } 210 250 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 211 265 else printf("datatype Error\n"); 212 266 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 } 213 279 } 214 280 }
Note: See TracChangeset
for help on using the changeset viewer.