Re: nested upc_notify?

From: Dan Bonachea (bonachea_at_cs_dot_berkeley_dot_edu)
Date: Tue Jan 18 2005 - 15:37:48 PST

  • Next message: Richard Walsh: "Question on supported combination of Opsys/Proc/Comp/ABI ..."
    The UPC spec prohibits nesting of barrier statements - after a thread executes 
    upc_notify, the next collective operation it invokes must be upc_wait.
    
    As a debugging aid, Berkeley UPC attempts to issue an error message (at least 
    in debug mode) if you attempt to do this erroneous behavior. It generally 
    looks something like this:
    
    Hello1 from thread 1 of 2
    Hello1 from thread 0 of 2
    UPC Runtime error: misordered call to barrier notify
    UPC Runtime error: misordered call to barrier notify
    
    or this:
    
    Hello1 from thread 0 of 1
    *** GASNet FATAL ERROR: gasnet_barrier_notify() called twice in a row
    *** Caught a fatal signal: SIGABRT(6) on node 0/1
    
    I'm not sure why you didn't see that error - perhaps your batch system lost 
    stderr?
    
    Dan
    
    At 01:18 PM 1/18/2005, Venelin Mitov wrote:
    >Hi,
    >
    >Can we nest upc_notify statements? I tried the following example with 4 
    >threads.
    >Only the Hello0 message was printed by each thread which means that
    >all threads fail when trying to execute the second upc_notify
    >(upc_notify 2; for threads < 2 and upc_notify 1; for threads >= 2).
    >
    >#include <upc_relaxed.h>
    >#include <stdio.h>
    >
    >shared int A[THREADS];
    >
    >int main(int argc, char *argv[])
    >{
    >     int i;
    >
    >     if(MYTHREAD < 2)
    >         upc_notify 1;
    >     else
    >         upc_notify 2;
    >
    >     A[THREADS - MYTHREAD - 1] = THREADS - MYTHREAD - 1;
    >
    >     printf("Hello1 from thread %d of %d\n", MYTHREAD, THREADS);
    >
    >     if(MYTHREAD < 2){
    >         upc_notify 2;
    >         printf("Hello2 from thread %d of %d\n", MYTHREAD, THREADS);
    >     //  upc_wait 1;
    >         upc_wait 2;
    >         printf("Hello3 from thread %d of %d\n", MYTHREAD, THREADS);
    >     }
    >     else{
    >         upc_notify 1;
    >         printf("Hello2 from thread %d of %d\n", MYTHREAD, THREADS);
    >     //  upc_wait 2;
    >         upc_wait 1;
    >         printf("Hello3 from thread %d of %d\n", MYTHREAD, THREADS);
    >     }
    >     if(MYTHREAD == 0)
    >         for(i = 0; i < THREADS; i++)
    >             printf("%d", A[i]);
    >     if(MYTHREAD < 2)
    >         upc_wait 1;
    >     else
    >         upc_wait 2;
    >}
    >
    >Here is the output I receive when running the example:
    >
    >------------------------------------------------------------
    ># LSBATCH: User input
    >upcjob gasnetrun_gm -np 4 hello
    >------------------------------------------------------------
    >
    >Exited with exit code 6.
    >
    >Resource usage summary:
    >
    >     CPU time   :      0.84 sec.
    >     Max Memory :         5 MB
    >     Max Swap   :         9 MB
    >
    >     Max Processes  :         1
    >
    >The output (if any) follows:
    >
    >UPCR: UPC thread 0 of 4 on hpc-n21 (process 0 of 4, pid=30095)
    >UPCR: UPC thread 3 of 4 on hpc-n09 (process 3 of 4, pid=19017)
    >UPCR: UPC thread 2 of 4 on hpc-n08 (process 2 of 4, pid=15463)
    >UPCR: UPC thread 1 of 4 on hpc-n06 (process 1 of 4, pid=3483)
    >Hello from thread 0 of 4
    >Hello from thread 1 of 4
    >Hello from thread 2 of 4
    >Hello from thread 3 of 4
    >
    >TID  HOST_NAME    COMMAND_LINE            STATUS            TERMINATION_TIME
    >==== ========== 
    >================  =======================  ===================
    >0001 hpc-n06    gasnetrun_gm --g  Killed by PAM (SIGTERM)  01/18/2005 
    >21:47:30
    >0002 hpc-n21    gasnetrun_gm --g  Killed by PAM (SIGTERM)  01/18/2005 
    >21:47:30
    >0003 hpc-n08    gasnetrun_gm --g  Signaled (SIGIOT)        01/18/2005 
    >21:47:30
    >0004 hpc-n09    gasnetrun_gm --g  Killed by PAM (SIGTERM)  01/18/2005 
    >21:47:30
    >
    >Thank you!
    >
    >Venelin
    

  • Next message: Richard Walsh: "Question on supported combination of Opsys/Proc/Comp/ABI ..."