viernes, 20 de septiembre de 2013

Codigo en Paralelo Entrar usando dos Procesadores Entrar usando la libreria MPI

La idea de es Que el Proceso 0 Y 1 SE comuniquen Entre ELLOS, ES Como Un Hola Mundo Entre el los Procesadores

Para mas informacion:
Enlace a la informacion Completa del Curso

 # Incluir 
 # Incluir 
 # Incluir 
 # Definir BUFSIZE 128
 # Definir TAG 0
 
 int main (int argc, char * argv [])
 {
   charlas idstr [32];
   Carácter buff [BUFSIZE];
   int NUMPROCS;
   int myid;
   int i;
   MPI_Status stat;
 
   MPI_Init (& argc, argv y); / * Todos los Programas en MPI inicializan asi * /
   MPI_Comm_size (MPI_COMM_WORLD, NUMPROCS y); / * Nos indica el numero de Procesadores * /
   MPI_Comm_rank (MPI_COMM_WORLD, y myid); / * Le da Nombre de la ONU sin Procesador CADA * / 
if (myid == 0) {printf ("% d: NOSOTROS TENEMOS% Procesadores d \ n", myid, NUMPROCS); for (i = 1; i <NUMPROCS; i + +) {sprintf (buff, "hola% d", i); MPI_Send (piel de ante, BUFSIZE, MPI_CHAR, i, TAG, MPI_COMM_WORLD); } For (i = 1; i <NUMPROCS; i + +) {MPI_Recv (piel de ante, BUFSIZE, MPI_CHAR, i, TAG, MPI_COMM_WORLD, y stat); printf ("% d:% s \ n", myid, buff); }}}

visita:
http://www.crearticaperu.com


 
© 2012. Design by Main-Blogger - Blogger Template and Blogging Stuff