

Main 



Remote DataA remote data handle RD a represents data of type a which may be located on a remote machine. Such a handle is very small and can be passed via intermediate machines with only litle communication overhead. You can create remote data using the function:release :: Trans a => a > RD aIt converts local data into corresponding remote data. You can access a remote value using the function fetch: fetch :: Trans a => RD a > athis estabishes a direct connection to the process which released the data in the first place. Notice that you have to fetch a remote value exactly once! Similar but for lists are the predefined functions: releaseAll :: Trans a => [a] > [RD a]which transforms a list of local data into a corresponding remote data list and fetchAll :: Trans a => [RD a] > [a]which transforms a list of remote data into a corresponding local list. Function call map fetch would give similar results but would wait for each list element until fetching the next one. Function fetchAll blocks only on partial defined list structure, not on content.
Functions liftRD, liftRD2, ... are used to lift functions acting
on normal data to function performing the same computation on Remote Data. liftRD :: (Trans a, Trans b) => (a > b) > RD a > RD b liftRD f = release . f . fetch Example: Hamming process network using Remote DataThe hamming process network calculates the hamming numbers with 5 processes: hamming :: [Int] hamming = 1: sm (fetch (sMerge # ((multp 2) # release hamming, (multp 3) # release hamming)) ) (fetch ((multp 5) # release hamming)) multp :: Int > Process (RD [Int]) (RD [Int]) multp n = process (liftRD (map (*n))) sMerge:: Process (RD [Int], RD [Int]) (RD [Int]) sMerge = process (uncurry (liftRD2 sm)) sm :: [Int] > [Int] > [Int] sm [ ] ys = ys sm xs [ ] = xs sm (x:xs)(y:ys)  x < y = x : sm xs (y:ys)  x == y = x : sm xs ys  otherwise= y : sm (x:xs) ysThe implementation with remote data builds a topology of stream channels as they are depicted in the picture (without the indirection of the basic version). Example: Process Pipe using Remote DataThe following example defines a process pipe where the processes communicate their Remote Data handles via the caller process but fetch the actual data from their predecessor processes:pipeRD :: forall a . Trans a => [a > a] > RD a > RD a pipeRD fs xs = (last outs) where outs = spawn ps (xs : outs) ps :: [Process (RD a) (RD a)] ps = map (process . liftRD) fsThe skeleton is defined for data of type [a], thus the list of inputs and the intermediate results will be streamed element by element through the process pipe.  
Eden  Parallel Functional Programming. EMail This page: http://www.mathematik.unimarburg.de/~eden 
Last change: 14/06/12  