- Timestamp:
- 12/19/17 17:50:40 (6 years ago)
- Location:
- XIOS/dev/branch_openmp/extern/ep_dev
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/ep_dev/ep_accumulate.cpp
r1384 r1385 24 24 } 25 25 26 int MPI_Get_accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr, 27 int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, 28 int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win) 29 { 30 int target_mpi_rank = win.comm.rank_map->at(target_rank).second; 31 int target_local_rank = win.comm.rank_map->at(target_rank).first; 32 int num_ep = win.comm.ep_comm_ptr->size_rank_info[1].second; 33 if(num_ep==1) 34 return ::MPI_Get_accumulate(origin_addr, origin_count, to_mpi_type(origin_datatype), result_addr, result_count, to_mpi_type(result_datatype), target_mpi_rank, to_mpi_aint(target_disp), target_count, 35 to_mpi_type(target_datatype), to_mpi_op(op), to_mpi_win(win.server_win[target_local_rank])); 36 else 37 return ::MPI_Get_accumulate(origin_addr, origin_count, to_mpi_type(origin_datatype), result_addr, result_count, to_mpi_type(result_datatype), target_mpi_rank, to_mpi_aint(target_disp), target_count, 38 to_mpi_type(target_datatype), to_mpi_op(op), to_mpi_win(win.client_win)); 39 } 40 26 41 } -
XIOS/dev/branch_openmp/extern/ep_dev/ep_declaration.cpp
r1381 r1385 37 37 ::MPI_Op MPI_MAX_STD = MPI_MAX; 38 38 ::MPI_Op MPI_MIN_STD = MPI_MIN; 39 ::MPI_Op MPI_REPLACE_STD = MPI_REPLACE; 39 40 40 41 #undef MPI_SUM 41 42 #undef MPI_MAX 42 43 #undef MPI_MIN 44 #undef MPI_REPLACE 43 45 44 46 … … 57 59 extern ::MPI_Op MPI_MAX_STD; 58 60 extern ::MPI_Op MPI_MIN_STD; 61 extern ::MPI_Op MPI_REPLACE_STD; 59 62 60 63 extern ::MPI_Comm MPI_COMM_WORLD_STD; … … 76 79 ep_lib::MPI_Op MPI_MAX = &MPI_MAX_STD; 77 80 ep_lib::MPI_Op MPI_MIN = &MPI_MIN_STD; 81 ep_lib::MPI_Op MPI_REPLACE = &MPI_REPLACE_STD; 78 82 79 83 ep_lib::MPI_Comm MPI_COMM_WORLD(&MPI_COMM_WORLD_STD); -
XIOS/dev/branch_openmp/extern/ep_dev/ep_declaration.hpp
r1381 r1385 13 13 #undef MPI_MAX 14 14 #undef MPI_MIN 15 #undef MPI_REPLACE 15 16 16 17 #undef MPI_COMM_WORLD … … 32 33 extern ep_lib::MPI_Op MPI_MAX; 33 34 extern ep_lib::MPI_Op MPI_MIN; 35 extern ep_lib::MPI_Op MPI_REPLACE; 34 36 35 37 extern ep_lib::MPI_Comm MPI_COMM_WORLD; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_lib_win.hpp
r1384 r1385 19 19 int MPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, 20 20 int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win); 21 22 int MPI_Get_accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, void *result_addr, 23 int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, 24 int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win); 25 21 26 } 22 27 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_type.cpp
r1381 r1385 83 83 mpi_aint = new ::MPI_Aint; 84 84 *(static_cast< ::MPI_Aint*>(mpi_aint)) = aint; 85 } 86 87 MPI_Aint MPI_Aint::operator=(int a) 88 { 89 mpi_aint = new ::MPI_Aint; 90 *(static_cast< int*>(mpi_aint)) = a; 85 91 } 86 92 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_type.hpp
r1381 r1385 257 257 MPI_Aint(void* aint); 258 258 MPI_Aint(int aint); 259 MPI_Aint operator=(int a); 259 260 //MPI_Aint(int a): mpi_aint(a) {} 260 261 }; -
XIOS/dev/branch_openmp/extern/ep_dev/main.cpp
r1384 r1385 682 682 683 683 MPI_Win ep_win; 684 MPI_Aint buf_size (1);684 MPI_Aint buf_size=1; 685 685 int buf = rank; 686 686 int local_buf = rank; 687 int result_buf = -1; 687 688 MPI_Win_create(&buf, buf_size, sizeof(int), info, comm, &ep_win); 688 689 MPI_Barrier(comm); … … 699 700 { 700 701 local_buf = 99; 701 MPI_Aint displs (0);702 MPI_Aint displs=0; 702 703 MPI_Put(&local_buf, 1, MPI_INT, size-1, displs, 1, MPI_INT, ep_win); 703 704 } … … 711 712 MPI_Win_fence(0, ep_win); 712 713 713 if(rank == 0)714 { 715 MPI_Aint displs (0);716 MPI_Accumulate(&local_buf, 1, MPI_INT, size-1, displs, 1, MPI_INT, MPI_ SUM, ep_win);714 if(rank == 1) 715 { 716 MPI_Aint displs=0; 717 MPI_Accumulate(&local_buf, 1, MPI_INT, size-1, displs, 1, MPI_INT, MPI_REPLACE, ep_win); 717 718 } 718 719 … … 722 723 MPI_Win_fence(0, ep_win); 723 724 725 if(rank == 2) 726 { 727 MPI_Aint displs = 0; 728 MPI_Get_accumulate(&local_buf, 1, MPI_INT, &result_buf, 729 1, MPI_INT, size-2, displs, 730 1, MPI_INT, MPI_SUM, ep_win); 731 } 732 724 733 725 734 MPI_Win_free(&ep_win); 726 printf("rank = %d, buf = %d, local_buf = %d \n", rank, buf, local_buf);735 printf("rank = %d, buf = %d, local_buf = %d, result_buf = %d\n", rank, buf, local_buf, result_buf); 727 736 728 737 MPI_Comm_free(&comm);
Note: See TracChangeset
for help on using the changeset viewer.