[Swift-devel] continued questions on iterate

Michael Wilde wilde at mcs.anl.gov
Sun Mar 1 23:39:42 CST 2009


Im able to work around this by moving the s[0] assignments inside the 
iterate block, in an if(i==0) {} else {} construct.

Still, it seems the restriction is not intended.

- Mike


On 3/1/09 10:53 PM, Michael Wilde wrote:
> This program:
> 
> string s[];
> s[0]="hi ";
> iterate i {
>   s[i+1] = @strcat(s[i],"hi ");
>   trace(s[i]);
> } until(i==5);
> 
> Gives:
> 
> com$ swift it4.swift
> Could not start execution.
>         variable s has multiple writers.
> 
> -- 
> Its similar to the tutorial example:
> 
> counterfile a[]  <simple_mapper;prefix="foldout">;
> 
> a[0] = echo("793578934574893");
> 
> iterate v {
>   a[v+1] = countstep(a[v]);
>  print("extract int value ", at extractint(a[v+1]));
> } until (@extractint(a[v+1]) <= 1);
> 
> -- 
> 
> ...which I reported earlier as having problems (I think in addition to 
> the one above?)
> 
> This is using the latest swift, rev 2631, and latest cog.
> 
> I thought I had issues like this licked, but then updated the code to 
> get closer to what the user needs.
> 
> In this example, I dont see any violation of single-assignment, but 
> apparently swift does.
> 
> The full example that the test case above is for is at:
> www.ci.uchicago.edu/~wilde/oops8.swift, which encounters the same 
> multiple-writer problem.
> 
> I start with an initial "secondary structure" string of all A's, same 
> length as the protein sequence. After each folding round, a new 
> structure is derived for analysis and used as the starting point for the 
> next round. This has the same data access pattern as array s[] above:
> 
> foreach p, pn in protein {
>   OOPSOut result[][] <simple_mapper; prefix=@strcat("output/",p,"/")>;
>   SecSeq secseq[] <simple_mapper; 
> prefix=@strcat("seqseq/",p,"/"),suffix=".secseq">;
>   OOPSIn oopsin <ext; exec="OOPSIn.map.sh", i="input", p=protein>;
>   secseq[0] = sedfasta(oopsin.fasta, ["-e","s/./A/g"]);
>   boolean converged[];
>   iterate i {
>     SecSeq s;
>     result[i] = doRound(p,oopsin,secseq[i],i);
>     (converged[i],s) = analyzeResult(result[i], p, i, secseq[i]);
>     secseq[i+1] = s;
>   } until (converged[i] || (i==3));
> }
> 
> In this case, I get the same message for array secseq (varable has 
> multiple writers).
> 
> I
> 
> 
> _______________________________________________
> 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