Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 58 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
58
Dung lượng
449,86 KB
Nội dung
om C nh Vi en Zo ne MPI Si THOAI NAM SinhVienZone.com https://fb.com/sinhvienzonevn om Outline Communication modes MPI – Message Passing Interface Standard Si nh Vi en Zo ne C SinhVienZone.com https://fb.com/sinhvienzonevn TERMs (1) Blocking om Non-blocking Zo ne C If return from the procedure indicates the user is allowed to reuse resources specified in the call nh Vi en If the procedure may return before the operation completes, and before the user is allowed to reuse resources specified in the call Collective If all processes in a process group need to invoke the procedure Message envelope Si Information used to distinguish messages and selectively receive them SinhVienZone.com https://fb.com/sinhvienzonevn TERMs (2) Communicator om Process group – The communicator specifies the set of processes that share this communication context – This process group is ordered and processes are identified by their rank within this group Si nh Vi en Zo ne C – The communication context for a communication operation – Messages are always received within the context they were sent – Messages sent in different contexts not interfere – MPI_COMM_WORLD SinhVienZone.com https://fb.com/sinhvienzonevn om MPI Environment Point-to-point communication Collective communication Derived data type Group management Si nh Vi en Zo ne C SinhVienZone.com https://fb.com/sinhvienzonevn P2 P3 P4 C P1 Zo ne P0 om MPI P1 P2 Daemon P3 P4 Si P0 nh Vi en Daemon Daemon SinhVienZone.com https://fb.com/sinhvienzonevn MPI_INIT MPI_COMM_SIZE MPI_COMM_RANK MPI_FINALIZE MPI_ABORT om Environment Si nh Vi en Zo ne C SinhVienZone.com https://fb.com/sinhvienzonevn Usage C om MPI_Init nh Vi en Description – Initialize MPI – All MPI programs must call this routines once and only once before any other MPI routines Si /* in */ /* in */ Zo ne – int MPI_Init( int* argc_ptr, char** argv_ptr[] ); SinhVienZone.com https://fb.com/sinhvienzonevn Usage Zo Description nh Vi en – Terminates all MPI processing – Make sure this routine is the last MPI call – All pending communications involving a process have completed before the process calls MPI_FINALIZE Si ne int MPI_Finalize (void); C om MPI_Finalize SinhVienZone.com https://fb.com/sinhvienzonevn Usage C om MPI_Comm_Size nh Vi en Description – Return the number of processes in the group associated with a communicator Si Zo ne int MPI_Comm_size( MPI_Comm comm, /* in */ int* size ); /* out */ SinhVienZone.com https://fb.com/sinhvienzonevn om Example of MPI_Gather (2) Zo ne C isend = rank + 1; MPI_Gather( &isend, 1, MPI_INTEGER, irecv, 1, MPI_INTEGER, 0, MPI_COMM_WORLD); nh Vi en if(rank == 0) { for(i=0; i