#ifdef OMP #include #endif #include #include #include "mpi.h" //#include "pardef.h" #include "util.h" void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms, double *systemMatrix,long int *matrixIndex, int *instrCol,int *instrConstrIlung, struct comData comlsqr,time_t *ompSec) { // Parallel definitions int myid,nproc; long int *mapNoss, *mapNcoeff; int nthreads, tid; long **mapForThread; /// struct comData *comlsqr; // FILE *fk,*fk0; double zero=0.0; double sum, yi; long int l1,l2; long int i, i1; long int l, j, k; int i2=0,j2=0,j3=0,na=0; int setBound[4]; double localSum; short nAstroPSolved=comlsqr.nAstroPSolved; long localAstro= comlsqr.VrIdAstroPDim*nAstroPSolved; long localAstroMax=comlsqr.VrIdAstroPDimMax*nAstroPSolved; // Initialize. myid=comlsqr.myid; nproc=comlsqr.nproc; mapNcoeff=comlsqr.mapNcoeff; mapNoss=comlsqr.mapNoss; nthreads=comlsqr.nthreads; mapForThread=comlsqr.mapForThread; int multMI=comlsqr.multMI; long nparam=comlsqr.parOss; short nAttAxes=comlsqr.nAttAxes; int numOfExtStar=comlsqr.numOfExtStar; int numOfBarStar=comlsqr.numOfBarStar; int numOfExtAttCol=comlsqr.numOfExtAttCol; long VrIdAstroPDimMax=comlsqr.VrIdAstroPDimMax; int startingAttColExtConstr=comlsqr.startingAttColExtConstr; int nOfElextObs=comlsqr.nOfElextObs; int nEqExtConstr=comlsqr.nEqExtConstr; int nOfElBarObs=comlsqr.nOfElBarObs; int nEqBarConstr=comlsqr.nEqBarConstr; int debugMode=comlsqr.debugMode; short nInstrPSolved=comlsqr.nInstrPSolved; int nOfInstrConstr=comlsqr.nOfInstrConstr; int nElemIC=comlsqr.nElemIC; short nAttP=comlsqr.nAttP; short nGlobP=comlsqr.nGlobP; setBound[0]=comlsqr.setBound[0]; setBound[1]=comlsqr.setBound[1]; setBound[2]=comlsqr.setBound[2]; setBound[3]=comlsqr.setBound[3]; long nDegFreedomAtt=comlsqr.nDegFreedomAtt; short nAttParAxis=comlsqr.nAttParAxis; long offsetAttParam=comlsqr.offsetAttParam; long offsetInstrParam=comlsqr.offsetInstrParam; long offsetGlobParam=comlsqr.offsetGlobParam; nthreads=1; tid=0; FILE *fp1,*fp2; // fp1=fopen("test1_aprod","w"); // fp2=fopen("test2_aprod","w"); if(mode!=1 && mode !=2) { printf("ERROR: Invalid mode=%d in aprod function\n",mode); exit(1); } l1=0; l2=0; myid=comlsqr.myid; if(mode==1) { time_t startTime=time(NULL); #pragma omp parallel private(myid, sum, k, l1, l2, l, j,tid,nthreads,i2,na) shared(mapNoss,instrCol,comlsqr,vVect,systemMatrix,matrixIndex,knownTerms,j2) { myid=comlsqr.myid; if(comlsqr.itn==1) { #ifdef OMP tid = omp_get_thread_num(); nthreads = omp_get_num_threads(); #endif } if(comlsqr.itn==1 && debugMode) printf("PE=%d Aprod1 OpenMP num of threads =%d from thread =%d icycle=%ld comlsqr.itn=%d\n",myid, nthreads,tid,i,comlsqr.itn); long miValAstro=0; long miValAtt=0; long jstartAtt=0; long jstartAstro=0; long lset=0; long offLocalAstro=0; long offLocalAtt=0; long offLocalInstr=0; //Offset on Instruments long ixInstr=0; int nInstrVal=0; offLocalInstr=offsetInstrParam+(localAstroMax-offsetAttParam); //Offset on Instruments nInstrVal=nAstroPSolved+nAttP; offLocalAstro=comlsqr.mapStar[myid][0]*nAstroPSolved; //Offset on my mstars offLocalAtt=localAstroMax-offsetAttParam; //Offset on attitude long offLocalGlob=offsetGlobParam+(localAstroMax-offsetAttParam); //Offset on GlobP int nGlobVal=nAstroPSolved+nAttP+nInstrPSolved; jstartAstro=miValAstro-offLocalAstro; #pragma omp for for(long ix=0;ix