nested upc_notify?

From: Venelin Mitov (vmitov_at_gmail_dot_com)
Date: Tue Jan 18 2005 - 13:18:29 PST

  • Next message: Dan Bonachea: "Re: nested upc_notify?"
    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: Dan Bonachea: "Re: nested upc_notify?"