Changeset 1540
- Timestamp:
- 06/12/18 14:21:57 (6 years ago)
- Location:
- XIOS/dev/branch_openmp
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/ep_dev/ep_exscan.cpp
r1527 r1540 122 122 reduce_sum<unsigned long>(static_cast<unsigned long*>(comm->my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count); 123 123 } 124 125 else printf("datatype Error\n");126 127 124 125 else if(datatype == MPI_LONG_LONG_INT ) 126 { 127 assert(datasize == sizeof(long long int)); 128 for(int i=0; i<ep_rank_loc; i++) 129 reduce_sum<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count); 130 } 131 132 else 133 { 134 printf("datatype Error in ep_exscan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 135 MPI_Abort(comm, 0); 136 } 137 138 128 139 } 129 140 … … 172 183 } 173 184 174 else printf("datatype Error\n"); 175 } 176 177 else //if(op == MPI_MIN) 185 else if(datatype == MPI_LONG_LONG_INT ) 186 { 187 assert(datasize == sizeof(long long int)); 188 for(int i=0; i<ep_rank_loc; i++) 189 reduce_max<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count); 190 } 191 192 else 193 { 194 printf("datatype Error in ep_exscan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 195 MPI_Abort(comm, 0); 196 } 197 } 198 199 else if(op == MPI_MIN) 178 200 { 179 201 if(datatype == MPI_INT ) … … 219 241 } 220 242 221 else printf("datatype Error\n"); 243 else if(datatype == MPI_LONG_LONG_INT ) 244 { 245 assert(datasize == sizeof(long long int)); 246 for(int i=0; i<ep_rank_loc; i++) 247 reduce_min<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count); 248 } 249 250 else 251 { 252 printf("datatype Error in ep_exscan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 253 MPI_Abort(comm, 0); 254 } 255 } 256 257 else 258 { 259 printf("op type Error in ep_exscan : MPI_MAX, MPI_MIN, MPI_SUM\n"); 260 MPI_Abort(comm, 0); 222 261 } 223 262 … … 231 270 if(comm->is_intercomm) return MPI_Exscan_intercomm(sendbuf, recvbuf, count, datatype, op, comm); 232 271 233 valid_type(datatype); 272 assert(valid_type(datatype)); 273 assert(valid_op(op)); 234 274 235 275 int ep_rank = comm->ep_comm_ptr->size_rank_info[0].first; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_intercomm.cpp
r1538 r1540 418 418 } 419 419 420 int my_turn= ownership==1? ep_rank_loc : ep_rank_loc+repeated;421 422 #ifdef _showinfo 423 424 MPI_Barrier(peer_comm); 425 MPI_Barrier(peer_comm); 426 printf("peer_rank = %d, ep_rank_loc = %d, ownership = %d, repeated = %d, my_turn = %d\n", peer_comm->ep_comm_ptr->size_rank_info[0].first, ep_rank_loc, ownership, repeated, my_turn);420 int new_ep_rank_loc = ownership==1? ep_rank_loc : ep_rank_loc+repeated; 421 422 #ifdef _showinfo 423 424 MPI_Barrier(peer_comm); 425 MPI_Barrier(peer_comm); 426 printf("peer_rank = %d, ep_rank_loc = %d, ownership = %d, repeated = %d, new_ep_rank_loc = %d\n", peer_comm->ep_comm_ptr->size_rank_info[0].first, ep_rank_loc, ownership, repeated, new_ep_rank_loc); 427 427 MPI_Barrier(peer_comm); 428 428 MPI_Barrier(peer_comm); … … 441 441 if(iter->first == make_pair(tag, min(local_leader_rank_in_world, remote_leader_rank_in_world))) 442 442 { 443 *newintercomm = iter->second.first[ my_turn];443 *newintercomm = iter->second.first[new_ep_rank_loc]; 444 444 445 445 iter->second.second.second++; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_lib.cpp
r1527 r1540 137 137 || datatype == MPI_LONG 138 138 || datatype == MPI_UNSIGNED_LONG 139 || datatype == MPI_ UINT64_T)139 || datatype == MPI_LONG_LONG) 140 140 { 141 141 return true; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_merge.cpp
r1527 r1540 31 31 32 32 (*newintracomm)->ep_comm_ptr->size_rank_info[0].second = ep_size + remote_ep_size; 33 34 /////////////////////////////////// 35 int int_high = high? 1 : 0; 36 int sum_high; 37 38 MPI_Allreduce(&int_high, &sum_high, 1, MPI_INT, MPI_SUM, *newintracomm); 39 40 if(sum_high==0 || sum_high==ep_size+remote_ep_size) 41 { 42 printf("MPI_Intercomm_merge error: please define high with different value...\n"); 43 MPI_Abort(inter_comm, 0); 44 } 45 46 47 48 /////////////////////////////////// 49 33 50 (*newintracomm)->ep_comm_ptr->size_rank_info[0].first = new_ep_rank; 34 51 … … 83 100 84 101 delete[] my_triple_list; 102 85 103 } 86 104 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_reduce.cpp
r1527 r1540 124 124 } 125 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 126 else if(datatype == MPI_LONG_LONG_INT) 134 127 { … … 138 131 } 139 132 140 else printf("datatype Error\n"); 141 142 } 143 144 if(op == MPI_MIN) 133 else 134 { 135 printf("datatype Error in ep_reduce : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 136 MPI_Abort(comm, 0); 137 } 138 139 } 140 141 else if(op == MPI_MIN) 145 142 { 146 143 if(datatype ==MPI_INT) … … 186 183 } 187 184 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 185 else if(datatype == MPI_LONG_LONG_INT) 196 186 { … … 200 190 } 201 191 202 else printf("datatype Error\n"); 203 204 } 205 206 207 if(op == MPI_SUM) 192 else 193 { 194 printf("datatype Error in ep_reduce : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 195 MPI_Abort(comm, 0); 196 } 197 198 } 199 200 201 else if(op == MPI_SUM) 208 202 { 209 203 if(datatype==MPI_INT) … … 247 241 for(int i=1; i<num_ep; i++) 248 242 reduce_sum<unsigned long>(static_cast<unsigned long*>(comm->my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count); 249 }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 243 } 257 244 … … 263 250 } 264 251 265 else printf("datatype Error\n"); 266 267 } 268 269 if(op == MPI_LOR) 252 else 253 { 254 printf("datatype Error in ep_reduce : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 255 MPI_Abort(comm, 0); 256 } 257 258 } 259 260 else if(op == MPI_LOR) 270 261 { 271 262 if(datatype != MPI_INT) … … 277 268 reduce_lor<int>(static_cast<int*>(comm->my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count); 278 269 } 270 } 271 272 else 273 { 274 printf("op type Error in ep_reduce : MPI_MAX, MPI_MIN, MPI_SUM, MPI_LOR\n"); 275 MPI_Abort(comm, 0); 279 276 } 280 277 } -
XIOS/dev/branch_openmp/extern/ep_dev/ep_scan.cpp
r1527 r1540 98 98 reduce_sum<unsigned long>(static_cast<unsigned long*>(const_cast<void*>(sendbuf)), static_cast<unsigned long*>(recvbuf), count); 99 99 } 100 101 else printf("datatype Error\n"); 100 101 else if(datatype == MPI_LONG_LONG_INT) 102 { 103 assert(datasize == sizeof(long long int)); 104 reduce_sum<long long int>(static_cast<long long int*>(const_cast<void*>(sendbuf)), static_cast<long long int*>(recvbuf), count); 105 } 106 107 else 108 { 109 printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 110 MPI_Abort(comm, 0); 111 } 102 112 } 103 113 … … 140 150 } 141 151 142 else printf("datatype Error\n"); 143 } 144 145 else //(op == MPI_MIN) 152 else if(datatype == MPI_LONG_LONG_INT) 153 { 154 assert(datasize == sizeof(long long int)); 155 reduce_max<long long int>(static_cast<long long int*>(const_cast<void*>(sendbuf)), static_cast<long long int*>(recvbuf), count); 156 } 157 158 else 159 { 160 printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 161 MPI_Abort(comm, 0); 162 } 163 } 164 165 else if(op == MPI_MIN) 146 166 { 147 167 if(datatype == MPI_INT ) … … 181 201 } 182 202 183 else printf("datatype Error\n"); 203 else if(datatype == MPI_LONG_LONG_INT) 204 { 205 assert(datasize == sizeof(long long int)); 206 reduce_min<long long int>(static_cast<long long int*>(const_cast<void*>(sendbuf)), static_cast<long long int*>(recvbuf), count); 207 } 208 209 else 210 { 211 printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 212 MPI_Abort(comm, 0); 213 } 214 } 215 216 else 217 { 218 printf("op type Error in ep_scan : MPI_MAX, MPI_MIN, MPI_SUM\n"); 219 MPI_Abort(comm, 0); 184 220 } 185 221 … … 243 279 reduce_sum<unsigned long>(static_cast<unsigned long*>(comm->my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count); 244 280 } 245 246 else printf("datatype Error\n"); 281 282 else if(datatype == MPI_LONG_LONG_INT ) 283 { 284 assert(datasize == sizeof(long long int)); 285 for(int i=1; i<ep_rank_loc+1; i++) 286 reduce_sum<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count); 287 } 288 289 else 290 { 291 printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 292 MPI_Abort(comm, 0); 293 } 247 294 248 295 … … 293 340 } 294 341 295 else printf("datatype Error\n"); 296 } 297 298 else //if(op == MPI_MIN) 342 else if(datatype == MPI_LONG_LONG_INT ) 343 { 344 assert(datasize == sizeof(long long int)); 345 for(int i=1; i<ep_rank_loc+1; i++) 346 reduce_max<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count); 347 } 348 349 else 350 { 351 printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 352 MPI_Abort(comm, 0); 353 } 354 355 } 356 357 else if(op == MPI_MIN) 299 358 { 300 359 if(datatype == MPI_INT ) … … 340 399 } 341 400 342 else printf("datatype Error\n"); 401 else if(datatype == MPI_LONG_LONG_INT ) 402 { 403 assert(datasize == sizeof(long long int)); 404 for(int i=1; i<ep_rank_loc+1; i++) 405 reduce_min<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count); 406 } 407 408 else 409 { 410 printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 411 MPI_Abort(comm, 0); 412 } 413 414 } 415 416 else 417 { 418 printf("op type Error in ep_scan : MPI_MAX, MPI_MIN, MPI_SUM\n"); 419 MPI_Abort(comm, 0); 343 420 } 344 421 -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_exscan.cpp
r1539 r1540 122 122 reduce_sum<unsigned long>(static_cast<unsigned long*>(comm->my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count); 123 123 } 124 125 else printf("datatype Error\n");126 127 124 125 else if(datatype == MPI_LONG_LONG_INT ) 126 { 127 assert(datasize == sizeof(long long int)); 128 for(int i=0; i<ep_rank_loc; i++) 129 reduce_sum<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count); 130 } 131 132 else 133 { 134 printf("datatype Error in ep_exscan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 135 MPI_Abort(comm, 0); 136 } 137 138 128 139 } 129 140 … … 172 183 } 173 184 174 else printf("datatype Error\n"); 175 } 176 177 else //if(op == MPI_MIN) 185 else if(datatype == MPI_LONG_LONG_INT ) 186 { 187 assert(datasize == sizeof(long long int)); 188 for(int i=0; i<ep_rank_loc; i++) 189 reduce_max<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count); 190 } 191 192 else 193 { 194 printf("datatype Error in ep_exscan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 195 MPI_Abort(comm, 0); 196 } 197 } 198 199 else if(op == MPI_MIN) 178 200 { 179 201 if(datatype == MPI_INT ) … … 219 241 } 220 242 221 else printf("datatype Error\n"); 243 else if(datatype == MPI_LONG_LONG_INT ) 244 { 245 assert(datasize == sizeof(long long int)); 246 for(int i=0; i<ep_rank_loc; i++) 247 reduce_min<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count); 248 } 249 250 else 251 { 252 printf("datatype Error in ep_exscan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 253 MPI_Abort(comm, 0); 254 } 255 } 256 257 else 258 { 259 printf("op type Error in ep_exscan : MPI_MAX, MPI_MIN, MPI_SUM\n"); 260 MPI_Abort(comm, 0); 222 261 } 223 262 … … 231 270 if(comm->is_intercomm) return MPI_Exscan_intercomm(sendbuf, recvbuf, count, datatype, op, comm); 232 271 233 valid_type(datatype); 272 assert(valid_type(datatype)); 273 assert(valid_op(op)); 234 274 235 275 int ep_rank = comm->ep_comm_ptr->size_rank_info[0].first; -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.cpp
r1539 r1540 137 137 || datatype == MPI_LONG 138 138 || datatype == MPI_UNSIGNED_LONG 139 || datatype == MPI_ UINT64_T)139 || datatype == MPI_LONG_LONG) 140 140 { 141 141 return true; -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_reduce.cpp
r1539 r1540 124 124 } 125 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 126 else if(datatype == MPI_LONG_LONG_INT) 134 127 { … … 138 131 } 139 132 140 else printf("datatype Error\n"); 141 142 } 143 144 if(op == MPI_MIN) 133 else 134 { 135 printf("datatype Error in ep_reduce : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 136 MPI_Abort(comm, 0); 137 } 138 139 } 140 141 else if(op == MPI_MIN) 145 142 { 146 143 if(datatype ==MPI_INT) … … 186 183 } 187 184 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 185 else if(datatype == MPI_LONG_LONG_INT) 196 186 { … … 200 190 } 201 191 202 else printf("datatype Error\n"); 203 204 } 205 206 207 if(op == MPI_SUM) 192 else 193 { 194 printf("datatype Error in ep_reduce : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 195 MPI_Abort(comm, 0); 196 } 197 198 } 199 200 201 else if(op == MPI_SUM) 208 202 { 209 203 if(datatype==MPI_INT) … … 247 241 for(int i=1; i<num_ep; i++) 248 242 reduce_sum<unsigned long>(static_cast<unsigned long*>(comm->my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count); 249 }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 243 } 257 244 … … 263 250 } 264 251 265 else printf("datatype Error\n"); 266 267 } 268 269 if(op == MPI_LOR) 252 else 253 { 254 printf("datatype Error in ep_reduce : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 255 MPI_Abort(comm, 0); 256 } 257 258 } 259 260 else if(op == MPI_LOR) 270 261 { 271 262 if(datatype != MPI_INT) … … 277 268 reduce_lor<int>(static_cast<int*>(comm->my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count); 278 269 } 270 } 271 272 else 273 { 274 printf("op type Error in ep_reduce : MPI_MAX, MPI_MIN, MPI_SUM, MPI_LOR\n"); 275 MPI_Abort(comm, 0); 279 276 } 280 277 } -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_scan.cpp
r1539 r1540 98 98 reduce_sum<unsigned long>(static_cast<unsigned long*>(const_cast<void*>(sendbuf)), static_cast<unsigned long*>(recvbuf), count); 99 99 } 100 101 else printf("datatype Error\n"); 100 101 else if(datatype == MPI_LONG_LONG_INT) 102 { 103 assert(datasize == sizeof(long long int)); 104 reduce_sum<long long int>(static_cast<long long int*>(const_cast<void*>(sendbuf)), static_cast<long long int*>(recvbuf), count); 105 } 106 107 else 108 { 109 printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 110 MPI_Abort(comm, 0); 111 } 102 112 } 103 113 … … 140 150 } 141 151 142 else printf("datatype Error\n"); 143 } 144 145 else //(op == MPI_MIN) 152 else if(datatype == MPI_LONG_LONG_INT) 153 { 154 assert(datasize == sizeof(long long int)); 155 reduce_max<long long int>(static_cast<long long int*>(const_cast<void*>(sendbuf)), static_cast<long long int*>(recvbuf), count); 156 } 157 158 else 159 { 160 printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 161 MPI_Abort(comm, 0); 162 } 163 } 164 165 else if(op == MPI_MIN) 146 166 { 147 167 if(datatype == MPI_INT ) … … 181 201 } 182 202 183 else printf("datatype Error\n"); 203 else if(datatype == MPI_LONG_LONG_INT) 204 { 205 assert(datasize == sizeof(long long int)); 206 reduce_min<long long int>(static_cast<long long int*>(const_cast<void*>(sendbuf)), static_cast<long long int*>(recvbuf), count); 207 } 208 209 else 210 { 211 printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 212 MPI_Abort(comm, 0); 213 } 214 } 215 216 else 217 { 218 printf("op type Error in ep_scan : MPI_MAX, MPI_MIN, MPI_SUM\n"); 219 MPI_Abort(comm, 0); 184 220 } 185 221 … … 243 279 reduce_sum<unsigned long>(static_cast<unsigned long*>(comm->my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count); 244 280 } 245 246 else printf("datatype Error\n"); 281 282 else if(datatype == MPI_LONG_LONG_INT ) 283 { 284 assert(datasize == sizeof(long long int)); 285 for(int i=1; i<ep_rank_loc+1; i++) 286 reduce_sum<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count); 287 } 288 289 else 290 { 291 printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 292 MPI_Abort(comm, 0); 293 } 247 294 248 295 … … 293 340 } 294 341 295 else printf("datatype Error\n"); 296 } 297 298 else //if(op == MPI_MIN) 342 else if(datatype == MPI_LONG_LONG_INT ) 343 { 344 assert(datasize == sizeof(long long int)); 345 for(int i=1; i<ep_rank_loc+1; i++) 346 reduce_max<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count); 347 } 348 349 else 350 { 351 printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 352 MPI_Abort(comm, 0); 353 } 354 355 } 356 357 else if(op == MPI_MIN) 299 358 { 300 359 if(datatype == MPI_INT ) … … 340 399 } 341 400 342 else printf("datatype Error\n"); 401 else if(datatype == MPI_LONG_LONG_INT ) 402 { 403 assert(datasize == sizeof(long long int)); 404 for(int i=1; i<ep_rank_loc+1; i++) 405 reduce_min<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count); 406 } 407 408 else 409 { 410 printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n"); 411 MPI_Abort(comm, 0); 412 } 413 414 } 415 416 else 417 { 418 printf("op type Error in ep_scan : MPI_MAX, MPI_MIN, MPI_SUM\n"); 419 MPI_Abort(comm, 0); 343 420 } 344 421 -
XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.cpp
r1520 r1540 714 714 CDomainAlgorithmInterpolate::WriteNetCdf::WriteNetCdf(const StdString& filename, const ep_lib::MPI_Comm comm) 715 715 : CNc4DataOutput(NULL, filename, false, false, true, comm, false, true) {} 716 717 CDomainAlgorithmInterpolate::WriteNetCdf::WriteNetCdf(const StdString& filename, bool exist, const ep_lib::MPI_Comm comm) 718 : CNc4DataOutput(NULL, filename, exist, false, true, comm, false, true) {} 719 716 720 int CDomainAlgorithmInterpolate::WriteNetCdf::addDimensionWrite(const StdString& name, 717 721 const StdSize size) … … 806 810 std::vector<StdSize> count(1, localNbWeight); 807 811 808 WriteNetCdf netCdfWriter(filename, client->intraComm); 809 810 // Define some dimensions 811 netCdfWriter.addDimensionWrite("n_src", n_src); 812 netCdfWriter.addDimensionWrite("n_dst", n_dst); 813 netCdfWriter.addDimensionWrite("n_weight", globalNbWeight); 814 815 std::vector<StdString> dims(1,"n_weight"); 816 817 // Add some variables 818 netCdfWriter.addVariableWrite("src_idx", NC_INT, dims); 819 netCdfWriter.addVariableWrite("dst_idx", NC_INT, dims); 820 netCdfWriter.addVariableWrite("weight", NC_DOUBLE, dims); 821 822 // End of definition 823 netCdfWriter.endDefinition(); 824 825 // // Write variables 826 if (0 != localNbWeight) 827 { 828 netCdfWriter.writeDataIndex(src_idx, "src_idx", false, 0, &start, &count); 829 netCdfWriter.writeDataIndex(dst_idx, "dst_idx", false, 0, &start, &count); 830 netCdfWriter.writeDataIndex(weights, "weight", false, 0, &start, &count); 831 } 832 833 netCdfWriter.closeFile(); 812 int my_rank_loc = client->intraComm->ep_comm_ptr->size_rank_info[1].first; 813 814 cout<<"begin write weight info"<< endl; 815 816 WriteNetCdf *netCdfWriter; 817 818 // #pragma omp barrier 819 // #pragma omp master 820 MPI_Barrier_local(client->intraComm); 821 if(my_rank_loc==0) 822 { 823 824 WriteNetCdf my_writer(filename, client->intraComm); 825 netCdfWriter = &my_writer; 826 827 // Define some dimensions 828 netCdfWriter->addDimensionWrite("n_src", n_src); 829 netCdfWriter->addDimensionWrite("n_dst", n_dst); 830 netCdfWriter->addDimensionWrite("n_weight", globalNbWeight); 831 832 std::vector<StdString> dims(1,"n_weight"); 833 834 // Add some variables 835 netCdfWriter->addVariableWrite("src_idx", NC_INT, dims); 836 netCdfWriter->addVariableWrite("dst_idx", NC_INT, dims); 837 netCdfWriter->addVariableWrite("weight", NC_DOUBLE, dims); 838 839 // End of definition 840 netCdfWriter->endDefinition(); 841 842 netCdfWriter->closeFile(); 843 } 844 845 // #pragma omp barrier 846 MPI_Barrier_local(client->intraComm); 847 848 #pragma omp critical (write_weight_data) 849 { 850 // open file 851 WriteNetCdf my_writer(filename, true, client->intraComm); 852 netCdfWriter = &my_writer; 853 854 // // Write variables 855 if (0 != localNbWeight) 856 { 857 netCdfWriter->writeDataIndex(src_idx, "src_idx", false, 0, &start, &count); 858 netCdfWriter->writeDataIndex(dst_idx, "dst_idx", false, 0, &start, &count); 859 netCdfWriter->writeDataIndex(weights, "weight", false, 0, &start, &count); 860 } 861 } 862 863 MPI_Barrier_local(client->intraComm); 864 865 // #pragma omp barrier 866 cout<<"end write weight info"<< endl; 834 867 } 835 868 … … 861 894 } 862 895 863 nc_open(filename.c_str(),NC_NOWRITE, &ncid) ; 864 nc_inq_dimid(ncid,"n_weight",&weightDimId) ; 865 nc_inq_dimlen(ncid,weightDimId,&nbWeightGlo) ; 866 867 size_t nbWeight ; 868 size_t start ; 869 size_t div = nbWeightGlo/clientSize ; 870 size_t mod = nbWeightGlo%clientSize ; 871 if (clientRank < mod) 872 { 873 nbWeight=div+1 ; 874 start=clientRank*(div+1) ; 875 } 876 else 877 { 878 nbWeight=div ; 879 start= mod * (div+1) + (clientRank-mod) * div ; 880 } 881 882 double* weight=new double[nbWeight] ; 883 int weightId ; 884 nc_inq_varid (ncid, "weight", &weightId) ; 885 nc_get_vara_double(ncid, weightId, &start, &nbWeight, weight) ; 886 887 long* srcIndex=new long[nbWeight] ; 888 int srcIndexId ; 889 nc_inq_varid (ncid, "src_idx", &srcIndexId) ; 890 nc_get_vara_long(ncid, srcIndexId, &start, &nbWeight, srcIndex) ; 891 892 long* dstIndex=new long[nbWeight] ; 893 int dstIndexId ; 894 nc_inq_varid (ncid, "dst_idx", &dstIndexId) ; 895 nc_get_vara_long(ncid, dstIndexId, &start, &nbWeight, dstIndex) ; 896 897 int indexOffset=0 ; 898 if (fortranConvention) indexOffset=1 ; 899 for(size_t ind=0; ind<nbWeight;++ind) 900 interpMapValue[dstIndex[ind]-indexOffset].push_back(make_pair(srcIndex[ind]-indexOffset,weight[ind])); 901 } 896 #pragma omp critical (read_weight_data) 897 { 898 nc_open(filename.c_str(),NC_NOWRITE, &ncid) ; 899 nc_inq_dimid(ncid,"n_weight",&weightDimId) ; 900 nc_inq_dimlen(ncid,weightDimId,&nbWeightGlo) ; 901 902 size_t nbWeight ; 903 size_t start ; 904 size_t div = nbWeightGlo/clientSize ; 905 size_t mod = nbWeightGlo%clientSize ; 906 if (clientRank < mod) 907 { 908 nbWeight=div+1 ; 909 start=clientRank*(div+1) ; 910 } 911 else 912 { 913 nbWeight=div ; 914 start= mod * (div+1) + (clientRank-mod) * div ; 915 } 916 917 double* weight=new double[nbWeight] ; 918 int weightId ; 919 nc_inq_varid (ncid, "weight", &weightId) ; 920 nc_get_vara_double(ncid, weightId, &start, &nbWeight, weight) ; 921 922 long* srcIndex=new long[nbWeight] ; 923 int srcIndexId ; 924 nc_inq_varid (ncid, "src_idx", &srcIndexId) ; 925 nc_get_vara_long(ncid, srcIndexId, &start, &nbWeight, srcIndex) ; 926 927 long* dstIndex=new long[nbWeight] ; 928 int dstIndexId ; 929 nc_inq_varid (ncid, "dst_idx", &dstIndexId) ; 930 nc_get_vara_long(ncid, dstIndexId, &start, &nbWeight, dstIndex) ; 931 932 int indexOffset=0 ; 933 if (fortranConvention) indexOffset=1 ; 934 for(size_t ind=0; ind<nbWeight;++ind) 935 interpMapValue[dstIndex[ind]-indexOffset].push_back(make_pair(srcIndex[ind]-indexOffset,weight[ind])); 936 } 937 } 902 938 903 939 void CDomainAlgorithmInterpolate::apply(const std::vector<std::pair<int,double> >& localIndex, -
XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.hpp
r1482 r1540 71 71 public: 72 72 WriteNetCdf(const StdString& filename, const ep_lib::MPI_Comm comm); 73 WriteNetCdf(const StdString& filename, bool exist, const ep_lib::MPI_Comm comm); 73 74 int addDimensionWrite(const StdString& name, const StdSize size = UNLIMITED_DIM); 74 75 int addVariableWrite(const StdString& name, nc_type type,
Note: See TracChangeset
for help on using the changeset viewer.