void main(int argc,char** argv){ int NPROC =8;/* default nb of proc */ int mytid;/* my task id */ int*tids;/* array of task id */ int me;/* my process number */ int i;
int N; char nom[255]; char nomsortie[255];
//vérification du nombre d'argument if(argc !=4){ printf("Usage: %s <matrix size><matrix name><matrix name out>\n", argv[0]); exit(-1); } // taille de la ligne de la matrice
N =atoi( argv[1]);
/* determine the size of my sibling list */
NPROC = pvm_siblings(&tids);
/* WARNING: tids are in order of spawning, which is different from
the task index JOINING the group */
me = pvm_joingroup( GRPNAME );/* me: task index in the group */
pvm_barrier( GRPNAME, NPROC );
pvm_freezegroup ( GRPNAME, NPROC ); for( i =0; i < NPROC; i++) tids[i]= pvm_gettid ( GRPNAME, i);
/*--------------------------------------------------------------------------*/ /* all the tasks are equivalent at that point */
dowork( me, tids, NPROC, nom, N, nomsortie);
pvm_lvgroup( GRPNAME );
pvm_exit(); }
void matrix_load (char nom[],double*tab,int N,int nproc,int tids[]){
FILE *f; int i,j; double buf[N]; double toto; int num_envoi; int ligne_courant=0;
for(i=decalage;i<(N/nproc);i++) {
pivot =(*(tab + i * N + k)/buffer[k]); for(j=k;j<N;j++) { *(tab + i * N +j)=*(tab + i * N + j)- pivot*buffer[j]; } } } }
/* Simple example passes a token around a ring */
dowork(int me,int tids[],int nproc,char nom[255],int N,char nomsortie[255]){
FILE *f; struct timeval tv1, tv2;/* for timing */ int duree; double*tab, pivot; int i,j,k =0,l; double buf; double buffer[N]; int num_envoi; int decalage =0; int ligne_courant =0; double coeff;