[Swift-user] Coordination between app calls in foreach loop

Yadu Nand yadudoc1729 at gmail.com
Fri Sep 20 16:13:26 CDT 2013


Hi Ketan,

I have a test which can confirm the same behavior you are seeing, which I
think is a bug.

For now, I have a tested piece of code which forces the three foreach loops
into sequence:
Hope this helps:

iterate loop_count {
    switch (loop_count) {
    case 0:
        foreach i in [0:3]{
            outfileA[i] = A ("astring");
            art[i]=i;
        }

    case 1:
        foreach j in [0:3]{
            outfileB[j] = B ("bstring");
        }

    default:
 tracef("Reached end loop_count:%i \n", loop_count);
    }
} until (loop_count == 2);

Thanks,
-Yadu


On Fri, Sep 20, 2013 at 2:08 PM, Ketan Maheshwari <
ketancmaheshwari at gmail.com> wrote:

> Hi,
>
> I am working with APS user Hemant Sharma (in CC) on one of his projects.
> Hemant wrote a Swift script which has about three foreach invocations which
> he wants to run one after other.
>
> In order to achieve this coordination, Hemant is using an int[] in one
> loop which is passed as input to the app call of another loop. He observes
> that the coordination is not maintained and both app calls happen
> simultaneously resulting in application error.
>
> Here is a quick reproduction I tried and I observe indeed that
> coordination is not happening:
>
> $ cat dummy.swift
> type file;
>
> app (file out) A (string in1){
>   dummyA in1 stdout=@out;
> }
>
> app (file out) B (string in1, int[] _art){
>   dummyB in1 stdout=@out;
> }
>
> file outfileA[]<simple_mapper; location="outdir",
> prefix="a.",suffix=".out">;
> file outfileB[]<simple_mapper; location="outdir",
> prefix="b.",suffix=".out">;
>
> int art[];
> foreach i in [0:3]{
>  outfileA[i] = A ("astring");
>  art[i]=i;
>  }
>
> foreach j in [0:3]{
>  outfileB[j] = B ("bstring", art);
>  }
>
> Since the art array is wholly required in app B, one would expect the
> first foreach to finish befor the call to B gets invoked. This is not
> happening in my simple test where I ask the executable called by A to sleep
> for 5 sec and that called by B to print timestamp and quit.
>
> I see in the resulting files that the timestamps in B precede those in A.
>
> This looks like a bug to me. Swift is 0.94 swift-r7091 cog-r3789.
>
> Thanks,
>  --
> Ketan
>
>
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
>



-- 
Yadu Nand B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20130920/92d95537/attachment.html>


More information about the Swift-user mailing list