Changeset 3865

Show
Ignore:
Timestamp:
02/16/09 17:47:16 (16 hours ago)
Author:
goodell
Message:

Fix for ticket #409. MPIR_Comm_is_node_consecutive was not checking for whether
or not a communicator was node-aware, causing node-aware logic to be used on a
non-node-aware communicator.

Reviewed by thakur@.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • mpich2/trunk/src/mpi/comm/commutil.c

    r3837 r3865  
    284284        if (num_external == comm->remote_size) { 
    285285            MPIU_Assert(num_local == 1); 
    286             goto fn_fail
     286            goto fn_exit
    287287        } 
    288288 
     
    388388} 
    389389 
    390 /* Returns true if the processes in all the nodes are consecutive. For example,  
    391    if node 0 contains "0, 1, 2, 3", node 1 contains "4, 5, 6", and node 2  
    392    contains "7", we shall return true. */ 
     390/* Returns true if the communicator is node-aware and processes in all the nodes 
     391   are consecutive. For example, if node 0 contains "0, 1, 2, 3", node 1 
     392   contains "4, 5, 6", and node 2 contains "7", we shall return true. */ 
    393393int MPIR_Comm_is_node_consecutive(MPID_Comm * comm) 
    394394{ 
    395     if (comm->is_node_aware) 
     395    int i = 0, curr_nodeidx = 0; 
     396    int *internode_table = comm->internode_table; 
     397 
     398    if (!comm->is_node_aware) 
     399        return 0; 
     400 
     401    for (; i < comm->local_size; i++) 
    396402    { 
    397         int i = 0, curr_nodeidx = 0; 
    398         int *internode_table = comm->internode_table; 
    399         for (; i < comm->local_size; i++) 
    400         { 
    401             if (internode_table[i] == curr_nodeidx + 1) 
    402                 curr_nodeidx++; 
    403             else if (internode_table[i] != curr_nodeidx) 
    404                 return 0; 
    405         } 
    406     } 
     403        if (internode_table[i] == curr_nodeidx + 1) 
     404            curr_nodeidx++; 
     405        else if (internode_table[i] != curr_nodeidx) 
     406            return 0; 
     407    } 
     408 
    407409    return 1; 
    408410}