[Swift-devel] Wishlist: array elements assignment

Tiberiu Stef-Praun tiberius at ci.uchicago.edu
Fri Mar 16 14:10:42 CDT 2007


The syntactic solution is acceptable, but the workflow does not get
executed, probably because it does not find any specific output file
names that need to be generated.
Can I force it to execute the problemset function ?
I was thinking of adding a transformation at its end that would create
a dummy file, but I'm not sure that this would trigger the execution
of the for loop.

Tibi

------------ code ----------

file solution) batch_lin_solver (file input){
        app{
                solver @filename(input) stdout=@filename(solution);
        }
}

(file solutions[]) problemset (file inputfiles[]){
        // _input_ is the file item, _i_ is its index
        foreach file input,i in inputfiles {
                file
solution<regexp_mapper;source=@input,match="(.*)",transform="\1.out">;
                solution=batch_lin_solver(input);
                solutions[i]=solution;
        }
}

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

results=problemset(problems);






On 3/16/07, Yong Zhao <yongzh at cs.uchicago.edu> wrote:
> a was mapped to concurrent mapper, but the assignment changes it to
> whatever is in x.
>
> On Fri, 16 Mar 2007, Mihael Hategan wrote:
>
> > On Fri, 2007-03-16 at 13:55 -0500, Yong Zhao wrote:
> > > That is the way to do it right now.
> >
> > Does it actually work?
> > Wouldn't a be mapped by a concurrent mapper?
> >
> > >
> > > On Fri, 16 Mar 2007, Mihael Hategan wrote:
> > >
> > > > On Fri, 2007-03-16 at 13:17 -0500, Yong Zhao wrote:
> > > > > Yeah, I actually thought about making the regexp_mapper to deal with an
> > > > > array of items.
> > > >
> > > > What would be the result of the following:
> > > > any a[];
> > > > foreach... {
> > > >   x <...>;
> > > >   x = ...;
> > > >   a[i] = x;
> > > > }
> > > >
> > > > ?
> > > >
> > > > >
> > > > > Yong.
> > > > >
> > > > > On Fri, 16 Mar 2007, Tiberiu Stef-Praun wrote:
> > > > >
> > > > > > -------- excerpts from the code ----
> > > > > > (file out) solver (file in){
> > > > > >     app{
> > > > > >         solve @filename(in) stdout=filename(out)
> > > > > >     }
> > > > > > }
> > > > > >
> > > > > >
> > > > > > (file solutions[]) problemset (file inputfiles[]){
> > > > > >         // _input_ is the file item, _i_ is its index
> > > > > >         foreach file input,i in inputfiles {
> > > > > >                 //FIXME: this one is an alternative that it would be
> > > > > > nice, because I could build the output filenames from input file names
> > > > > > on the fly
> > > > > >                 file
> > > > > > solutions[i]<regexp_mapper;source=@input,match=(.*),transform="\1.out">;
> > > > > >                 solutions[i]=solver(input);
> > > > > >         }
> > > > > > }
> > > > > >
> > > > > > file problems[]<filesys_mapper; prefix="X", suffix="*.gz">;
> > > > > >
> > > > > > //FIXME: alternative option for output file naming: declare them with
> > > > > > a regexp-like mapper from the input files:
> > > > > > file solutions[]<regexp_mapper;
> > > > > > source=@filenames(problems),match=(.*), transform="\1,out">
> > > > > >
> > > > > > solutions=problemset(problems);
> > > > > >
> > > > > > -------------------------
> > > > > >
> > > > > > I'm open for alternatives
> > > > > > I have N input files that I have to process, and generate N output files.
> > > > > > I have complete control over the naming of the physical input and output files
> > > > > > Currently, I was trying to do file  X.gz generates file X.gz.out
> > > > > > (hence the regexp mapper, as a means of doing string concatenation).
> > > > > >
> > > > > > See the FIXME comments for my thoughts
> > > > > >
> > > > > > --
> > > > > > 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
> > > > > >
> > > > > _______________________________________________
> > > > > 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