Fix the clear phase of Matrix and RHS once for all

This commit is contained in:
Francesco Lannutti 2018-04-23 14:56:28 +02:00
parent ef5191e7a4
commit 3b9f40a74c
2 changed files with 4 additions and 16 deletions

View File

@ -45,7 +45,7 @@ cuCKTsystemDtoH
CKTcircuit *ckt
)
{
long unsigned int i, nz, n ;
long unsigned int nz, n ;
cudaError_t status ;
if (ckt->total_n_Ptr > 0 || ckt->total_n_PtrRHS > 0) {
@ -56,22 +56,12 @@ CKTcircuit *ckt
/* Copy back the Matrix */
status = cudaMemcpy (ckt->CKTmatrix->CKTkluAx, ckt->CKTmatrix->d_CKTkluAx, nz * sizeof(double), cudaMemcpyDeviceToHost) ;
CUDAMEMCPYCHECK (ckt->CKTmatrix->CKTkluAx, nz, double, status)
} else {
/* Matrix is empty */
for (i = 0 ; i < nz ; i++) {
ckt->CKTmatrix->CKTkluAx [i] = 0 ;
}
}
if (ckt->total_n_PtrRHS > 0) {
/* Copy back the RHS */
status = cudaMemcpy (ckt->CKTrhs, ckt->CKTmatrix->d_CKTrhs, (n + 1) * sizeof(double), cudaMemcpyDeviceToHost) ;
CUDAMEMCPYCHECK (ckt->CKTrhs, (n + 1), double, status)
} else {
/* RHS is empty */
for (i = 0 ; i < n + 1 ; i++) {
ckt->CKTrhs [i] = 0 ;
}
}
}

View File

@ -53,11 +53,9 @@ CKTload(CKTcircuit *ckt)
int status ;
alpha = 1.0 ;
beta = 0.0 ;
#else
int size ;
#endif
int i;
int i, size;
double startTime;
CKTnode *node;
int error;
@ -81,13 +79,13 @@ CKTload(CKTcircuit *ckt)
status = cuCKTflush (ckt) ;
if (status != 0)
return (E_NOMEM) ;
#else
#endif
size = SMPmatSize (ckt->CKTmatrix) ;
for (i = 0 ; i <= size ; i++)
*(ckt->CKTrhs + i) = 0 ;
SMPclear (ckt->CKTmatrix) ;
#endif
#ifdef STEPDEBUG
noncon = ckt->CKTnoncon;