upc_barrier

From: Eric Frederich (eric.frederich_at_gmail_dot_com)
Date: Fri Nov 25 2005 - 07:19:35 PST

  • Next message: Marc L. Smith: "Re: upc_barrier"
    Hello, and happy thanksgiving.
    
    I went home to visit my family and forgot to pack my UPC book that my
    professor let me borrow.  Anyway, I googled for upc_barrier and came
    across an example.  I get results which seem unexpected.  Even if I add
    fflush(stdout) after the printf statements I still get the hello's and
    goodbye's mixed together.
    Does this seem right?
    
    Thanks,
    ~Eric
    
    This is my output...
    
    UPCR: UPC thread 1 of 2 on penguin27 (process 1 of 2, pid=11019)
    UPCR: UPC thread 0 of 2 on myth (process 0 of 2, pid=14774)
    Hello: Process 1 of 2
    Goodbye: Process 1 of 2
    Hello: Process 0 of 2
    Goodbye: Process 0 of 2
    
    This is the code....
    
    http://www.cs.mtu.edu/~merk/public/SC2005_examples/upc_barrier.c
    
    // Hello world in UPC
    // Intro: upc_barrier
    
    #include <stdio.h>
    #include <upc.h>
    
    main ()
    {
      int t;
      for( t=0; t<THREADS; t++ ) {
        upc_barrier(1);
        if( t == MYTHREAD )
          printf ("Hello: Process %d of %d\n", MYTHREAD, THREADS);
      }
    // uncomment this a see what happens
    //if(MYTHREAD==0){upc_barrier(3);}
    
      for( t=0; t<THREADS; t++ ) {
        upc_barrier(2);
        if( t == MYTHREAD )
          printf ("Goodbye: Process %d of %d\n", MYTHREAD, THREADS);
      }
    }
    
    
    
    
    --
    ------------------------
    Eric L. Frederich
    

  • Next message: Marc L. Smith: "Re: upc_barrier"