int main(int argc, char **argv) { int rang, nproc, est, ouest, me, P; MPI_Init(&argc, &argv); /* Initialisation des données du problème */ MPI_Comm_rank(MPI_COMM_WORLD, &rang); MPI_Comm_size(MPI_COMM_WORLD, &nproc); est = (rang+1) % nproc; ouest = (rang+nproc-1) % nproc; me = (rang == 0 ? 0 : -1); /* On retrouve a partir d'ici l'algorithme de renumerotation de l'anneau Rappel : on dispose de est et de ouest, on cherche a recalculer son rang me */ me = numerotation(me, ouest, est); // Verification if (me != rang) { printf("P%d : ERREUR, me = %d\n", rang, me); } else { printf("P%d/%d : SUCCES\n", rang, nproc); } MPI_Finalize(); return 0; }
int main(){ int numero = 333; char phrase[TAILLE_MAX+3] = "abyz????????e"; printf("Avant numérotation : %s\n", phrase); numerotation(phrase, numero); printf("Après numérotation : %s\n", phrase); printf("Avant codage : %s\n", phrase); char x = choixLettre(); printf("Choix de la lettre : %c\n", x); codage(phrase, x); printf("Après codage : %s\n", phrase); decodage(phrase, x); printf("Après décodage : %s\n\n", phrase); ecrireDansFichier(phrase); return 0; }