<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div>Hi Everyone,<br><br></div>I have a few questions regarding the usage of Viennacl in Petsc. <br><br></div>1) In the residual evaluation function:<br><br>
PetscErrorCode ComputeResidual(TS ts,<br> PetscScalar t,<br> Vec X, Vec dX_dt,<br> Vec F, void *ptr)<br>{<br></div> DM da;<br></div>
Vec localX;<br></div> TSGetDM(ts, &da)<br></div> DMGetLocalVector(da, &localX);<br><br></div> DMGlobalToLocalBegin(da, X, INSERT_VALUES, localX);<br></div> DMGlobalToLocalEnd(da, X, INSERT_VALUES, localX);<br>
<br></div> viennacl::vector<PetscScalar> *x, *f;<br></div> VecViennaCLGetArrayWrite(localX, &x);<br></div> VecViennaCLGetArrayRead(F, &f);<br><div><br></div><div> viennacl::ocl::enqueue(myKernel(*x, *f));<br>
</div><div>//Should it be viennacl::ocl::enqueue(myKernel(x, f))?<br></div><div><div><div><div><div><div><div><div><div><div><br></div><div> VecViennaCLRestoreArrayWrite(localX, &x);<br></div><div> VecViennaCLRestoreArrayRead(F, &f);<br>
</div><div> DMRestoreLocalVector(da, &localX);<br></div><div>}<br><br></div><div>Will the residual evaluation occur on the GPU/accelerator depending on where we choose the ViennaCL array computations to occur? As I understand, if we simply use VecGetArray in the residual evaluation function, then the residual evaluation is still done on the CPU even though the solves are done on the GPU.<br>
<br></div><div>2) How does one choose on which device the ViennaCL array computations will occur? I was looking for some flags like -viennacl cpu/gpu/accelerator but could not find any in -help.<br><br></div><div>3) How can one pass compiler flags when building OpenCL kernels in ViennaCL?<br>
<br></div><div>Thanks,<br>Mani<br></div></div></div></div></div></div></div></div></div></div></div>