} endfor forall_nodes(G, node) { bool is_bnd = false; PartitionID pIdx = G.getPartitionIndex(node); forall_out_edges(G, e, node) { NodeID target = G.getEdgeTarget(e); if( pIdx != G.getPartitionIndex(target)) { is_bnd = true; break; } } endfor
char *getPartitionString(char c) { int i = getPartitionIndex(c); if (i == -1) return NULL; else return partitions[i]; }
int getCellScore (ProcessData * pData, ScoringData * sData, WavesData * wData, MOATypeShape * cellIndex, MOATypeElmVal * score, int * inSearchSpace, int NeighborSearch, MOATypeInd NeighbIndex) { int ret = 0; MOATypeDimn k; MOATypeInd NeighbFlatIndex; /*Check if cellIndex is found in the current scoring partition*/ if ((NeighborSearch == 1) && (IsCellInPart(cellIndex, sData->p_index, sData->seqNum, sData->seqLen, pData->partitionSize) == 0) && (getLocalIndex (cellIndex, sData->p_index, sData->seqNum, sData->seqLen, pData->partitionSize, &sData->neighbor) == 0)) { NeighbFlatIndex = Gamma(sData->neighbor, sData->msaAlgn->dimn, sData->msaAlgn->shape, sData->msaAlgn->dimn, 1); (*score) = sData->msaAlgn->elements[NeighbFlatIndex].val; if (sData->msaAlgn->elements[NeighbFlatIndex].prev != NULL && sData->msaAlgn->elements[NeighbFlatIndex].prev_ub > 0 && sData->NghbMOA != NULL && NeighbIndex >= 0 && NeighbIndex < sData->NghbMOA->elements_ub) { sData->NghbMOA->elements[NeighbIndex].prev = mmalloc(sizeof *sData->NghbMOA->elements[NeighbIndex].prev); sData->NghbMOA->elements[NeighbIndex].prev_ub = 1; sData->NghbMOA->elements[NeighbIndex].prev[0] = mmalloc(sData->seqNum * sizeof *sData->NghbMOA->elements[NeighbIndex].prev[0]); for (k=0;k<sData->seqNum;k++) sData->NghbMOA->elements[NeighbIndex].prev[0][k] = sData->msaAlgn->elements[NeighbFlatIndex].prev[0][k]; } } else { /*check if neighbor's partition is included in search space*/ MOATypeShape * partIndex = mmalloc (pData->seqNum * sizeof *partIndex); if (getPartitionIndex (cellIndex, pData->seqNum, pData->seqLen, wData->partitionSize, &partIndex) == 0) { if ((*inSearchSpace) = isPartInSearchSpace(partIndex, wData) == 0) { long waveNo, partNo; getPartitionPosition (wData, partIndex, &waveNo, &partNo); if (partNo >= 0) { if (myProcid == getProcID (wData, waveNo, partNo)) { /*Check if Neighbor is found in other local partitions OCout Buffer*/ if(checkPrevPartitions(pData, cellIndex, score) != 0) { /*average the neighboring (up to 2 strides) cell scores*/ (*score) = averageNeighborsScore(pData, sData, wData, cellIndex); } } /*Check if Neighbor is already received from other processors in OCin Buffer*/ else if (checkRecvOC(pData, wData, cellIndex, score, 0) != 0) ret = -1; } } } free (partIndex); } return ret; }
forall_out_edges(G, e, node) { NodeID target = G.getEdgeTarget(e); PartitionID target_block = G.getPartitionIndex(target); gamma->set_xy( node, target_block, gamma->get_xy(node, target_block) + 1); } endfor
void setPartitionString(char c, char *string) { int i = getPartitionIndex(c); if (i != -1) partitions[i] = string; }