示例#1
0
 def makeMap(self):
     self.map = pti.new("ptiIndex **")
     self.map = pti.cast("ptiIndex **",
                         PTI.malloc(2 * pti.sizeof(self.map)))
     self.map[0] = pti.cast(
         "ptiIndex *",
         PTI.malloc(self.address.nrows * pti.sizeof(pti.new("ptiIndex *"))))
     for i in range(self.address.nrows):
         self.map[0][i] = i
     self.map[1] = pti.cast(
         "ptiIndex *",
         PTI.malloc(self.address.ncols * pti.sizeof(pti.new("ptiIndex *"))))
     for i in range(self.address.ncols):
         self.map[1][i] = i
示例#2
0
 def __init__(self, ncols, nrows):
     self.nthreads = (int)(os.popen('grep -c cores /proc/cpuinfo').read())
     print(self.nthreads)
     self.address = pti.cast(
         "ptiMatrix *",
         PTI.malloc(self.nthreads * pti.sizeof(pti.new("ptiMatrix *"))))
     PTI.ptiMakeMatrixBuff(self.address, ncols, nrows)
示例#3
0
 def __init__(self, size):
     self.nthreads = (int)(os.popen('grep -c cores /proc/cpuinfo').read())
     print(self.nthreads)
     self.address = pti.cast(
         "ptiValueVector *",
         PTI.malloc(self.nthreads *
                    pti.sizeof(pti.new("ptiValueVector *"))))
     PTI.ptiMakeVectorBuff(self.address, size)