Implicitly threaded parallelism in Manticore

MATTHEW FLUET, MIKE RAINEY, JOHN REPPY, ADAM SHAW
2010 Journal of functional programming  
The increasing availability of commodity multicore processors is making parallel computing available to the masses. Traditional parallel languages are largely intended for large-scale scientific computing and tend not to be well-suited to programming the applications one typically finds on a desktop system. Thus we need new parallel-language designs that address a broader spectrum of applications. In this paper, we present Manticore, a language for building parallel applications on commodity
more » ... ticore hardware including a diverse collection of parallel constructs for different granularities of work. We focus on the implicitly-threaded parallel constructs in our high-level functional language. We concentrate on those elements that distinguish our design from related ones, namely, a novel parallel binding form, a nondeterministic parallel case form, and exceptions in the presence of data parallelism. These features differentiate the present work from related work on functional data parallel language designs, which has focused largely on parallel problems with regular structure and the compiler transformations -most notably, flattening -that make such designs feasible. We describe our implementation strategies and present some detailed examples utilizing various mechanisms of our language. [| if x<0 then raise A else 0, if y>0 then raise A else 0 |] val f1 = future (fn () => ...) val f2 = future (fn () => ...) fun go() = (case (poll(f1), poll(f2)) of (NONE, NONE) => state00() | (NONE, SOME t) => state01(t) | (SOME t, NONE) => state10(t) | (SOME t1, SOME t2) => state11(t1,t2)) and state00() = go() and state01(t) = (case t of Val false => (cancel f2; false) | _ => go()) and state10(t) = (case t of Val false => (cancel f1; false) | _ => go()) and state11(t1,t2) = (case (t1,t2) of (Val false, _) => false | (_, Val false) => false | (Val true, Val true) => true | _ => raise Match)
doi:10.1017/s0956796810000201 fatcat:oec6ymxzczdxlalsnvntxlnp7q