Advanced Operating Systems CS428 Lecture TEN Semester I, 2009-10 Graham Ellis NUI Galway, Ireland
DIY Parallelism MPI is useful for C and Fortran programming.
DIY Parallelism MPI is useful for C and Fortran programming. When using higher-level computational software (such as GAP, Singular, Macaulay, GBParis, Cocoa,...) with no in-built functions for parallelism the user could develop her/his own message passing interface for parallel computing.
DIY Parallelism MPI is useful for C and Fortran programming. When using higher-level computational software (such as GAP, Singular, Macaulay, GBParis, Cocoa,...) with no in-built functions for parallelism the user could develop her/his own message passing interface for parallel computing. We ll consider an example developed for the GAP package HAP.
Brief description of HAP HAP is aimed at computations in algebraic topology (see here).
Brief description of HAP HAP is aimed at computations in algebraic topology (see here). It is distributed with GAP and loaded by typing the following command at the GAP prompt. gap> LoadPackage("hap");
Brief description of HAP HAP is aimed at computations in algebraic topology (see here). It is distributed with GAP and loaded by typing the following command at the GAP prompt. gap> LoadPackage("hap"); Many computations in algebraic topology require significant memory and significant cpu time.
Parallel computation using HAP To help with large computations the user can start one or more copies of GAP as new processes. The following starts the new processes on the local machine. gap> s:=childprocess();
Parallel computation using HAP To help with large computations the user can start one or more copies of GAP as new processes. The following starts the new processes on the local machine. gap> s:=childprocess(); The following starts the new process on a remote machine. gap> t:=childprocess(alberti.nuigalway.ie);
Parallel computation using HAP To help with large computations the user can start one or more copies of GAP as new processes. The following starts the new processes on the local machine. gap> s:=childprocess(); The following starts the new process on a remote machine. gap> t:=childprocess(alberti.nuigalway.ie); The core functions for handling child processes in HAP are described here.
Parallel computation using HAP To help with large computations the user can start one or more copies of GAP as new processes. The following starts the new processes on the local machine. gap> s:=childprocess(); The following starts the new process on a remote machine. gap> t:=childprocess(alberti.nuigalway.ie); The core functions for handling child processes in HAP are described here. Some simple parallel computations are described here.
Load balancing in HAP: ParallelList In GAP the command List(L,f); inputs a list L and a function f. It returns the list obtained by applying f to each element in L.
Load balancing in HAP: ParallelList In GAP the command List(L,f); inputs a list L and a function f. It returns the list obtained by applying f to each element in L. The HAP command ParallelList(L,"f",S); inputs a list L, a string name "f" for a function f and a list S of child processes. It returns the list obtained by applying f to each element in L.
Load balancing in HAP: ParallelList In GAP the command List(L,f); inputs a list L and a function f. It returns the list obtained by applying f to each element in L. The HAP command ParallelList(L,"f",S); inputs a list L, a string name "f" for a function f and a list S of child processes. It returns the list obtained by applying f to each element in L. ParallelList(L,"f",S); runs through the elements of the list L and, for each element x, waits until some process in S is available for computation; it then requests this process to compute f(x).
Load balancing in HAP: ParallelList In GAP the command List(L,f); inputs a list L and a function f. It returns the list obtained by applying f to each element in L. The HAP command ParallelList(L,"f",S); inputs a list L, a string name "f" for a function f and a list S of child processes. It returns the list obtained by applying f to each element in L. ParallelList(L,"f",S); runs through the elements of the list L and, for each element x, waits until some process in S is available for computation; it then requests this process to compute f(x). The same simple algorithm is used in post offices to deal with a queues of people. The algorithm achieves an optimal load balance.
Passing complicated data types in HAP One limitation to MPI is that it is not easy to pass complicated data types from one process to another. Only basic data types (integers, floating point number,...) can be passed easily.
Passing complicated data types in HAP One limitation to MPI is that it is not easy to pass complicated data types from one process to another. Only basic data types (integers, floating point number,...) can be passed easily. In HAP the function HAPPrintTo("file",X) can be used to write a complicated data type to a file. The function HAPRead("file",X) can be used to read the data type into GAP. These two functions can be used to transport complicated data types between processes.
Passing complicated data types in HAP One limitation to MPI is that it is not easy to pass complicated data types from one process to another. Only basic data types (integers, floating point number,...) can be passed easily. In HAP the function HAPPrintTo("file",X) can be used to write a complicated data type to a file. The function HAPRead("file",X) can be used to read the data type into GAP. These two functions can be used to transport complicated data types between processes. A non-trivial example is given at the end of this page.