1 / 48

Modelos de Pase de Mensajes

Universidad Simón Bolívar Sistemas Operativos III Prof. Yudith Cardinale. Modelos de Pase de Mensajes. MPI MPICH y LAM PVM. Camacho, Duilmer Hansson, Martin Márquez, Ana Gabriela Sagarzazu, Iñaki. MPI Introducción. ¿Que es MPI? Message Passing Interface Handles de MPI

sugar
Télécharger la présentation

Modelos de Pase de Mensajes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Universidad Simón Bolívar Sistemas Operativos III Prof. Yudith Cardinale Modelos de Pase de Mensajes MPI MPICH y LAM PVM Camacho, Duilmer Hansson, Martin Márquez, Ana Gabriela Sagarzazu, Iñaki

  2. MPIIntroducción • ¿Que es MPI? • Message Passing Interface • Handles de MPI • Errores en MPI • MPI_ERRORS_ARE_FATAL • MPI_ERRORS_RETURN • Inicializando y finalizando. Ejemplo básico

  3. MPIIntroducción #include <mpi.h> Main(int argc, char **argv) { MPI_Init(&argc, &argv); /* Parte principal del Programa */ if () MPI_ABORT(comm, errcode); /* Terminar el MPI */ MPI_Finalize(); Exit(0); }

  4. MPIConceptos Básicos • Procesos (Grupo, Rango) • Grupos • MPI_COMM_GROUP • MPI_GROUP_EMPTY con no miembros. • MPI_GROUP_NULL es el valor usado para handles de grupos invalidos. • MPI_GROUP_FREE(group) • MPI_GROUP_SIZE(group, size) • MPI_GROUP_RANK(group, rank) • Contextos

  5. MPI Conceptos Básicos (cont) • Topologías virtuales • Communicators MPI_COMM_WORLD • int MPI_Comm_size(MPI_Comm comm, int *size) • MPI_COMM_DUP(comm, newcomm) • MPI_COMM_CREATE(comm, group, newcomm) • MPI_COMM_FREE(comm) • Inter-Communicators e Intra-Communicators

  6. MPIComunicación Punto a Punto • Blocking send • MPI_SEND(buf, count, datatype, dest, tag, comm) • Mensajes de MPI • Sobre de Mensajes • Blocking Receive • int MPI_Recv(void* buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status)

  7. MPIManejo de Tipos de datos • Matching de tipos de datos: con tipo y sin tipo y con datos empaquetados. • CALL MPI_COMM_RANK(comm, rank, ierr) • IF(rank.EQ.0) THEN • CALL MPI_SEND(a(1), 10, MPI_REAL, 1, tag, comm, ierr) ELSE • CALL MPI_RECV(b(1), 15, MPI_REAL, 0, tag, comm, status, ierr) • END IF • Conversion de Datos • Conversion de tipo • Conversion de representación

  8. MPIModos de Comunicación • Blocking y Standard • Buffered • int MPI_Bsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) • Synchronous • int MPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) • Ready • int MPI_Rsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)

  9. MPISemantica de Comunicación PP • Mensajes en orden • CALL MPI_COMM_RANK(comm, rank, ierr) • IF (rank.EQ.0) THEN • CALL MPI_BSEND(buf1, count, MPI_REAL, 1, tag, comm, ierr) • CALL MPI_BSEND(buf2, count, MPI_REAL, 1, tag, comm, ierr) • ELSE ! rank.EQ.1 • CALL MPI_RECV(buf1, count, MPI_REAL, 0, MPI_ANY_TAG, comm, status, ierr) • CALL MPI_RECV(buf2, count, MPI_REAL, 0, tag, comm, status, ierr) • END IF

  10. MPISemantica de Comunicación PP • Progreso • Justicia • Limitaciones de recursos • CALL MPI_COMM_RANK(comm, rank, ierr) • IF (rank.EQ.0) THEN • CALL MPI_SEND(sendbuf, count, MPI_REAL, 1, tag, comm, ierr) • CALL MPI_RECV(recvbuf, count, MPI_REAL, 1, tag, comm, status, ierr) • ELSE ! rank.EQ.1 • CALL MPI_RECV(recvbuf, count, MPI_REAL, 0, tag, comm, status, ierr) • CALL MPI_SEND(sendbuf, count, MPI_REAL, 0, tag, comm, ierr) END IF

  11. MPI Comunicación Non-Blocking • int MPI_Isend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) • int MPI_Ibsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) • int MPI_Issend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) • int MPI_Irecv(void* buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request)

  12. MPICompletación de Comunicación • MPI_WAIT y MPI_TEST • MPI_WAITANY • MPI_TESTANY • MPI_WAITALL • MPI_TESTALL • MPI_WAITSOME • MPI_TESTSOME

  13. MPIComunicación Colectiva int MPI_Barrier(MPI_Comm comm ) int MPI_Bcast(void* buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm ) int MPI_Gather(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) int MPI_Gatherv(sendbuf,sendcount, sendtype, recvbuf, *recvcounts, *displs, recvtype, root, comm) int MPI_Scatter(void* sendbuf, sendcount, sendtype, void* recvbuf, recvcount, recvtype, root, comm) int MPI_Scatterv(void* sendbuf, *sendcounts, *displs, sendtype, void* recvbuf, recvcount, recvtype, root, comm)

  14. MPIComunicación Colectiva

  15. MPIComunicación Colectiva • Todos los procesos llaman a las rutinas • La sintaxis es consistente con las llamadas a comunicación punto a punto • Existe el proceso root. • Type matching es más estricto • Cantidad de datos en send debe ser igual a la del receive

  16. MPIOperaciones Extendidas MPI-2 • Creación de Inter-communicators • Dos nuevas rutinas colectivas • Un all-to-all generalizado • Operaciones de Intra-communicator • MPI_BCAST, • MPI_GATHER, MPI_GATHERV, • MPI_SCATTER, MPI_SCATTERV, • MPI_ALLGATHER, MPI_ALLGATHERV, • MPI_ALLTOALL, MPI_ALLTOALLV, MPI_ALLTOALLW • MPI_REDUCE, MPI_ALLREDUCE, • MPI_REDUCE_SCATTER, • MPI_BARRIER.

  17. MPIAdministración y Creación de Procesos • Creando Procesos • int MPI_Comm_spawn(char *command, char *argv[], int maxprocs, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *intercomm, int array_of_errcodes[]) • int MPI_Comm_spawn_multiple(int count, char *array_of_commands[], char **array_of_argv[], int array_of_maxprocs[], MPI_Info array_of_info[], int root, MPI_Comm comm, MPI_Comm *intercomm, int array_of_errcodes[])

  18. MPI Cliente Servidor • El servidor • MPI_Open_port(MPI_INFO_NULL, port_name); MPI_Publish_name("ocean", MPI_INFO_NULL, port_name); MPI_Comm_accept(port_name, MPI_INFO_NULL, 0, MPI_COMM_SELF, &intercomm); /* do something with intercomm */ • MPI_Unpublish_name("ocean", MPI_INFO_NULL, port_name); • El cliente • MPI_Lookup_name("ocean", MPI_INFO_NULL, port_name); MPI_Comm_connect( port_name, MPI_INFO_NULL, 0, MPI_COMM_SELF, &intercomm);

  19. MPICHArquitectura Principios guías del diseño • Desempeño Maximizar la cantidad de código que puede ser compartida sin comprometer el desempeño • Portabilidad Proveer una estructura en donde mpich pueda ser portable rápidamente

  20. MPICHArquitectura Abstract Device Interface • Especificar un mensaje para ser enviado o recibido • Mover datos entre el ADI y el Hardware • Administrar listas de mensajes Pendientes • Proveer información básica sobre el ambiente de ejecución

  21. MPICHArquitectura ADI - Channel Interface • Eager Protocol • Rendezvouz Protocol • Get Protocol

  22. MPICHArquitectura ADI – Lower Level • Chameleon • Shared Memory • Specialized • SCI

  23. LAMLocal Area Multicomputer Historia • Desarrollado en el Ohio Supercomputer Center • Existe de antes del MPI y fue adoptado para implementar la interfaz de MPI

  24. LAMLocal Area Multicomputer Características • convierte una red de estaciones de trabajo en una computadora paralela virtual • Amplia la capacidad de monitoreo (tunning y debugging) • Monitoreo Activado – comunicación a través de demonios, es posible habilitar la comunicación directa entre clientes.

  25. LAM vs. MPICH

  26. LAM vs. MPICH

  27. LAM vs. MPICHPing

  28. LAM vs. MPICHPing-Pong

  29. LAM vs. MPICHBroadcast

  30. LAM vs. MPICHGather

  31. LAM vs. MPICHAll To All

  32. PVM • Introducción • Atributos • User-configured host pool • Translucent access to hardware • Process-based computation • Explicit message-passing model • Heterogeneity support • Multiprocessor support

  33. PVM • Compuesto por: • Daemon • Library of PVM interface routines • Basic Programming techniques • Common Parallel Programming Paradigms • Crowd • Master-slave • The node only • Tree

  34. 9 8 7 2 3 4 6 5 1 PVMBasic Programming techniques • Data Descomposition • Funtion Descomposition

  35. PVMUser Interface • Process Control • Information • Dynamic Configuration • Signaling • Setting and Getting Options • Message Passing • Dynamic Process Groups

  36. PVM • Message Passing • pvm_initsend() • pvm_pk*() • pvm_send() • pvm_mcast() • pvm_recvf() • Message Buffers • pvm_initsend() • pvmDataDefault • pvm_mkbufer() • pvm_send(dst ,tag)

  37. PVM • Packing Data • pvm_pkbyte(char *cp, int nitem, int strike) • pvm_pkint(int *cp, int nitem, int strike) • pvm_pkstr(char *cp) • Sending and Receiving Data • pvm_send(int tid,int msgtag) • pvm_mcast(int *tids, int ntask, int msgtag) • pvm_recv(int tid,msgtag)

  38. PVM • Unpacking Data • pvm_upkbyte(char *cp,int nitem,int strike) • pvm_upkint(int *np, int nitem,int strike) • Pvm_upkstr(char *cp)

  39. PVMEjemplo • Hello.c #include "pvm3.h" main(){ int cc, tid, msgtag; char buf[100]; printf("i'm t%x\n", pvm_mytid());  cc = pvm_spawn("hello_other",(char**)0,0,"", 1,&tid);   if (cc == 1){ msgtag = 1; pvm_recv(tid, msgtag); pvm_upkstr(buf); printf("from t%x: %s\n", tid, buf); } else { printf("can't start hello_other\n"); } pvm_exit(); }

  40. PVMEjemplo • Hello_other.c #include "pvm3.h"  main(){ int ptid, msgtag; char buf[100]; ptid = pvm_parent();  strcpy(buf, "hello, world from "); gethostname(buf + strlen(buf), 64); msgtag = 1; pvm_initsend(PvmDataDefault); pvm_pkstr(buf); pvm_send(ptid, msgtag); pvm_exit(); }

  41. TituloSubtítulo • Punto 1 • Punto 2

  42. TituloSubtítulo • Punto 1 • Punto 2

  43. TituloSubtítulo • Punto 1 • Punto 2

  44. TituloSubtítulo • Punto 1 • Punto 2

  45. TituloSubtítulo • Punto 1 • Punto 2

  46. TituloSubtítulo • Punto 1 • Punto 2

More Related