Advanced Operating Systems CS428
Lecture TEN
Semester I, 2009-10
Graham Ellis NUI Galway, Ireland
DIY Parallelism
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.
Brief description of 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.
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.
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.
Load balancing in HAP: ParallelList
In GAP the command List(L,f); inputs a list Land a function f. It returns the list obtained by applying fto each element inL.
Load balancing in HAP: ParallelList
In GAP the command List(L,f); inputs a list Land a function f. It returns the list obtained by applying fto each element inL. The HAP command ParallelList(L,"f",S);inputs a list L, a string name "f"for a function fand a listSof child processes. It returns the list obtained by applyingfto each element in L.
Load balancing in HAP: ParallelList
In GAP the command List(L,f); inputs a list Land a function f. It returns the list obtained by applying fto each element inL. The HAP command ParallelList(L,"f",S);inputs a list L, a string name "f"for a function fand a listSof child processes. It returns the list obtained by applyingfto each element in L. ParallelList(L,"f",S);runs through the elements of the listL and, for each element x, waits until some process inSis 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 Land a function f. It returns the list obtained by applying fto each element inL. The HAP command ParallelList(L,"f",S);inputs a list L, a string name "f"for a function fand a listSof child processes. It returns the list obtained by applyingfto each element in L. ParallelList(L,"f",S);runs through the elements of the listL and, for each element x, waits until some process inSis 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.