[petsc-users] direct access of seqcusp Vec
Barry Smith
bsmith at mcs.anl.gov
Thu Sep 29 15:22:05 CDT 2011
On Sep 29, 2011, at 2:56 PM, Shiyuan wrote:
> What about a direct access to seqaijcusp Mat? Is there a function call which return the pointed to the cusp::csr_matrix ?
No. But look at the source code to MatMult_SeqAIJCusp and you will see how it may be accessed.
> Also, i notice that, the flops count from --log_summary are different if we switch on/off -vec_type seqcusp and -mat_type seqaijcusp?
Are you sure the exact same solver is being used and the exact same number of iterations. Check the -log_summary table for the number of times
each operation (vecdot, matmult etc etc) is done for the cusp and non-cusp case, if they are different then you will get different counts.
> Why is that?
> what is the option -cusp_synchronize for?
Nvidia GPU cards can run asynchronizely from the CPU. This means you can start some operation on the GPU that takes a while and the GPU starts work on it but the CPU doesn't wait for the GPU to finish it can do something else. Now for PETSc linear algebra this rarely makes sense because while doing an iterative solver there is really nothing else for the CPU to do but wait. the -cusp_synchronize causes the CPU to wait inside the operation (like VecDot) until the GPU has finished its dot product, this gives the correct timing results. Otherwise the time will only measure the time for the CPU to start the GPU task and not the time the GPU took to do the GPU. When running with -log_summary the the option -cusp_synchronize is automatically enabled so generally you don't need to use that flag yourself.
Barry
>
> Thanks.
> ------------------------------
>
> Message: 2
> Date: Wed, 28 Sep 2011 23:22:02 -0500
> From: Barry Smith <bsmith at mcs.anl.gov>
> Subject: Re: [petsc-users] direct access of seqcusp Vec
> To: PETSc users list <petsc-users at mcs.anl.gov>
> Message-ID: <1CFA4EF7-E716-4942-BE0F-6AB2E4EF78E5 at mcs.anl.gov>
> Content-Type: text/plain; charset=us-ascii
>
>
> VecCUSPGetArrayReadWrite() gives you access to the CUSP array that lives on the device memory. You can then do things to it using the CUSP header file definitions
>
> Barry
>
>
>
> On Sep 28, 2011, at 10:46 PM, Shiyuan wrote:
>
> > Hi,
> > How can we acess the data of a seqcusp Vec directly? Is it stored as consecutive 1d array in the device momery?
> > Thanks.
> >
> > Shiyuan
>
>
>
> ------------------------------
More information about the petsc-users
mailing list