int r_set_remove( struct r_set* set, void const* cmp ) { set_dbg("Remove with compare element %p from set %p", (void*) cmp, (void*) set); return ht_del(&set->ht, cmp, set->cfg); }
int leave( mpiconfig_t *mpicfg, int id ){ int procrank, pred, succ; int actioncompleted; /* constraint: only coordinator process */ if (mpicfg->rank != 0){return -1;} /* Check if id does not exist */ procrank = ht_get( mpicfg->nodepool, id ); if ( procrank < 0 ) { printf("L %d ERR This id does not exist! \n", id); return -1; } strcpy( mpicfg->imsg.instruction, "leave" ); mpicfg->imsg.id = id; if ( procrank == mpicfg->rank ){ //MPI_Send(&instructionmsg, 1, MPI_INT, next_available_rank, 0, MPI_COMM_SELF); }else{ /* send instruction message */ MPI_Send(&mpicfg->imsg, 1, mpicfg->imsg_t, procrank, 0, MPI_COMM_WORLD); /* Upon recieving the leave instruction the node will distribute its files and send completion message here to the coordinator */ /* wait confirmation (or every other message that might come) */ actioncompleted = 0; while (!actioncompleted){ MPI_Recv(&mpicfg->imsg, 1, mpicfg->imsg_t, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE ); executeinstruction(mpicfg, mpicfg->imsg); if ( strcmp( mpicfg->imsg.instruction, "completed") == 0 ){break;} } /* now that nodes fids are taken up by its successor, remove the node from the net */ pred = aliveprocs_pred(mpicfg,id); succ = aliveprocs_succ(mpicfg,id); aliveprocs_remove(mpicfg, id); find_mark_id_leaving( mpicfg, procrank ); ht_del( mpicfg->nodepool, id); } return 0; }
/* * NAME: parse_grammar() * DESCRIPTION: check the grammar, return a pre-processed version */ string *parse_grammar(string *gram) { char buffer[STRINGSZ]; hashtab *ruletab, *strtab; rschunk *rschunks; rlchunk *rlchunks; rule *rgxlist, *strlist, *estrlist, *prodlist, *tmplist, *rr, *rrl; int token, ruleno, nrgx, nstr, nestr, nprod; ssizet glen; unsigned int buflen; bool nomatch; rulesym **rs; rule *rl, **r; long size; unsigned int len; # if MAX_STRLEN > 0xffffffL if (gram->len > 0xffffffL) { error("Grammar string too large"); } # endif /* initialize */ ruletab = ht_new(PARSERULTABSZ, PARSERULHASHSZ, FALSE); strtab = ht_new(PARSERULTABSZ, PARSERULHASHSZ, FALSE); rschunks = (rschunk *) NULL; rlchunks = (rlchunk *) NULL; rgxlist = strlist = estrlist = prodlist = tmplist = (rule *) NULL; nrgx = nstr = nestr = nprod = 0; size = 17 + 8; /* size of header + start rule */ glen = gram->len; nomatch = FALSE; token = gramtok(gram, &glen, buffer, &buflen); for (ruleno = 1; ; ruleno++) { switch (token) { case TOK_TOKSYM: /* * token rule definition */ r = (rule **) ht_lookup(ruletab, buffer, TRUE); if (*r != (rule *) NULL) { if ((*r)->type == RULE_UNKNOWN) { /* replace unknown rule */ rl = *r; rl->type = RULE_REGEXP; size += 4; nrgx++; if (rl->alt != (rule *) NULL) { rl->alt->next = rl->next; } else { tmplist = rl->next; } if (rl->next != (rule *) NULL) { rl->next->alt = rl->alt; } rl->alt = (rule *) NULL; rl->next = rgxlist; rgxlist = rl; } else if ((*r)->type == RULE_REGEXP) { /* new alternative regexp */ rl = rl_new(&rlchunks, RULE_REGEXP); *((*r)->last) = rl; (*r)->last = &rl->alt; } else { sprintf(buffer, "Rule %d previously defined as production rule", ruleno); goto err; } } else { /* new rule */ rl = rl_new(&rlchunks, RULE_REGEXP); str_ref(rl->symb = str_new(buffer, (long) buflen)); rl->chain.name = rl->symb->text; rl->chain.next = (hte *) *r; *r = rl; size += 4; nrgx++; rl->next = rgxlist; rgxlist = rl; } switch (gramtok(gram, &glen, buffer, &buflen)) { case TOK_REGEXP: str_ref(rl->u.rgx = str_new(buffer, (long) buflen)); (*r)->num++; (*r)->len += buflen; size += buflen + 1; break; case TOK_BADREGEXP: sprintf(buffer, "Rule %d: malformed regular expression", ruleno); goto err; case TOK_TOOBIGRGX: sprintf(buffer, "Rule %d: regular expression too large", ruleno); goto err; case TOK_SYMBOL: if (buflen == 7 && strcmp(buffer, "nomatch") == 0) { if (nomatch) { sprintf(buffer, "Rule %d: extra nomatch rule", ruleno); goto err; } nomatch = TRUE; rl->u.rgx = (string *) NULL; break; } /* fall through */ default: sprintf(buffer, "Rule %d: regular expression expected", ruleno); goto err; } /* next token */ token = gramtok(gram, &glen, buffer, &buflen); break; case TOK_PRODSYM: /* * production rule definition */ r = (rule **) ht_lookup(ruletab, buffer, TRUE); if (*r != (rule *) NULL) { if ((*r)->type == RULE_UNKNOWN) { /* replace unknown rule */ rl = *r; rl->type = RULE_PROD; size += 4; nprod++; if (rl->alt != (rule *) NULL) { rl->alt->next = rl->next; } else { tmplist = rl->next; } if (rl->next != (rule *) NULL) { rl->next->alt = rl->alt; } rl->alt = (rule *) NULL; rl->next = prodlist; prodlist = rl; } else if ((*r)->type == RULE_PROD) { /* new alternative production */ rl = rl_new(&rlchunks, RULE_PROD); *((*r)->last) = rl; (*r)->last = &rl->alt; } else { sprintf(buffer, "Rule %d previously defined as token rule", ruleno); goto err; } } else { /* new rule */ rl = rl_new(&rlchunks, RULE_PROD); str_ref(rl->symb = str_new(buffer, (long) buflen)); rl->chain.name = rl->symb->text; rl->chain.next = (hte *) *r; *r = rl; size += 4; nprod++; rl->next = prodlist; prodlist = rl; } rr = *r; rrl = rl; rs = &rl->u.syms; len = 0; for (;;) { switch (token = gramtok(gram, &glen, buffer, &buflen)) { case TOK_SYMBOL: /* * symbol */ r = (rule **) ht_lookup(ruletab, buffer, TRUE); if (*r == (rule *) NULL) { /* new unknown rule */ rl = rl_new(&rlchunks, RULE_UNKNOWN); str_ref(rl->symb = str_new(buffer, (long) buflen)); rl->chain.name = rl->symb->text; rl->chain.next = (hte *) *r; *r = rl; rl->next = tmplist; if (tmplist != (rule *) NULL) { tmplist->alt = rl; } tmplist = rl; } else { /* previously known rule */ rl = *r; } *rs = rs_new(&rschunks, rl); rs = &(*rs)->next; len += 2; continue; case TOK_STRING: case TOK_ESTRING: /* * string */ r = (rule **) ht_lookup(strtab, buffer, FALSE); while (*r != (rule *) NULL) { if ((*r)->symb->len == buflen && memcmp((*r)->symb->text, buffer, buflen) == 0) { break; } r = (rule **) &(*r)->chain.next; } if (*r == (rule *) NULL) { /* new string rule */ rl = rl_new(&rlchunks, RULE_STRING); str_ref(rl->symb = str_new(buffer, (long) buflen)); rl->chain.name = rl->symb->text; rl->chain.next = (hte *) *r; *r = rl; if (token == TOK_STRING) { size += 4; nstr++; rl->len = gram->len - glen - buflen - 1; rl->next = strlist; strlist = rl; } else { size += 3 + buflen; nestr++; rl->next = estrlist; estrlist = rl; } } else { /* existing string rule */ rl = *r; } *rs = rs_new(&rschunks, rl); rs = &(*rs)->next; len += 2; continue; case TOK_QUEST: /* * ? function */ if (gramtok(gram, &glen, buffer, &buflen) != TOK_SYMBOL) { sprintf(buffer, "Rule %d: function name expected", ruleno); goto err; } str_ref(rrl->func = str_new(buffer, (long) buflen)); len += buflen + 1; token = gramtok(gram, &glen, buffer, &buflen); /* fall through */ default: break; } break; } if (len > 255) { sprintf(buffer, "Rule %d is too long", ruleno); goto err; } rr->num++; rr->len += len; size += len + 2; break; case TOK_NULL: /* * end of grammar */ if (tmplist != (rule *) NULL) { sprintf(buffer, "Undefined symbol %s", tmplist->symb->text); goto err; } if (rgxlist == (rule *) NULL) { strcpy(buffer, "No tokens"); goto err; } if (prodlist == (rule *) NULL) { strcpy(buffer, "No starting rule"); goto err; } if (size > (long) USHRT_MAX) { strcpy(buffer, "Grammar too large"); goto err; } gram = make_grammar(rgxlist, strlist, estrlist, prodlist, nrgx, nstr, nestr, nprod, size); rs_clear(rschunks); rl_clear(rlchunks); ht_del(strtab); ht_del(ruletab); return gram; case TOK_ERROR: sprintf(buffer, "Rule %d: bad token", ruleno); goto err; case TOK_BADREGEXP: sprintf(buffer, "Rule %d: malformed regular expression", ruleno); goto err; case TOK_TOOBIGRGX: sprintf(buffer, "Rule %d: regular expression too large", ruleno); goto err; case TOK_BADSTRING: sprintf(buffer, "Rule %d: malformed string constant", ruleno); goto err; case TOK_TOOBIGSTR: sprintf(buffer, "Rule %d: string too long", ruleno); goto err; case TOK_TOOBIGSYM: sprintf(buffer, "Rule %d: symbol too long", ruleno); goto err; default: sprintf(buffer, "Rule %d: unexpected token", ruleno); goto err; } } err: rs_clear(rschunks); rl_clear(rlchunks); ht_del(strtab); ht_del(ruletab); error(buffer); return NULL; }
static void accept_m(void) { if(ht_get(&ht_m,i_m)!=-1) ht_del(&ht_m,i_m); ht_put(&ht_m,i_m++); if(i_m>=LIM_M) i_m=0; if(i_m==len_m) memo=(int(*)[M_SIZE])m_stretch(memo,len_m=i_m*2,i_m,sizeof(int[M_SIZE])); }
int executeinstruction(mpiconfig_t *mpicfg, instructionmsg_t imsg){ int i, size, err, instructionmsg, ctr; int actioncompleted; int hostnamelen, nodepoolnumel, filepoolnumel, claimedfilepoolnumel; int *nodepoolentriesk, *nodepoolentriesv; int *filepoolkeys, *claimedfilepoolkeys; MPI_Datatype instructmsg_mpi_t; int resultlen; MPI_Status status; int fid, maxpid; MPI_Datatype array_of_types[2]; int array_of_blocklengths[2]; MPI_Aint array_of_displaysments[2]; MPI_Aint intex, charex, lb; //execute instruction message: if ( strcmp( mpicfg->imsg.instruction, "join") == 0 ) { /* Process is reading the newspaper */ if(EBUG){printf("Proccess %d received JOIN. \n", mpicfg->rank );} mpicfg->id = mpicfg->imsg.id; /* Request file ids from successor */ strcpy( mpicfg->imsg.instruction, "claimfiles" ); mpicfg->imsg.id = mpicfg->id; mpicfg->imsg.senderrank = mpicfg->rank; //printf("Proccess %d is about to claim files from %d. \n", mpicfg->rank, mpicfg->succrank ); MPI_Send(&mpicfg->imsg, 1, mpicfg->imsg_t, mpicfg->succrank, 0, MPI_COMM_WORLD); /* receive file ids */ MPI_Recv(&claimedfilepoolnumel, 1, MPI_INT, mpicfg->succrank, 0, MPI_COMM_WORLD,MPI_STATUS_IGNORE); //printf("Proccess %d had claimed files. \n", mpicfg->rank ); if (claimedfilepoolnumel > 0 ){ claimedfilepoolkeys = (int*)calloc(claimedfilepoolnumel, sizeof(int)); }else{ claimedfilepoolkeys = (int*)calloc(1, sizeof(int)); } MPI_Recv(claimedfilepoolkeys, claimedfilepoolnumel, MPI_INT, mpicfg->succrank, 0, MPI_COMM_WORLD,MPI_STATUS_IGNORE); /* Update local filepool */ for (i=0;i<claimedfilepoolnumel;i++){ ht_set( mpicfg->filepool, claimedfilepoolkeys[i], 1); } /* node joining the gang is done */ filepoolkeys = (int*)calloc(mpicfg->filepool->nentries, sizeof(int)); if ( ht_dumpkeys( mpicfg->filepool, filepoolkeys ) < 0){ printf("error in HT dump!\n"); } printf("J %d DONE, PRED = %d, SUCC = %d, DocList = ", mpicfg->id, mpicfg->predid,mpicfg->succid); for (i=0;i<mpicfg->filepool->nentries;i++){ printf("%d, ", filepoolkeys[i]); } printf("\n"); free(filepoolkeys); free(claimedfilepoolkeys); if(EBUG){printf("Proccess %d COMPLETED JOIN. \n", mpicfg->rank );} /* Join completed; inform coordinator */ strcpy( mpicfg->imsg.instruction, "completed" ); mpicfg->imsg.id = -1; mpicfg->imsg.senderrank = mpicfg->rank; //printf("Proccess %d is about to send complete for join. \n", mpicfg->rank ); MPI_Send(&mpicfg->imsg, 1, mpicfg->imsg_t, 0, 0, MPI_COMM_WORLD); } else if ( strcmp( mpicfg->imsg.instruction, "update") == 0 ) { /* Process is reading the newspaper */ if(EBUG){printf("Proccess %d received UPDATE for id %d. \n", mpicfg->rank, mpicfg->imsg.id );} if ( mpicfg->id < 0){ mpicfg->id = mpicfg->imsg.id; } /* Get updates on helper arrays */ MPI_Bcast(mpicfg->procstatus, mpicfg->num_procs, MPI_INT , 0, MPI_COMM_WORLD); MPI_Bcast(mpicfg->aliveprocs, mpicfg->num_procs, MPI_INT , 0, MPI_COMM_WORLD); /* Get updates on ht */ MPI_Recv(&nodepoolnumel, 1, MPI_INT, 0, 0, MPI_COMM_WORLD,MPI_STATUS_IGNORE); nodepoolentriesk = (int*)calloc(nodepoolnumel, sizeof(int)); MPI_Recv(nodepoolentriesk, nodepoolnumel, MPI_INT, 0, 0, MPI_COMM_WORLD,MPI_STATUS_IGNORE); nodepoolentriesv = (int*)calloc(nodepoolnumel, sizeof(int)); MPI_Recv(nodepoolentriesv, nodepoolnumel, MPI_INT, 0, 0, MPI_COMM_WORLD,MPI_STATUS_IGNORE); //printf("Proccess %d woken up and informed by coordinator. \n", mpicfg->rank ); /* Update local nodepool */ for (i=0;i<nodepoolnumel;i++){ ht_set( mpicfg->nodepool, nodepoolentriesk[i], nodepoolentriesv[i]); } /* Get pred/succ from local info */ mpicfg->predid = aliveprocs_pred(mpicfg,mpicfg->imsg.id); mpicfg->succid = aliveprocs_succ(mpicfg,mpicfg->imsg.id); mpicfg->predrank = ht_get( mpicfg->nodepool, mpicfg->predid ); mpicfg->succrank = ht_get( mpicfg->nodepool, mpicfg->succid ); free(nodepoolentriesv); free(nodepoolentriesk); if(EBUG){printf("Proccess %d COMPLETED UPDATE. \n", mpicfg->rank );} /* Join completed; inform coordinator */ strcpy( mpicfg->imsg.instruction, "completed" ); mpicfg->imsg.id = -1; mpicfg->imsg.senderrank = mpicfg->rank; //printf("Proccess %d is about to send complete for join. \n", mpicfg->rank ); MPI_Send(&mpicfg->imsg, 1, mpicfg->imsg_t, 0, 0, MPI_COMM_WORLD); } else if ( strcmp( mpicfg->imsg.instruction, "leave") == 0 ) { if(EBUG){printf("Proccess %d received LEAVE. \n", mpicfg->rank );} /* Return file ids to successor */ filepoolnumel = mpicfg->filepool->nentries; filepoolkeys = (int*)calloc(filepoolnumel, sizeof(int)); if ( ht_dumpkeys( mpicfg->filepool, filepoolkeys ) < 0){ printf("error in HT dump!\n"); } /* Send file ids to successor node */ strcpy( mpicfg->imsg.instruction, "returnfiles" ); mpicfg->imsg.id = mpicfg->id; mpicfg->imsg.senderrank = mpicfg->rank; MPI_Send(&filepoolnumel, 1, MPI_INT, mpicfg->succrank, 0, MPI_COMM_WORLD); MPI_Send(filepoolkeys, filepoolnumel, MPI_INT, mpicfg->succrank, 0, MPI_COMM_WORLD); /* Update (delete) local filepool */ for (i=0;i<filepoolnumel;i++){ ht_del( mpicfg->filepool, filepoolkeys[i]); } printf("L %d DONE, PRED = %d, SUCC = %d, DocList = ", mpicfg->id, mpicfg->predid,mpicfg->succid); printf("\n"); free(filepoolkeys); /*destroy process params since its out of the network */ mpicfg->id = -1; mpicfg->predid = -1; mpicfg->succid = -1; mpicfg->predrank = -1; mpicfg->succrank = -1; if(EBUG){printf("Proccess %d COMPLETED LEAVE. \n", mpicfg->rank );} /* Leave completed; inform coordinator */ strcpy( mpicfg->imsg.instruction, "completed" ); mpicfg->imsg.id = -1; mpicfg->imsg.senderrank = mpicfg->rank;; //printf("Proccess %d is about to send complete for join. \n", mpicfg->rank ); MPI_Send(&mpicfg->imsg, 1, mpicfg->imsg_t, 0, 0, MPI_COMM_WORLD); } else if ( strcmp( mpicfg->imsg.instruction, "claimfiles") == 0 ) { if(EBUG){printf("Proccess %d received CLAIMFILES. \n", mpicfg->rank );} /* if no files are present : */ if ( mpicfg->filepool->nentries > 0 ){ /* dump fids of this node */ filepoolkeys = (int*)calloc(mpicfg->filepool->nentries, sizeof(int)); if ( ht_dumpkeys( mpicfg->filepool, filepoolkeys ) < 0){ printf("error in HT dump!\n"); } claimedfilepoolkeys = (int*)calloc(mpicfg->filepool->nentries, sizeof(int)); /* get fids that belong to the claiming node */ ctr = 0; for (i=0;i<mpicfg->filepool->nentries;i++){ if( filepoolkeys[i] <= mpicfg->imsg.id ){ claimedfilepoolkeys[ctr] = filepoolkeys[i]; ctr++; } } claimedfilepoolnumel = ctr; }else{ claimedfilepoolkeys = NULL; claimedfilepoolnumel = 0; } //printf("Proccess %d is about to send claimed files to %d. \n", mpicfg->rank, mpicfg->imsg.senderrank ); /* Send file is to claiming node */ MPI_Send(&claimedfilepoolnumel, 1, MPI_INT, mpicfg->imsg.senderrank, 0, MPI_COMM_WORLD); /*Send file keys (ids) */ MPI_Send(claimedfilepoolkeys, claimedfilepoolnumel, MPI_INT, mpicfg->imsg.senderrank, 0, MPI_COMM_WORLD); /* remove those fids from this node */ if ( mpicfg->filepool->nentries > 0 ){ for (i=0;i<claimedfilepoolnumel;i++){ ht_del( mpicfg->filepool, claimedfilepoolkeys[i]); } free(claimedfilepoolkeys); free(filepoolkeys); } if(EBUG){printf("Proccess %d COMPLETED CLAIMFILES. \n", mpicfg->rank );} } else if ( strcmp( mpicfg->imsg.instruction, "returnfiles") == 0 ) { if(EBUG){printf("Proccess %d received RETURNFILES. \n", mpicfg->rank );} /* receive file ids from departing node */ MPI_Recv(&filepoolnumel, 1, MPI_INT, mpicfg->imsg.senderrank, 0, MPI_COMM_WORLD,MPI_STATUS_IGNORE); if (filepoolnumel > 0 ){ filepoolkeys = (int*)calloc(filepoolnumel, sizeof(int)); }else{ filepoolkeys = (int*)calloc(1, sizeof(int)); } MPI_Recv(filepoolkeys, filepoolnumel, MPI_INT, mpicfg->succrank, 0, MPI_COMM_WORLD,MPI_STATUS_IGNORE); /* Update local filepool */ for (i=0;i<filepoolnumel;i++){ ht_set( mpicfg->filepool, filepoolkeys[i], 1); } free(filepoolkeys); if(EBUG){printf("Proccess %d COMPLETED RETURNFILES. \n", mpicfg->rank );} } else if ( strcmp( mpicfg->imsg.instruction, "insert") == 0 ) { if(EBUG){printf("Proccess %d received INSERT. \n", mpicfg->rank );} fid = mpicfg->imsg.id; maxpid = aliveprocs_maxid( mpicfg ); /* check if fid is eligible for insertion and insert it */ if( ( mpicfg->predid < fid && fid <= mpicfg->id ) || ( fid > maxpid && mpicfg->id == mpicfg->aliveprocs[0] ) ){ ht_set( mpicfg->filepool, fid, 1 ); /* fid insert is done */ filepoolkeys = (int*)calloc(mpicfg->filepool->nentries, sizeof(int)); if ( ht_dumpkeys( mpicfg->filepool, filepoolkeys ) < 0){ printf("error in HT dump!\n"); } printf("I %d DONE, NODEID = %d, DOCLIST = ", fid, mpicfg->id); for (i=0;i<mpicfg->filepool->nentries;i++){ printf("%d, ", filepoolkeys[i]); } printf("\n"); free(filepoolkeys); if(EBUG){printf("Proccess %d COMPLETED INSERT. \n", mpicfg->rank );} /* send completion msg to coordinator */ strcpy( mpicfg->imsg.instruction, "completed" ); mpicfg->imsg.id = fid; mpicfg->imsg.senderrank = mpicfg->rank; MPI_Isend(&mpicfg->imsg, 1, mpicfg->imsg_t, 0, 0, MPI_COMM_WORLD, &mpicfg->pendingsend); } } else if ( strcmp( mpicfg->imsg.instruction, "find") == 0 ) { if(EBUG){printf("Proccess %d received FIND. \n", mpicfg->rank );} fid = mpicfg->imsg.id; maxpid = aliveprocs_maxid( mpicfg ); /* check if fid is under this node */ if( ( mpicfg->predid < fid && fid <= mpicfg->id ) || ( fid > maxpid && mpicfg->id == mpicfg->aliveprocs[0] ) ){ /* but might not be there */ err = ht_get( mpicfg->filepool, fid ); /* fid find is done */ filepoolkeys = (int*)calloc(mpicfg->filepool->nentries, sizeof(int)); if ( ht_dumpkeys( mpicfg->filepool, filepoolkeys ) < 0){ printf("error in HT dump!\n"); } if ( err < 0){ printf("F %d NOTFOUND, NODEID = %d, DOCLIST = ", fid, mpicfg->id); }else{ printf("F %d DONE, NODEID = %d, DOCLIST = ", fid, mpicfg->id); } for (i=0;i<mpicfg->filepool->nentries;i++){ printf("%d, ", filepoolkeys[i]); } printf("\n"); free(filepoolkeys); if(EBUG){printf("Proccess %d COMPLETED FIND. \n", mpicfg->rank );} /* send completion msg to coordinator */ strcpy( mpicfg->imsg.instruction, "completed" ); mpicfg->imsg.id = fid; mpicfg->imsg.senderrank = mpicfg->rank; //printf("Proccess %d is about to send complete for find. \n", mpicfg->rank ); //MPI_Send(&mpicfg->imsg, 1, mpicfg->imsg_t, 0, 0, MPI_COMM_WORLD); MPI_Isend(&mpicfg->imsg, 1, mpicfg->imsg_t, 0, 0, MPI_COMM_WORLD, &mpicfg->pendingsend); } } else if ( strcmp( mpicfg->imsg.instruction, "del") == 0 ) { if(EBUG){printf("Proccess %d received DEL. \n", mpicfg->rank );} fid = mpicfg->imsg.id; maxpid = aliveprocs_maxid( mpicfg ); /* check if fid is eligible for deletion and insert it */ if( ( mpicfg->predid < fid && fid <= mpicfg->id ) || ( fid > maxpid && mpicfg->id == mpicfg->aliveprocs[0] ) ){ err = ht_del( mpicfg->filepool, fid ); /* fid insert is done */ filepoolkeys = (int*)calloc(mpicfg->filepool->nentries, sizeof(int)); if ( ht_dumpkeys( mpicfg->filepool, filepoolkeys ) < 0){ printf("error in HT dump!\n"); } if ( err < 0){ printf("D %d NOTFOUND, NODEID = %d, DOCLIST = ", fid, mpicfg->id); }else{ printf("D %d DONE, NODEID = %d, DOCLIST = ", fid, mpicfg->id); } for (i=0;i<mpicfg->filepool->nentries;i++){ printf("%d, ", filepoolkeys[i]); } printf("\n"); free(filepoolkeys); if(EBUG){printf("Proccess %d COMPLETED DEL. \n", mpicfg->rank );} /* send completion msg to coordinator */ strcpy( mpicfg->imsg.instruction, "completed" ); mpicfg->imsg.id = fid; mpicfg->imsg.senderrank = mpicfg->rank; //printf("Proccess %d is about to send complete for insert. \n", mpicfg->rank ); //MPI_Send(&mpicfg->imsg, 1, mpicfg->imsg_t, 0, 0, MPI_COMM_WORLD); MPI_Isend(&mpicfg->imsg, 1, mpicfg->imsg_t, 0, 0, MPI_COMM_WORLD, &mpicfg->pendingsend); } } else if ( strcmp( mpicfg->imsg.instruction, "completed") == 0 ) { /*instruction completed successfully */ if(EBUG){printf("Proccess %d COMPLETED COMPLETED. \n", mpicfg->rank );} return 0; } else if ( strcmp( mpicfg->imsg.instruction, "stopexecution") == 0 ) { /* update process configuration in order to not listen for more messages from coordinator */ mpicfg->stopexecution = 1; } else { if(EBUG){printf("Proccess %d WTF. \n", mpicfg->rank );} } }