140 likes | 250 Views
CS 584 Lecture 17. Assignment? C* program Papers Test When?. Glenda Help. Glenda tutorial Postscript paper Local configuration HTML document Both available from our web page. Glenda. Supports 2 models of parallelism Agenda Master-slave SPMD kindof
E N D
CS 584 Lecture 17 • Assignment? • C* program • Papers • Test • When?
Glenda Help • Glenda tutorial • Postscript paper • Local configuration • HTML document • Both available from our web page
Glenda • Supports 2 models of parallelism • Agenda • Master-slave • SPMD kindof • Master just spawns jobs and waits for them to finish
Glenda goals • Be Linda • Hide PVM as much as possible • Maintain PVM message passing ability • Maintain PVMs portability
Linda vs. Glenda • Linda has no mechanism to determine a process number. • Linda provides no means to communicate other than tuple space. • Glenda does not provide the eval function • We must spawn the process, and put out a tuple for it to evaluate.
Glenda functions • tid = gl_mytid() • tid = gl_spawn( char *name ) • gl_out( char *key, …..) • gl_in(char *key, …..) similarly gl_inp • gl_rd(char *key, …..) similarly gl_rdp • gl_outto(int tid, char *key, …..) • gl_into(char *key, …..) • gl_exit()
Glenda programming • First join Glenda by calling gl_mytid • Then the master uses gl_spawn to start up as many workers as you need. • One per call • The tid of the worker is returned • gl_outto and gl_into are used to send and receive tuples directly • No Structures, unions, or typedefs
gl_out • Variable argument list • Values can be scalar or arrays • Array sizes are implicit unless declared • Sizes of 2-d arrays must be declared gl_out( "data", j, k, val) gl_out( "row", l, x:len) // declares the length to be len gl_out( "col", x[j]:len) // 2d array
gl_in, gl_inp, gl_rd, and gl_rdp • Similar to gl_out • gl_in blocks gl_inp returns 1 or 0 • The ? is used to indicate variable data • Other arguments used for matching gl_in( "data", j, k, ? val) gl_in( "row", l, ? x:len) // declares the length to be len gl_in( "col", ? x[j]) // 2d array or single element
gl_outto and gl_into • Send a tuple directly to a process • Similar to gl_out and gl_in • gl_out requires the destination id gl_outto( tid, "data", j, k, val) gl_into( "data", j, k, ? val) • If tid is an array, gl_outto is a broadcast. gl_outto( tid : len, "data", j, k, val)
How does Glenda work? • Runs on top of PVM • Special process • Global Tuple Server • Glenda uses a preprocessor to convert a Glenda program into a PVM program
Using Glenda • Add ~snell/glenda/bin to your PATH • Copy the global tuple server to your pvm3/bin/HPPA directory. • Write your Glenda program • Must have a .cg extension • Run cgpp on your program • Compile the result using the C compiler
Using Glenda • Copy your executables to your pvm3/bin/HPPA directory • Start up PVM • Configure your virtual machine • Run gts • Run your master program
Assignment • Redo Lab 1 using Glenda • Compare your speedups and execution times with the previous two labs.