[Swift-devel] file declaration inside foreach
Mihael Hategan
hategan at mcs.anl.gov
Tue Apr 24 17:45:27 CDT 2007
If you modify the file from the previous step, then the two steps are
not independent.
An array would work, but you probably don't need it.
foreach i in range {
file p=modify(original, i);
lattice[i] = lqcd_exec(p, lattice[i-1]);
}
On Tue, 2007-04-24 at 17:23 -0500, Veronika V. Nefedova wrote:
> nope, each modification is independent of each other (you could modify the
> file from the previous step, or from the step 0), but we need to make sure
> that the correct input file is present for each main application run (in
> the loop). I guess an array would work? (;
>
> Nika
>
> At 05:15 PM 4/24/2007, Mihael Hategan wrote:
> >So which is it? Does each step depend on the previous step, or some
> >modification of the initial data, or both?
> >
> >On Tue, 2007-04-24 at 16:53 -0500, Veronika V. Nefedova wrote:
> > > Well, I also need to run one small program inside that loop that doesn't
> > > have that data dependency. Basically what that program does is modifies
> > the
> > > input file for the main application at every loop step:
> > >
> > > original=modify(original,i);
> > >
> > > I am sure this one wouldn't work (; and I'd have to create an array of
> > > input files (one for each i) ?
> > >
> > > Nika
> > >
> > > At 04:45 PM 4/24/2007, Yong Zhao wrote:
> > > >Right, if there is data dependency, then it is not necessary.
> > > >
> > > >Yong.
> > > >
> > > >On Tue, 24 Apr 2007, Mihael Hategan wrote:
> > > >
> > > > > Why if we can actually express the problem?
> > > > >
> > > > > On Tue, 2007-04-24 at 16:30 -0500, Yong Zhao wrote:
> > > > > > There was a sequential option for 'foreach', and maybe we can
> > translate
> > > > > > that into a sequential for in karajan.
> > > > > >
> > > > > > Yong.
> > > > > >
> > > > > > On Tue, 24 Apr 2007, Ben Clifford wrote:
> > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Tue, 24 Apr 2007, Veronika V. Nefedova wrote:
> > > > > > >
> > > > > > > > The main problem: it submitted 2 jobs at once (foreach loop is
> > > > for i=1,2). And
> > > > > > > > since the jobs were supposed to run one after another - they all
> > > > failed
> > > > > > > > (application failure)
> > > > > > >
> > > > > > > ok. That's expected, or at least, I expect it.
> > > > > > >
> > > > > > > foreach is a parallel map-like operation for running some
> > action on
> > > > each
> > > > > > > element in an array independent of the other elements.
> > > > > > >
> > > > > > > I think you probably can't express that kind of iteration in
> > > > SwiftScript
> > > > > > > at the moment (unless 'while' happens to work for you) though I'm
> > > > poking
> > > > > > > round with ways to express that. (in functional programming terms,
> > > > you're
> > > > > > > trying to do a fold rather than a map, I think).
> > > > > > >
> > > > > > > --
> > > > > > > _______________________________________________
> > > > > > > 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
> > > > > >
> > > > >
> > > > >
> > > >_______________________________________________
> > > >Swift-devel mailing list
> > > >Swift-devel at ci.uchicago.edu
> > > >http://mail.ci.uchicago.edu/mailman/listinfo/swift-devel
> > >
> > >
>
>
More information about the Swift-devel
mailing list