- dars MPI_Isend, MPI_Irecv, MPI_Iprobe, MPI_Wait, MPI_Waitall, MPI_Waitany, MPI_Waitsome, MPI_Test, MPI_Testall, MPI_Testany, MPI_Testsome funksiyalari




Download 29.52 Kb.
bet5/9
Sana23.10.2022
Hajmi29.52 Kb.
#27904
1   2   3   4   5   6   7   8   9
Bog'liq
javoblar
oferta 10.10.18, Andijon davlat tibbiyot instituti «kelishildi», родлар (Автосохраненный), 8-ma’ruza. Fotorezistor, Labaratoriya ishi 4, Informatika va axborot texnologiyalarini o’qitishning uzluksiz t, DM-PR-06-2022, KURS ISHI ANVARGA, 2- AMALIY SLAYT, Muradov.M(Kompyuter tarmoqlari), PDF Scanner-22 09 2022-11 05 18
5- dars MPI_Isend, MPI_Irecv, MPI_Iprobe, MPI_Wait, MPI_Waitall, MPI_Waitany, MPI_Waitsome, MPI_Test, MPI_Testall, MPI_Testany, MPI_Testsome funksiyalari.

#include "mpi.h"


#include

using namespace std;

int main(int argc, char**argv) {
int rank, size, avvalgi_jarayon, keyingi_jarayon;
int buf[2];
MPI_Request reqs[4];
MPI_Status stats[4];
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
avvalgi_jarayon = rank-1;
keyingi_jarayon = rank + 1;
if (rank == 0) avvalgi_jarayon = size-1;
if (rank == size-1) keyingi_jarayon = 0;
MPI_Irecv(&buf[0], 1, MPI_INT, avvalgi_jarayon, 5, MPI_COMM_WORLD, &reqs[0]);
MPI_Irecv(&buf[1], 1, MPI_INT, keyingi_jarayon, 6, MPI_COMM_WORLD, &reqs[1]);
MPI_Isend(&rank, 1, MPI_INT, avvalgi_jarayon, 6, MPI_COMM_WORLD, &reqs[2]);
MPI_Isend(&rank, 1, MPI_INT, keyingi_jarayon, 5, MPI_COMM_WORLD, &reqs[3]);
MPI_Waitall(4, reqs, stats);
cout << " Jarayon: " << rank << "\tavvalgi_jarayon= " << buf[0] << "\tkeyingi_jarayon= " << buf[1] << endl;
MPI_Finalize();
return 0;
}
*/

/*
#include "mpi.h"


#include
using namespace std;
int main( int argc, char* argv[] ){
int rank, nproc;
int isbuf, irbuf, count;
MPI_Request request;
MPI_Status status;
int TAG = 100;

MPI_Init( &argc, &argv );


MPI_Comm_size( MPI_COMM_WORLD, &nproc );
MPI_Comm_rank( MPI_COMM_WORLD, &rank );

if(rank == 0) {


isbuf = 9;
MPI_Isend( &isbuf, 1, MPI_INT, 1, TAG, MPI_COMM_WORLD, &request );
} else if(rank == 1) {
MPI_Irecv( &irbuf, 1, MPI_INT, 0, TAG, MPI_COMM_WORLD, &request);
MPI_Wait(&request, &status);
MPI_Get_count(&status, MPI_INT, &count);
cout<<"irbuf ="<
#include
using namespace std;
int main(int argc, char *argv[])
{
int myid, numprocs, left, right;
int buffer[10], buffer2[10];
MPI_Request request, request2;
MPI_Status status;

MPI_Init(&argc,&argv);


MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &myid);
right = (myid + 1) % numprocs;
left = myid - 1;
if (left < 0)
left = numprocs - 1;
MPI_Irecv(buffer, 10, MPI_INT, left, 123, MPI_COMM_WORLD, &request);
MPI_Isend(buffer2, 10, MPI_INT, right, 123, MPI_COMM_WORLD, &request2);
MPI_Wait(&request, &status);
MPI_Wait(&request2, &status);
cout << " Jarayon: " << myid << "\tavvalgi_jarayon= " << buffer[0] << "\tkeyingi_jarayon= " << buffer2[1] << endl;
MPI_Finalize();
return 0;
}
*/

/*
#include


#include
using namespace std;
int main(int argc, char **argv)
{
int rank, size;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);

int tag1 = 42, tag2 = 43;


int sendMessage, recvMessage;
MPI_Request sendReq;
MPI_Status status;

if (rank == 0) {


sendMessage = 7;
MPI_Isend(&sendMessage, 1, MPI_INT, 1, tag1, MPI_COMM_WORLD, &sendReq);
MPI_Recv(&recvMessage, 1, MPI_INT, 1, tag2, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
}
else if (rank == 1){
sendMessage = 14;
MPI_Isend(&sendMessage, 1, MPI_INT, 0, tag2, MPI_COMM_WORLD, &sendReq);
MPI_Recv(&recvMessage, 1, MPI_INT, 0, tag1, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
}

MPI_Wait(&sendReq, &status);

// printf("Rank %d received the following integer: %d\n,rank, recvMessage);
cout<MPI_Finalize();
return 0;
}
*/

/*
#include


#include
using namespace std;
int main(int argc, char**argv)
{
int rank; float a, b, c, d,f;
MPI_Status status;
MPI_Request reqs;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);

a = 0.0; b = 0.0; c = 0.0; d = 0.0; f = 0.0;


if (rank == 0) {
b = 1.0;
c = 3.0;
//MPI_Send(&c, 1, MPI_INT, 2, 5, MPI_COMM_WORLD);
//MPI_Isend(&c, 1, MPI_INT, 2, 5, MPI_COMM_WORLD, &reqs);
MPI_Send(&b, 1, MPI_INT, 1, 5, MPI_COMM_WORLD);
MPI_Recv(&a, 1, MPI_INT, 1, 5, MPI_COMM_WORLD, &status);
//MPI_Send(&c, 1, MPI_INT, 2, 5, MPI_COMM_WORLD);
//MPI_Isend(&c, 1, MPI_INT, 2, 5, MPI_COMM_WORLD,&reqs);
MPI_Irecv(&d, 1, MPI_INT, 2, 5, MPI_COMM_WORLD, &reqs);
//MPI_Recv(&f, 1, MPI_INT, 2, 4, MPI_COMM_WORLD, &status);
}
if (rank == 1) {
a = 2.0;
MPI_Recv(&b, 1, MPI_FLOAT, 0, 5, MPI_COMM_WORLD, &status);
MPI_Send(&a, 1, MPI_FLOAT, 0, 5, MPI_COMM_WORLD);
}
/*if (rank == 2) {
d = 4.0;
f = 5.0;
MPI_Recv(&c, 1, MPI_FLOAT, 0, 5, MPI_COMM_WORLD, &status);
MPI_Send(&d, 1, MPI_FLOAT, 0, 5, MPI_COMM_WORLD);
MPI_Send(&f, 1, MPI_FLOAT, 0, 4, MPI_COMM_WORLD);
}/
cout << " process " << rank << " a = " << a << " b = " << b << " c = " << c << " d = " << d << " f = " << f << endl;
MPI_Finalize();
}
*/


Download 29.52 Kb.
1   2   3   4   5   6   7   8   9




Download 29.52 Kb.

Bosh sahifa
Aloqalar

    Bosh sahifa



- dars MPI_Isend, MPI_Irecv, MPI_Iprobe, MPI_Wait, MPI_Waitall, MPI_Waitany, MPI_Waitsome, MPI_Test, MPI_Testall, MPI_Testany, MPI_Testsome funksiyalari

Download 29.52 Kb.