/// <summary> /// Creates a cloud computation that will execute provided computation on every available worker /// in the cluster and if successful returns the array of gathered results. /// This operator may create distribution. /// Any exception raised by children carry cancellation semantics. /// </summary> /// <typeparam name="TResult">Computation return type.</typeparam> /// <param name="workflow"></param> /// <returns>Array of the aggregated results.</returns> public static Cloud <TResult[]> Parallel <TResult>(Cloud <TResult> workflow) { return(MCloud.Parallel(workflow)); }
/// <summary> /// Creates a cloud computation that will execute given computations to targeted workers /// possibly in parallel and if successful returns the array of gathered results. /// This operator may create distribution. /// Exceptions raised by children carry cancellation semantics. /// </summary> /// <typeparam name="TResult">Computation return type.</typeparam> /// <param name="workflows">Input workflows to be executed in parallel in each worker.</param> /// <returns>Array of the aggregated results.</returns> public static Cloud <TResult []> Parallel <TResult>(this IEnumerable <Tuple <Cloud <TResult>, IWorkerRef> > workflows) { var wfs = workflows.ToArray(); return(MCloud.Parallel(wfs)); }
/// <summary> /// Executes a collection of workflows using parallel fork/join semantics. /// </summary> /// <typeparam name="TResult">Computation return type.</typeparam> /// <param name="workflows">Input workflows to be executed in parallel.</param> /// <returns>Array of aggregated results.</returns> public static Cloud <TResult[]> Parallel <TResult>(this IEnumerable <Cloud <TResult> > workflows) { var wfs = workflows.Select(w => w).ToArray(); return(MCloud.Parallel(wfs)); }