Loading aprod.c +10 −79 Original line number Diff line number Diff line Loading @@ -39,9 +39,12 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms, nproc = comlsqr.nproc; mapNcoeff = comlsqr.mapNcoeff; mapNoss = comlsqr.mapNoss; if (comlsqr.nthreads == NULL) comlsqr.nthreads=1; nthreads = comlsqr.nthreads; ntasks= comlsqr.ntasks; ntasks= comlsqr.ntasks; mapForThread = comlsqr.mapForThread; int multMI = comlsqr.multMI; long nparam = comlsqr.parOss; Loading Loading @@ -72,10 +75,8 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms, long offsetInstrParam = comlsqr.offsetInstrParam; long offsetGlobParam = comlsqr.offsetGlobParam; tid = 0; if (mode != 1 && mode != 2) { printf("ERROR: Invalid mode=%d in aprod function\n", mode); Loading @@ -86,15 +87,13 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms, myid = comlsqr.myid; if (mode == 1) { time_t startTime = time(NULL); { myid = comlsqr.myid; myid = comlsqr.myid; 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; Loading @@ -113,83 +112,15 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms, int nGlobVal = nAstroPSolved + nAttP + nInstrPSolved; jstartAstro = miValAstro - offLocalAstro; for(int nt=0; nt < ntasks; nt++ ) { #pragma omp task label(mode1) { for (long ix = mapForThread[nt][0]; ix < mapForThread[nt][2]; ix++) //FUNZIONE DA FARE { /*================= INIZIO sum = 0.; // FARE UNA FUNZIONE CHIAMATA NEL CICLO FOR ///////////////////////////////////////////////////// /// Mode 1 Astrometric Sect if (nAstroPSolved) { lset = ix * nparam; if (matrixIndex[multMI * ix] != miValAstro) { miValAstro = matrixIndex[multMI * ix]; jstartAstro = miValAstro - offLocalAstro; } for (long jx = jstartAstro; jx < jstartAstro + nAstroPSolved; jx++) { sum = sum + systemMatrix[lset] * vVect[jx]; lset++; } } ////////////////////////////////////////////////////// /// Mode 1 Attitude Sect if (nAttP) { lset = ix * nparam + nAstroPSolved; miValAtt = matrixIndex[multMI * ix + (multMI - 1)]; for (int nax = 0; nax < nAttAxes; nax++) { jstartAtt = miValAtt + offLocalAtt + nax * nDegFreedomAtt; for (long inpax = jstartAtt; inpax < jstartAtt + nAttParAxis; inpax++) { sum = sum + systemMatrix[lset] * vVect[inpax]; lset++; } } } ////////////////////////////////////////////////////// /// Mode 1 Instrument Sect if (nInstrPSolved) { lset = ix * nparam + nInstrVal; long iiVal = ix * nInstrPSolved; for (int inInstr = 0; inInstr < nInstrPSolved; inInstr++) { ixInstr = offLocalInstr + instrCol[iiVal + inInstr]; sum = sum + systemMatrix[lset] * vVect[ixInstr]; lset++; } } ////////////////////////////////////////////////////// /// Mode 1 Global sect if (nGlobP) { lset = ix * nparam + nGlobVal; for (long inGlob = offLocalGlob; inGlob < offLocalGlob + nGlobP; inGlob++) { sum = sum + systemMatrix[lset] * vVect[inGlob]; lset++; } } ////////////////////////////////////////////////////// // knownTerms[ix] += sum; ================ FINE */ knownTerms[ix] += aprodM1Obs(ix,comlsqr, vVect, systemMatrix, matrixIndex, instrCol); } //for ix } } /// Mode 1 ExtConstr Loading Loading @@ -266,7 +197,7 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms, } } ////////////////////////////////////////////////////// } //pragma *ompSec += time(NULL) - startTime; if (comlsqr.itn <= 2 && (myid == 0 || myid == nproc - 1 || debugMode == 1)) printf("PE=%d AprodTiming: mode=1 OmpSec=%ld\n", myid, time(NULL) - startTime); Loading util.h +1 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ struct comData { int timeCPR, timeLimit, itnCPR,itnCPRstop,itnCPRend, itnLimit,itn,noCPR; long offsetCMag,offsetCnu,offsetCdelta_eta,offsetCDelta_eta_1,offsetCDelta_eta_2; long offsetCDelta_eta_3,offsetCdelta_zeta,offsetCDelta_zeta_1,offsetCDelta_zeta_2; int nthreads=1; int nthreads; int ntasks; long **mapForThread; int nSubsetAtt, nSubsetInstr; Loading Loading
aprod.c +10 −79 Original line number Diff line number Diff line Loading @@ -39,9 +39,12 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms, nproc = comlsqr.nproc; mapNcoeff = comlsqr.mapNcoeff; mapNoss = comlsqr.mapNoss; if (comlsqr.nthreads == NULL) comlsqr.nthreads=1; nthreads = comlsqr.nthreads; ntasks= comlsqr.ntasks; ntasks= comlsqr.ntasks; mapForThread = comlsqr.mapForThread; int multMI = comlsqr.multMI; long nparam = comlsqr.parOss; Loading Loading @@ -72,10 +75,8 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms, long offsetInstrParam = comlsqr.offsetInstrParam; long offsetGlobParam = comlsqr.offsetGlobParam; tid = 0; if (mode != 1 && mode != 2) { printf("ERROR: Invalid mode=%d in aprod function\n", mode); Loading @@ -86,15 +87,13 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms, myid = comlsqr.myid; if (mode == 1) { time_t startTime = time(NULL); { myid = comlsqr.myid; myid = comlsqr.myid; 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; Loading @@ -113,83 +112,15 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms, int nGlobVal = nAstroPSolved + nAttP + nInstrPSolved; jstartAstro = miValAstro - offLocalAstro; for(int nt=0; nt < ntasks; nt++ ) { #pragma omp task label(mode1) { for (long ix = mapForThread[nt][0]; ix < mapForThread[nt][2]; ix++) //FUNZIONE DA FARE { /*================= INIZIO sum = 0.; // FARE UNA FUNZIONE CHIAMATA NEL CICLO FOR ///////////////////////////////////////////////////// /// Mode 1 Astrometric Sect if (nAstroPSolved) { lset = ix * nparam; if (matrixIndex[multMI * ix] != miValAstro) { miValAstro = matrixIndex[multMI * ix]; jstartAstro = miValAstro - offLocalAstro; } for (long jx = jstartAstro; jx < jstartAstro + nAstroPSolved; jx++) { sum = sum + systemMatrix[lset] * vVect[jx]; lset++; } } ////////////////////////////////////////////////////// /// Mode 1 Attitude Sect if (nAttP) { lset = ix * nparam + nAstroPSolved; miValAtt = matrixIndex[multMI * ix + (multMI - 1)]; for (int nax = 0; nax < nAttAxes; nax++) { jstartAtt = miValAtt + offLocalAtt + nax * nDegFreedomAtt; for (long inpax = jstartAtt; inpax < jstartAtt + nAttParAxis; inpax++) { sum = sum + systemMatrix[lset] * vVect[inpax]; lset++; } } } ////////////////////////////////////////////////////// /// Mode 1 Instrument Sect if (nInstrPSolved) { lset = ix * nparam + nInstrVal; long iiVal = ix * nInstrPSolved; for (int inInstr = 0; inInstr < nInstrPSolved; inInstr++) { ixInstr = offLocalInstr + instrCol[iiVal + inInstr]; sum = sum + systemMatrix[lset] * vVect[ixInstr]; lset++; } } ////////////////////////////////////////////////////// /// Mode 1 Global sect if (nGlobP) { lset = ix * nparam + nGlobVal; for (long inGlob = offLocalGlob; inGlob < offLocalGlob + nGlobP; inGlob++) { sum = sum + systemMatrix[lset] * vVect[inGlob]; lset++; } } ////////////////////////////////////////////////////// // knownTerms[ix] += sum; ================ FINE */ knownTerms[ix] += aprodM1Obs(ix,comlsqr, vVect, systemMatrix, matrixIndex, instrCol); } //for ix } } /// Mode 1 ExtConstr Loading Loading @@ -266,7 +197,7 @@ void aprod(int mode, long int m, long int n, double *vVect, double *knownTerms, } } ////////////////////////////////////////////////////// } //pragma *ompSec += time(NULL) - startTime; if (comlsqr.itn <= 2 && (myid == 0 || myid == nproc - 1 || debugMode == 1)) printf("PE=%d AprodTiming: mode=1 OmpSec=%ld\n", myid, time(NULL) - startTime); Loading
util.h +1 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ struct comData { int timeCPR, timeLimit, itnCPR,itnCPRstop,itnCPRend, itnLimit,itn,noCPR; long offsetCMag,offsetCnu,offsetCdelta_eta,offsetCDelta_eta_1,offsetCDelta_eta_2; long offsetCDelta_eta_3,offsetCdelta_zeta,offsetCDelta_zeta_1,offsetCDelta_zeta_2; int nthreads=1; int nthreads; int ntasks; long **mapForThread; int nSubsetAtt, nSubsetInstr; Loading