Skip to content

Commit

Permalink
Still debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Heatherms27 committed Jan 9, 2024
1 parent 11a2166 commit cfe306d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/eigs/auxiliary_eigs_normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ int Num_update_VWXR_Sprimme(SCALAR *V, SCALAR *W, SCALAR *BV, PRIMME_INT mV,
HREAL *xnorms, int nxb, int nxe,
primme_context ctx) {


PRIMME_INT i; /* Loop variables */
int j; /* Loop variables */
int m=min(PRIMME_BLOCK_SIZE, mV); /* Number of rows in the cache */
Expand Down
25 changes: 21 additions & 4 deletions src/eigs/main_iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,7 @@ int sketched_main_iter_Sprimme(HEVAL *evals, SCALAR *evecs, PRIMME_INT ldevecs,
practConvCheck = 1;
}


/*
CHKERR(prepare_candidates(V, ldV, W, ldW, BV, ldBV,
primme->nLocal, H, primme->maxBasisSize, basisSize,
&V[basisSize * ldV], &W[basisSize * ldW],
Expand All @@ -1874,6 +1874,22 @@ int sketched_main_iter_Sprimme(HEVAL *evals, SCALAR *evecs, PRIMME_INT ldevecs,
primme->maxBasisSize, numConverged, basisNorms, &reset,
VtBV, ldVtBV, prevhVecs, nprevhVecs, primme->maxBasisSize,
practConvCheck, map, startTime, ctx));
*/

//CHKERR(Num_gemm_Sprimme("N", "N", primme->nLocal, blockSize, basisSize, 1.0, V, ldV, hVecs, basisSize, 0.0, &V[basisSize * ldV], ldV, ctx));
CHKERR(prepare_candidates(V, ldV, W, ldW, NULL, 0,
primme->nLocal, NULL, 0, basisSize,
&V[basisSize * ldV], &W[basisSize * ldW],
NULL, 1, hVecs,
basisSize, hVals, NULL, flags, maxRecentlyConverged,
blockNorms, blockSize, availableBlockSize, evecs,
0, ldevecs, NULL, 0, evals, resNorms,
targetShiftIndex, iev, &blockSize, &recentlyConverged,
&numArbitraryVecs, &smallestResNorm, NULL,
0, numConverged, basisNorms, &reset,
NULL, 0, prevhVecs, nprevhVecs, primme->maxBasisSize,
practConvCheck, map, startTime, ctx));

assert(recentlyConverged >= 0);
candidates_prepared = 1;

Expand Down Expand Up @@ -1995,6 +2011,7 @@ int sketched_main_iter_Sprimme(HEVAL *evals, SCALAR *evecs, PRIMME_INT ldevecs,
blockSize = 0;

CHKERR(sketched_RR_Sprimme(SV, ldSV, SW, ldSW, hVecs, basisSize, hVals, basisSize, ctx));

numArbitraryVecs = 0;
candidates_prepared = 0;

Expand All @@ -2019,7 +2036,6 @@ int sketched_main_iter_Sprimme(HEVAL *evals, SCALAR *evecs, PRIMME_INT ldevecs,
} /* while (basisSize<maxBasisSize && basisSize<n-orthoConst)
* --------------------------------------------------------------- */

if (primme->procID == 1) printf("Process %d at basisSize %d is here. About to restart.\n", primme->procID, basisSize);
/* If wholeSpace, reset if the accumulated errors on the residual */
/* vectors are too large */

Expand Down Expand Up @@ -2547,7 +2563,6 @@ STATIC int prepare_candidates(SCALAR *V, PRIMME_INT ldV, SCALAR *W,
hVecs, 0, basisSize, ldhVecs, map, ctx));
}
CHKERR(broadcast_iprimme(map, basisSize, ctx));

/* Reorder the flags from previous iteration following map */

CHKERR(permute_vecs_iprimme(flags, basisSize, map, ctx));
Expand All @@ -2557,6 +2572,8 @@ STATIC int prepare_candidates(SCALAR *V, PRIMME_INT ldV, SCALAR *W,
/* Recompute flags in iev(*blockSize:*blockSize+blockNormsize) */
for (i=*blockSize; i<blockNormsSize; i++)
flagsBlock[i-*blockSize] = flags[iev[i]];

// XXX: FLAGS ARE RECOMPUTED HERE
CHKERR(check_convergence_Sprimme(X ? &X[(*blockSize) * ldV] : NULL, ldV,
computeXR, R ? &R[(*blockSize) * ldW] : NULL, ldW, computeXR, evecs,
numLocked, ldevecs, Bevecs, ldBevecs, VtBV, ldVtBV, 0,
Expand Down Expand Up @@ -2654,13 +2671,13 @@ STATIC int prepare_candidates(SCALAR *V, PRIMME_INT ldV, SCALAR *W,
/* position visited (variable i) */

blki = *blockSize;

CHKERR(prepare_vecs_SHprimme(basisSize, lasti + 1, maxBlockSize - blki, H,
ldH, hVals, hSVals, hVecs, ldhVecs, targetShiftIndex,
numArbitraryVecs, *smallestResNorm, flags, 1, hVecsRot, ldhVecsRot,
ctx));

/* Find next candidates, starting from iev(*blockSize)+1 */

for (i=lasti+1; i<basisSize && blki < maxBlockSize; i++) {
if (flags[i] == UNCONVERGED) iev[blki++] = i;
}
Expand Down
7 changes: 2 additions & 5 deletions src/eigs/sketch.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ return 0;
*
* hVals The sketched Ritz values
*
* resNorms The estimated residual norms from the sketched RR
*
******************************************************************************/

TEMPLATE_PLEASE
Expand Down Expand Up @@ -316,7 +314,6 @@ int sketched_RR_Sprimme(SCALAR *SV, PRIMME_INT ldSV, SCALAR *SW, PRIMME_INT ldSW

CHKERR(permute_vecs_Sprimme(hVecs, basisSize, trunc_basisSize, ldhVecs, eval_perm, ctx));


CHKERR(Num_free_Sprimme(UVecs, ctx));
CHKERR(Num_free_Sprimme(VVecst, ctx));
CHKERR(Num_free_Sprimme(UtSW, ctx));
Expand All @@ -329,8 +326,8 @@ int sketched_RR_Sprimme(SCALAR *SV, PRIMME_INT ldSV, SCALAR *SW, PRIMME_INT ldSW
CHKERR(Num_free_Rprimme(sing_vals, ctx));
}

CHKERR(broadcast_SHprimme(hVecs, ldhVecs*primme->numEvals, ctx));
CHKERR(broadcast_RHprimme(hVals, primme->numEvals, ctx));
CHKERR(broadcast_SHprimme(hVecs, basisSize*ldhVecs, ctx));
CHKERR(broadcast_RHprimme(hVals, basisSize, ctx));

return 0;
#else
Expand Down

0 comments on commit cfe306d

Please sign in to comment.