[petsc-dev] Possible bugs when using TS with ViennaCL

Karl Rupp rupp at mcs.anl.gov
Sat Jan 25 02:48:37 CST 2014


Hi Mani,

please check the return value of *all* function calls from PETSc, e.g.
  ierr = DMCreateGlobalVector(da, &soln);CHKERRQ(ierr);
instead of just
  DMCreateGlobalVector(da, &soln);
Most likely one of the routines threw an error, but your code just kept 
going, producing wrong results.

Best regards,
Karli


On 01/25/2014 05:35 AM, Mani Chandra wrote:
> Hi Everyone,
>
> I'm trying to use TS with ViennaCL vecs/mats and residual evaluation on
> device and have encountered some problems. I have attached a small test
> code that illustrates the issue.
>
> The code simply advects a blob diagonally using TS. I have written the
> residual evaluation function using 1) the usual Petsc vectors
> (VecGetArray) and 2) using ViennaCL vectors (VecViennaCLGetArrayRead/Write).
>
> Run the code using the following:
> ./petsc_opencl -ts_monitor -snes_monitor -ts_max_steps 1000 -ts_type
> theta -ts_dt 10 -snes_rtol 1e-4 -ts_final_time 1000
> -ts_monitor_draw_solution
>
> Case 1) No ViennaCL anywhere. I simply use the usual Petsc vectors and
> set the residual evaluation function as ComputeResidual (line no. 55).
> This case works and the blob is indeed advected as can be seen. (I
> haven't bothered with the boundaries. The simulation just stops before
> the blob hits the boundaries).
>
> Case 2) We again use the ComputeResidual but now enable ViennaCL vecs
> and mats (line nos. 48, 49). This case does NOT work. The SNES monitor
> shows convergence but the solution makes no sense.
>
> Case 3) We now use ComputeResidualViennaCL (line no. 56). This does NOT
> work either with or without enabling the ViennaCL vecs (line nos. 48, 49).
>
> Cheers,
> Mani




More information about the petsc-dev mailing list