Presentation is loading. Please wait.

Presentation is loading. Please wait.

PVM (Parallel Virtual Machine)‏ By : Vishal Prajapati Course CS683 Computer Architecture Prof. Moreshwar R Bhujade.

Similar presentations


Presentation on theme: "PVM (Parallel Virtual Machine)‏ By : Vishal Prajapati Course CS683 Computer Architecture Prof. Moreshwar R Bhujade."— Presentation transcript:

1 PVM (Parallel Virtual Machine)‏ By : Vishal Prajapati Course CS683 Computer Architecture Prof. Moreshwar R Bhujade

2 Contents Introduction Features of PVM PVM – as a System Example (Fork & Join)‏ Summary

3 Introduction PVM is a software tool for parallel networking of computers. Major Acceptance because of Developements in MPP – Powerfull computers (Blue gene)‏ Widespread use of distributed systems. Source code netlib (http://en.wikipedia.org/wiki/Netlib)‏http://en.wikipedia.org/wiki/Netlib The Key consept is PVM allows to see the collection of computers as a one gient high performance machine.

4 Introduction PVM is a software tool for parallel networking of computers. Major Acceptance because of Developements in MPP – Powerfull computers (Blue gene)‏ Widespread use of distributed systems. Source code netlib (http://en.wikipedia.org/wiki/Netlib)‏http://en.wikipedia.org/wiki/Netlib The Key consept is PVM allows to see the collection of computers as a one gient high performance machine.

5 PVM (Physical Vs Logical View)‏ Source : ftp://ftp.netlib.org

6 Featurs of PVM - 1 Portable Runs on nearly every Unix machine, plus many shared- and distributed- memory multipro-cessors. Heterogeneous Any types of machines can be combined in a single virtual machine Scalable Virtual machines can include hundreds of host computers, and run thousands of tasks. Dynamic configuration computers can be dynamically added and deleted from the parallel virtual machine by the application or manually. Hooks for fault tolerance Application can be noticed via messages of lost processes, processors or addition of new resources.

7 Featurs of PVM - 2 Dynamic process groups user-defined process grouping for functions like broadcast and barrier. Groups can overlap and change dynamically during an application. Signals PVM tasks can send signals to other tasks. Multiple message buffers Allows easier development of PVM math libraries, graphical interfaces, etc. Tracing Call-level tracing built into PVM library. Can be customized User can write manager tasks to implement custom scheduling policies.

8 PVM - System Composed of Two parts PVM daemon – pvmd3 or pvmd – For accepting remote connection and connecting to remote machines PVM library – libpvm3.a – Contains user callable routines for message passing, spawning processes, coordinating tasks, and modifying the virtual machine.

9 PVM – Example (Fork & Join)‏ /* Fork Join Example Demonstrates how to spawn processes and exchange messages */ /* defines and prototypes for the PVM library */ #include /* Maximum number of children this program will spawn */ #define MAXNCHILD 20 /* Tag to use for the joing message */ #define JOINTAG 11 int main(int argc, char* argv[])‏ { /* number of tasks to spawn, use 3 as the default */ int ntask = 3; /* return code from pvm calls */ int info; /* my task id */ int mytid; /* my parents task id */ int myparent; /* children task id array */ int child[MAXNCHILD]; int i, mydata, buf, len, tag, tid; /* find out my task id number */ mytid = pvm_mytid(); /* check for error */ if (mytid < 0) { /* print out the error */ pvm_perror(argv[0]); /* exit the program */ return -1; } /* find my parent's task id number */ myparent = pvm_parent();

10 PVM – Example (Fork & Join)‏ /* exit if there is some error other than PvmNoParent */ if ((myparent < 0) && (myparent != PvmNoParent)) { pvm_perror(argv[0]); pvm_exit(); return -1; } /* if i don't have a parent then i am the parent */ if (myparent == PvmNoParent) { /* find out how many tasks to spawn */ if (argc == 2) ntask = atoi(argv[1]); /* make sure ntask is legal */ if ((ntask MAXNCHILD)) { pvm_exit(); return 0; } /* spawn the child tasks */ info = pvm_spawn(argv[0], (char**)0, PvmTaskDefault, (char*)0, ntask, child); /* print out the task ids */ for (i = 0; i < ntask; i++) if (child[i] < 0) /* print the error code in decimal*/ printf(" %d", child[i]); else /* print the task id in hex */ printf("t%x\t", child[i]); putchar('\n'); /* make sure spawn succeeded */ if (info == 0) { pvm_exit(); return -1; } /* only expect responses from those spawned correctly */ ntask = info; for (i = 0; i < ntask; i++) { /* recv a message from any child process */ buf = pvm_recv(-1, JOINTAG); if (buf < 0) pvm_perror("calling recv"); info = pvm_bufinfo(buf, &len, &tag, &tid); if (info < 0) pvm_perror("calling pvm_bufinfo"); info = pvm_upkint(&mydata, 1, 1); if (info < 0) pvm_perror("calling pvm_upkint"); if (mydata != tid) printf("This should not happen!\n"); printf("Length %d, Tag %d, Tid t%x\n", len, tag, tid); } pvm_exit(); return 0; } /* i'm a child */ info = pvm_initsend(PvmDataDefault); if (info < 0) { pvm_perror("calling pvm_initsend"); pvm_exit(); return -1; } info = pvm_pkint(&mytid, 1, 1); if (info < 0) { pvm_perror("calling pvm_pkint"); pvm_exit(); return -1; } info = pvm_send(myparent, JOINTAG); if (info < 0) { pvm_perror("calling pvm_send"); pvm_exit(); return -1; } pvm_exit(); return 0; }

11 PVM – Example It Contains both parent and child code. This function must be called before any other call. This call must be positive number. This call tells what goes wrong with the last call. Retuns the Parent ID or else will retrn Error code “PvmNoParent” says that the process is spawned by user and not by any other process. /* find out my task id number */ mytid = pvm_mytid(); pvm_perror(argv[0]); /* find my parent's task id number */ myparent = pvm_parent();

12 PVM – Example Following code differenciate the parent of all childs. So by this you can differenciate the code of top process and child code. This is the code which spawns childs. /* if i don't have a parent then i am the parent */ if (myparent == PvmNoParent) { /* spawn the child tasks */ info = pvm_spawn(argv[0], (char**)0, PvmTaskDefault, (char*)0, ntask, child);

13 PVM – Example Perameters First perameter gives the name of the program that the child should run. Second perameter is the arguments that can be passed to child Third perameter – this says that where the child should spawn. We can give specific architecture or host name where the child can spawn Fourth perameter will have the values of the third perameter Fifth perameter specifies the number of the childs to be spawned. Last perameter is the array name which holds the child Id's. This Function is returning the no of child successfully spawned which should be equal to the sent number n the 5 th perameter other wise something gone wrong. /* spawn the child tasks */ info = pvm_spawn(argv[0], (char**)0, PvmTaskDefault, (char*)0, ntask, child);

14 PVM – Example Following code is the waiting blocking call of parent. So by this parent is waiting for all the childs to send the join message. Parent gets the data from the child via the message and the following code gets the data from the buffer. After getting the join messages from all the childs parent also exits pvm. /* recv a message from any child process */ buf = pvm_recv(-1, JOINTAG); info = pvm_bufinfo(buf, &len, &tag, &tid);

15 PVM – Example Following code is run by child. First line - For message to be sent first we need to create the buffer to send the data. Second line – We are adding the child's Id to the message. Third line sending the join call to the parent with the message attached. Fourth line calls off the child from pvm and distroy its memory references. info = pvm_initsend(PvmDataDefault); info = pvm_pkint(&mytid, 1, 1); info = pvm_send(myparent, JOINTAG); pvm_exit();

16 PVM – Example (Fork & Join)‏ Output % forkjoin t10001c t40149 tc0037 Length 4, Tag 11, Tid t40149 Length 4, Tag 11, Tid tc0037 Length 4, Tag 11, Tid t10001c % forkjoin 4 t10001e t10001d t4014b tc0038 Length 4, Tag 11, Tid t4014b Length 4, Tag 11, Tid tc0038 Length 4, Tag 11, Tid t10001d Length 4, Tag 11, Tid t10001e

17 Summary PVM is a software system that enables a collection of heterogeneous computers to be used as a coherent and flexible concurrent computational resource, or a "Parallel Virtual Machine". Thank You


Download ppt "PVM (Parallel Virtual Machine)‏ By : Vishal Prajapati Course CS683 Computer Architecture Prof. Moreshwar R Bhujade."

Similar presentations


Ads by Google