Sharov rashiov nomidagi samarqand davlat




Download 435,82 Kb.
bet17/18
Sana07.02.2024
Hajmi435,82 Kb.
#152842
1   ...   10   11   12   13   14   15   16   17   18
Bog'liq
Mustaqil ishi Xakimov Allamurod (3)

int MPI_Sendrecv (const void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Status *status)
sendbuf [in]
Yuborilayotgan ma’lumot manzili.
sendcount
Yuboriladigan ma’lumotlar soni.
sendtype
Yuborilayotgan ma’lumot turi
Dest
Qabul qiluvchi jarayon raqami
sendtag
Jo’natiluvchi xabar identifikatori
recvbuf [out]
Ma’lumot qabul qilish uchun bufer manzili.
recvcount
Qabul qilinayotgan ma’lumotlar soni
recvtype
Qabul qilinayotgan ma’lumot turi
source
Xabar jo’natuvchi jarayon raqami
recvtag
Qabul qilinayotgan xabar identifikatori
Comm
Kommunikator nomi
status [out]
Qabul qilinayotgan xabar haqidagi ma’lumotlarni saqlovchi tuzilma.
MPI_Sendrecv() funksiyasi
#include
#include
using namespace std;
int main(int argc,char**argv){
int rank;
MPI_Status status;
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
int a;
int b ;
a = 0;
b = 0;
if (rank==1){
a = 18;
// MPI_Send(&a,1,MPI_INT,2,3,MPI_COMM_WORLD);
// MPI_Recv(&b,1,MPI_FLOAT,2,4,MPI_COMM_WORLD,&status);
MPI_Sendrecv(&a,1,MPI_INT,2,3,&b,1,MPI_INT,2,4,MPI_COMM_WORLD,MPI_STATUSES_IGNORE);
}
if (rank==2){
b = 2005;
// MPI_Send(&b,1,MPI_FLOAT,1,4,MPI_COMM_WORLD);
// MPI_Recv(&a,1,MPI_INT,1,3,MPI_COMM_WORLD,&status); MPI_Sendrecv(&b,1,MPI_INT,1,4,&a,1,MPI_INT,1,3,MPI_COMM_WORLD,MPI_STATUSES_IGNORE);
}
cout<<"processor : "<Download 435,82 Kb.
1   ...   10   11   12   13   14   15   16   17   18




Download 435,82 Kb.

Bosh sahifa
Aloqalar

    Bosh sahifa



Sharov rashiov nomidagi samarqand davlat

Download 435,82 Kb.