[Swift-devel] Swift Question/Request

Tiberiu Stef-Praun tiberius at ci.uchicago.edu
Tue Apr 3 10:52:08 CDT 2007


I'm not sure that the workflow below will wok as intended.
The uncertainty I have is after the submission to execution of the
moralhazard_problem procedure.
I have not tested it completely (I only ran it up to the
moralhazard_problem invocation), I'm still working on the
mergeSolutions script

Tibi

=====================================
type file{}

//define the linear solver
(file solutions) moralhazard_solver (file scriptfile, int batch_size,
int batch_no,
        file init_iteration, file init_param, file init_limits, file
init_surplus){
        app{
                moralhazard @filename(scriptfile) batch_size batch_no;
        }
}

//(file solutions[]) moralhazard_problem (file inputfiles[]){
moralhazard_problem (file inputfiles[]){
        file script<"scripts/moralhazard-param.m">;
        file iteration<"iteration.mat">;
        file param<"param.mat">;
        file limits<"limits.mat">;
        file surplus<"Surplus.mat">;

        // the limit of 36 needs to be adjusted
        // the batch_size can change, together with the limit
        // batch_size x batch_limit = gridsize(26x26)/2
        int batch_limit=36;
        int batch_size=10;
        int batch_range=[0:35];
        foreach i in batch_range {
                int position=i*batch_size;
                file solution<simple_mapper; prefix="hazard", suffix=position>;

solution=moralhazard_solver(script,batch_size,position,iteration,param,limits,surplus);
        }
}

file problems[] <filesys_mapper; prefix="moral_hazard_4.31_1", suffix=".gz">;
file results[];

moralhazard_problem (problems);

file solutions[]  <filesys_mapper; prefix="hazard">;
file solution <"mergedSolution.txt">;

file solution combineSolutions(file solverSolutions[]){
        app{
                mergeSolutions @filenames(solverSolutions)
stdout=@filename(solution);
        }
}

combineSolutions(solutions);



On 4/3/07, Yong Zhao <yongzh at cs.uchicago.edu> wrote:
> Can you be more specific about why it can't figure out the number of
> outputs correctly? The sequential order should already be defined in your
> example as there is explicit data dependency.
>
> Yong.
>
> On Tue, 3 Apr 2007, Tiberiu Stef-Praun wrote:
>
> > Sometimes i find myself in the position of wanting to do one step of
> > the swift script only after the previous phase has finished. The case
> > is the following (not really swift script):
> >
> > seq{
> > file stageOneOutputs[] = processStageOne();
> > file combine = combine(stageOneOutputs);
> > }
> >
> > In my case the problem seems to be the fact that swift cannot dream up
> > how many stageOneOutput files will exist (unless we extend the
> > language -probably the input mapper which I use in this case- to
> > support this feature), so it could decide to start the combine stage
> > prematurely.
> > Supposedly one solution is to create a dummy output file at the end of
> > stage one, and pass it tot stage two.
> >
> > Any suggestions ?
> >
> > I'm thinking that having an example in the user guide would help others as well.
> > Maybe we should have a "Patterns in Swift" document.
> >
> > Thanks
> > Tibi
> >
> > --
> > Tiberiu (Tibi) Stef-Praun, PhD
> > Research Staff, Computation Institute
> > 5640 S. Ellis Ave, #405
> > University of Chicago
> > http://www-unix.mcs.anl.gov/~tiberius/
> > _______________________________________________
> > Swift-devel mailing list
> > Swift-devel at ci.uchicago.edu
> > http://mail.ci.uchicago.edu/mailman/listinfo/swift-devel
> >
>


-- 
Tiberiu (Tibi) Stef-Praun, PhD
Research Staff, Computation Institute
5640 S. Ellis Ave, #405
University of Chicago
http://www-unix.mcs.anl.gov/~tiberius/



More information about the Swift-devel mailing list