[petsc-dev] petsc4py/numpy: is there a performance difference between these two pieces of code?

Aron Ahmadia aron.ahmadia at kaust.edu.sa
Sun Nov 27 01:44:31 CST 2011


Dear All,

Just a quick question on whether there should be a performance difference
between different approaches in moving data from a local Vec to a global
Vec:

qbc is a multi-dimensional, Fortran ordered numpy array

# METHOD 1

# with fset(self,q) defined as follows:
        def fset(self,q):
            self.gqVec.setArray(q.reshape([-1], order = 'F'))

        self.q = qbc[:,mbc:-mbc,mbc:-mbc]

# METHOD 2

        self.lqVec.placeArray(qbc.reshape([-1], order = 'F'))
        self.q_da.localToGlobal(self.lqVec,self.gqVec)
        self.lqVec.resetArray()

# METHOD 3

        self.lqVec.placeArray(qbc)
        self.q_da.localToGlobal(self.lqVec,self.gqVec)
        self.lqVec.resetArray()

A
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20111127/cdc296a3/attachment.html>


More information about the petsc-dev mailing list