Fixed a bug in CKTtrunc reduction when there is nothing to reduce

This commit is contained in:
Francesco Lannutti 2015-09-16 19:54:26 +02:00 committed by rlar
parent 14f9f9dbbe
commit abed2083e1
2 changed files with 26 additions and 6 deletions

View File

@ -54,6 +54,13 @@ CKTcircuit *ckt, double timetemp, double *timeStep
cudaDeviceSynchronize () ;
status = cudaGetLastError () ; // check for launch error
if (status != cudaSuccess)
{
fprintf (stderr, "Kernel 1 launch failure in cuCKTtrunc\n\n") ;
return (E_NOMEM) ;
}
cuCKTtrunc_kernel <<< 1, thread, thread_y * sizeof(double) >>> (ckt->d_CKTtimeStepsOut, ckt->d_CKTtimeSteps, block_x) ;
cudaDeviceSynchronize () ;
@ -61,7 +68,7 @@ CKTcircuit *ckt, double timetemp, double *timeStep
status = cudaGetLastError () ; // check for launch error
if (status != cudaSuccess)
{
fprintf (stderr, "Kernel launch failure in cuCKTtrunc\n\n") ;
fprintf (stderr, "Kernel 2 launch failure in cuCKTtrunc\n\n") ;
return (E_NOMEM) ;
}

View File

@ -33,8 +33,16 @@ CKTtrunc (CKTcircuit *ckt, double *timeStep)
double startTime ;
int error = OK ;
#ifdef USE_CUSPICE
int doReduction, status ;
#endif
startTime = SPfrontEnd->IFseconds () ;
#ifdef USE_CUSPICE
doReduction = 0 ;
#endif
timetemp = HUGE ;
for (i = 0 ; i < DEVmaxnum ; i++)
{
@ -45,6 +53,10 @@ CKTtrunc (CKTcircuit *ckt, double *timeStep)
debugtemp = timetemp ;
#endif /* STEPDEBUG */
#ifdef USE_CUSPICE
doReduction = 1 ;
#endif
error = DEVices[i]->DEVtrunc (ckt->CKThead[i], ckt, &timetemp) ;
if (error)
{
@ -63,11 +75,12 @@ CKTtrunc (CKTcircuit *ckt, double *timeStep)
}
#ifdef USE_CUSPICE
int status ;
status = cuCKTtrunc (ckt, HUGE, timeStep) ;
if (status != 0)
return (E_NOMEM) ;
if (doReduction)
{
status = cuCKTtrunc (ckt, HUGE, timeStep) ;
if (status != 0)
return (E_NOMEM) ;
}
#else
*timeStep = MIN (2 * *timeStep, timetemp) ;
#endif