Descargar la presentación
La descarga está en progreso. Por favor, espere
1
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
2
MPI Introducció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
MPI Introducció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
MPI Conceptos Básicos Procesos (Grupo, Rango) Grupos Contextos
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
Conceptos Básicos (cont)
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
7
MPI Comunicació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) DataType ...
8
MPI Manejo 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
9
MPI Modos 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)
10
MPI Semantica 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
11
MPI Semantica 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
12
Comunicación Non-Blocking
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)
14
MPI Completación de Comunicación
MPI_WAIT y MPI_TEST MPI_WAITANY MPI_TESTANY MPI_WAITALL MPI_TESTALL MPI_WAITSOME MPI_TESTSOME
15
MPI Comunicació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)
16
MPI Comunicación Colectiva
17
MPI Comunicació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
18
MPI Operaciones 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.
19
MPI Administració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[])
20
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);
21
Principios guías del diseño
MPICH Arquitectura 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
22
Abstract Device Interface
MPICH Arquitectura 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
23
ADI - Channel Interface
MPICH Arquitectura ADI - Channel Interface Eager Protocol Rendezvouz Protocol Get Protocol
24
MPICH Arquitectura ADI – Lower Level Chameleon Shared Memory
Specialized SCI
25
LAM Local Area Multicomputer
Historia Desarrollado en el Ohio Supercomputer Center Existe de antes del MPI y fue adoptado para implementar la interfaz de MPI
26
LAM Local 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.
27
LAM vs. MPICH Short Message Protocol Long Message Protocol LAM MPICH
Encabezado + Mensaje es enviado en un mensaje Dividido en paquetes. Se envia el primero, una vez que el sender recibe un ack del receiver procede a enviar el resto. MPICH Eager Protocol Rendezvouz Protocol Get Protocol
28
LAM vs. MPICH MTU Communications Channels LAM MPICH
Maximun Transmission Unit Communications Channels LAM Aumentar el MTU mejora el desempeño del LAM, si embargo se disminuye el desempeño del MPICH. En ambos casos aumenta la latencia Se establece una red completamente conectada al momento de la inicialización MPICH Se realizan las conecciones con base en la demanda
29
LAM vs. MPICH Ping
30
LAM vs. MPICH Ping-Pong
31
LAM vs. MPICH Broadcast
32
LAM vs. MPICH Gather
33
LAM vs. MPICH All To All
34
PVM Introducción Atributos User-configured host pool
Translucent access to hardware Process-based computation Explicit message-passing model Heterogeneity support Multiprocessor support
35
PVM Compuesto por: Basic Programming techniques Daemon
Library of PVM interface routines Basic Programming techniques Common Parallel Programming Paradigms Crowd Master-slave The node only Tree
36
PVM Basic Programming techniques
Data Descomposition Funtion Descomposition 1 6 7 8 5 4 3 2 9
37
PVM User Interface Process Control Information Dynamic Configuration
Signaling Setting and Getting Options Message Passing Dynamic Process Groups
38
PVM Message Passing Message Buffers pvm_initsend() pvm_pk*()
pvm_send() pvm_mcast() pvm_recvf() Message Buffers pvmDataDefault pvm_mkbufer() pvm_send(dst ,tag)
39
PVM Packing Data Sending and Receiving 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)
40
PVM Unpacking Data pvm_upkbyte(char *cp,int nitem,int strike)
pvm_upkint(int *np, int nitem,int strike) Pvm_upkstr(char *cp)
41
PVM Ejemplo 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();
42
PVM Ejemplo 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(); }
43
Titulo Subtítulo Punto 1 Punto 2
44
Titulo Subtítulo Punto 1 Punto 2
45
Titulo Subtítulo Punto 1 Punto 2
46
Titulo Subtítulo Punto 1 Punto 2
47
Titulo Subtítulo Punto 1 Punto 2
48
Titulo Subtítulo Punto 1 Punto 2
Presentaciones similares
© 2024 SlidePlayer.es Inc.
All rights reserved.