[Swift-devel] file declaration inside foreach

Mihael Hategan hategan at mcs.anl.gov
Tue Apr 24 16:09:33 CDT 2007


It's been hacked around for a while now:
int[] r = [1:2:1];
for i in r {
}

I would though like to see for i in 1..2 working though.

On Tue, 2007-04-24 at 21:00 +0000, Ben Clifford wrote:
> there isn't a plain for statement at the moment. but it used to look like 
> a C/java style for, not a range-based for - like:
> 
> for(i=1; i<2; i++) {
>   ...
> }
> 
> which doesn't work given single assignment variables.
> 
> On Tue, 24 Apr 2007, Mihael Hategan wrote:
> 
> > Because the jobs are independent. You are creating iteratiion-local
> > variables between which there is no dependency.
> > 
> > What you want is something like this:
> > file[] lattice <...>;
> > lattice[0] = initialLattice;
> > for i in 1...2 {
> >   lattice[i] = app(lattice[i-1]);
> > }
> > 
> > On Tue, 2007-04-24 at 15:37 -0500, Veronika V. Nefedova wrote:
> > > Fortunately, Ti was able to fix my env on terminable (some faulty softenv 
> > > key thats not working in tcsh) so I was able to try the run there.
> > > The compilation was fine, no problems. Then it submitted the workflow.
> > > 
> > > 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)
> > > 
> > > Nika
> > > 
> > > 
> > > 
> > > At 03:17 PM 4/24/2007, Ben Clifford wrote:
> > > 
> > > >GCJ! that isn't normal java. is that what you normally use? it used to be
> > > >lame, though i have no idea now. also evitable is unsupported. try
> > > >terminable.
> > > >
> > > >On Tue, 24 Apr 2007, Veronika  V. Nefedova wrote:
> > > >
> > > > > You right! here is the output:
> > > > >
> > > > > [nefedova at evitable fermi_bench]$ swift -debug lqcd-genU.dtm
> > > > > lqcd-genU.dtm: source file is new. Recompiling.
> > > > > Detailed exception:
> > > > > java.lang.RuntimeException: Failed to convert .xml to .kml for 
> > > > lqcd-genU.dtm
> > > > >    at org.griphyn.vdl.karajan.Loader.compile(java.lang.String) (Unknown
> > > > > Source)
> > > > >    at org.griphyn.vdl.karajan.Loader.main(java.lang.String[]) (Unknown 
> > > > Source)
> > > > >    at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.so.6.0.0)
> > > > >    at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
> > > > > Caused by: java.lang.NullPointerException
> > > > >    at 
> > > > org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(java.io.File,
> > > > > org.apache.xmlbeans.SchemaType, org.apache.xmlbeans.XmlOptions) (Unknown
> > > > > Source)
> > > > >    at org.griphyn.vdl.model.ProgramDocument$Factory.parse(java.io.File)
> > > > > (Unknown Source)
> > > > >    at org.griphyn.vdl.engine.Karajan.main(java.lang.String[]) (Unknown 
> > > > Source)
> > > > >    at org.griphyn.vdl.karajan.Loader.compile(java.lang.String) (Unknown
> > > > > Source)
> > > > >    ...3 more
> > > > >
> > > > > Could not start execution.
> > > > >         Failed to convert .xml to .kml for lqcd-genU.dtm
> > > > > [nefedova at evitable fermi_bench]$
> > > > >
> > > > > Nika
> > > > >
> > > > > At 03:11 PM 4/24/2007, Ben Clifford wrote:
> > > > >
> > > > > > run with -debug and you should get a much longer output.
> > > > > >
> > > > > > On Tue, 24 Apr 2007, Veronika  V. Nefedova wrote:
> > > > > >
> > > > > > > I did some modifications to the dtm file, and now i get something
> > > > > > different:
> > > > > > >
> > > > > > > [nefedova at evitable fermi_bench]$ swift lqcd-genU.dtm
> > > > > > > Could not start execution.
> > > > > > >         Failed to convert .xml to .kml for lqcd-genU.dtm
> > > > > > > [nefedova at evitable fermi_bench]$ pwd
> > > > > > > /autonfs/home/nefedova/LQCD/fermi_bench
> > > > > > > [nefedova at evitable fermi_bench]$
> > > > > > >
> > > > > > > Any idea what the problem could be?
> > > > > > >
> > > > > > > Thanks,
> > > > > > >
> > > > > > > Nika
> > > > > > >
> > > > > > > At 01:39 PM 4/24/2007, Mihael Hategan wrote:
> > > > > > > > On Tue, 2007-04-24 at 13:32 -0500, Mihael Hategan wrote:
> > > > > > > > > Posting the kml file would be useful.
> > > > > > > >
> > > > > > > > Riiight. The nonexistent kml file. Nevermind me.
> > > > > > > >
> > > > > > > > >
> > > > > > > > > Mihael
> > > > > > > > >
> > > > > > > > > On Tue, 2007-04-24 at 13:23 -0500, Veronika V. Nefedova wrote:
> > > > > > > > > > Hi,
> > > > > > > > > >
> > > > > > > > > > I am wondering why this is not working?
> > > > > > > > > >
> > > > > > > > > > foreach i in range {
> > > > > > > > > > file in <simple_mapper;file=@strcat("lattice.",i);
> > > > > > > > > > file out <simple_mapper;file=@strcat("lattice.",i+1);
> > > > > > > > > > out=lqcd_exec(original,in);
> > > > > > > > > > }
> > > > > > > > > >
> > > > > > > > > > Swift complains about file declarations (mappers) inside foreach
> > > > > > > > statement:
> > > > > > > > > >
> > > > > > > > > > [nefedova at evitable fermi_bench]$ swift lqcd-genU.dtm
> > > > > > > > > > Could not compile SwiftScript source: line 11:1: unexpected 
> > > > token:
> > > > > > file
> > > > > > > > > > [nefedova at evitable fermi_bench]$
> > > > > > > > > >
> > > > > > > > > > Please let me know how to make it working (-;
> > > > > > > > > >
> > > > > > > > > > Thanks!
> > > > > > > > > >
> > > > > > > > > > Nika
> > > > > > > > > >
> > > > > > > > > > _______________________________________________
> > > > > > > > > > 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