Ignore:
Timestamp:
03/22/18 10:43:20 (6 years ago)
Author:
yushan
Message:

branch_openmp merged with XIOS_DEV_CMIP6@1459

Location:
XIOS/dev/branch_openmp/extern/src_ep_dev
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_declaration.cpp

    r1373 r1460  
    2424::MPI_Datatype MPI_UNSIGNED_LONG_STD = MPI_UNSIGNED_LONG; 
    2525::MPI_Datatype MPI_UNSIGNED_CHAR_STD = MPI_UNSIGNED_CHAR; 
     26::MPI_Datatype MPI_UINT64_T_STD = MPI_UINT64_T; 
    2627 
    2728#undef MPI_INT 
     
    3233#undef MPI_UNSIGNED_LONG 
    3334#undef MPI_UNSIGNED_CHAR 
     35#undef MPI_UINT64_T 
    3436 
    3537 
     
    3739::MPI_Op MPI_MAX_STD = MPI_MAX; 
    3840::MPI_Op MPI_MIN_STD = MPI_MIN; 
     41::MPI_Op MPI_LOR_STD = MPI_LOR; 
    3942 
    4043#undef MPI_SUM 
    4144#undef MPI_MAX 
    4245#undef MPI_MIN 
    43  
    44  
    45 /*#undef MPI_INT 
    46 #undef MPI_FLOAT 
    47 #undef MPI_DOUBLE 
    48 #undef MPI_CHAR 
    49 #undef MPI_LONG 
    50 #undef MPI_UNSIGNED_LONG 
    51 #undef MPI_UNSIGNED_CHAR 
    52  
    53 #undef MPI_SUM 
    54 #undef MPI_MAX 
    55 #undef MPI_MIN 
    56  
    57 #undef MPI_COMM_WORLD 
    58 #undef MPI_COMM_NULL 
    59  
    60 #undef MPI_STATUS_IGNORE 
    61 #undef MPI_REQUEST_NULL 
    62 #undef MPI_INFO_NULL 
    63 */ 
     46#undef MPI_LOR 
    6447 
    6548 
     
    7356extern ::MPI_Datatype MPI_UNSIGNED_LONG_STD; 
    7457extern ::MPI_Datatype MPI_UNSIGNED_CHAR_STD; 
     58extern ::MPI_Datatype MPI_UINT64_T_STD; 
     59 
    7560 
    7661extern ::MPI_Op MPI_SUM_STD; 
    7762extern ::MPI_Op MPI_MAX_STD; 
    7863extern ::MPI_Op MPI_MIN_STD; 
     64extern ::MPI_Op MPI_LOR_STD; 
    7965 
    8066extern ::MPI_Comm MPI_COMM_WORLD_STD; 
     
    9278ep_lib::MPI_Datatype MPI_UNSIGNED_LONG = &MPI_UNSIGNED_LONG_STD; 
    9379ep_lib::MPI_Datatype MPI_UNSIGNED_CHAR = &MPI_UNSIGNED_CHAR_STD; 
     80ep_lib::MPI_Datatype MPI_UINT64_T = &MPI_UINT64_T_STD; 
     81 
    9482 
    9583ep_lib::MPI_Op MPI_SUM = &MPI_SUM_STD; 
    9684ep_lib::MPI_Op MPI_MAX = &MPI_MAX_STD; 
    9785ep_lib::MPI_Op MPI_MIN = &MPI_MIN_STD; 
     86ep_lib::MPI_Op MPI_LOR = &MPI_LOR_STD; 
    9887 
    9988ep_lib::MPI_Comm MPI_COMM_WORLD(&MPI_COMM_WORLD_STD); 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_declaration.hpp

    r1369 r1460  
    99#undef MPI_UNSIGNED_LONG 
    1010#undef MPI_UNSIGNED_CHAR 
     11#undef MPI_UINT64_T 
    1112 
    1213#undef MPI_SUM 
    1314#undef MPI_MAX 
    1415#undef MPI_MIN 
     16#undef MPI_LOR 
    1517 
    1618#undef MPI_COMM_WORLD 
     
    2830extern ep_lib::MPI_Datatype MPI_UNSIGNED_LONG; 
    2931extern ep_lib::MPI_Datatype MPI_UNSIGNED_CHAR; 
     32extern ep_lib::MPI_Datatype MPI_UINT64_T; 
    3033 
    3134extern ep_lib::MPI_Op MPI_SUM; 
    3235extern ep_lib::MPI_Op MPI_MAX; 
    3336extern ep_lib::MPI_Op MPI_MIN; 
     37extern ep_lib::MPI_Op MPI_LOR; 
    3438 
    3539extern ep_lib::MPI_Comm MPI_COMM_WORLD; 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_reduce.cpp

    r1365 r1460  
    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 
    114133        else printf("datatype Error\n"); 
    115134 
     
    160179        } 
    161180 
     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 
    162188        else printf("datatype Error\n"); 
    163189 
     
    209235        } 
    210236 
     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 
    211244        else printf("datatype Error\n"); 
    212245 
     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        } 
    213258      } 
    214259    } 
Note: See TracChangeset for help on using the changeset viewer.