[petsc-users] parallel vector of integers

Barry Smith bsmith at mcs.anl.gov
Mon Oct 17 17:29:00 CDT 2011


On Oct 17, 2011, at 4:03 PM, Dominik Szczerba wrote:

> Vec seems to be meant for only real numbers. I need to have a parallel vector containing integers. Most of them are indices, but some of them would be arbitrary. Questions:
> 
> 1) Is 'IS' supposed to be a parallel/distributed vector of indices? Syntax to use it is very different from that of Vec. E.g. I see functions to query global and local size, but can not find functions to specify them. How to scatter/gather such objects? Scatter seems only for Vec's.

   An IS is NOT a Vec for integers, it is a very different best.

> 
> 2) How about arbitrary parallel vectors of integers?

   You can put the integers in a Vec. Unless your code is all integers (which is unlikely because why are you using PETSc for a code that just uses integers) the overhead of shipping around a few integers stored as doubles is not going to kill the overall performance of the code. In fact, I will faint away if you can even measure the difference.  This is likely a case of premature over optimization.

   Barry



> 
> Many thanks for any pointers,
> Dominik



More information about the petsc-users mailing list