import PyCA.Core as ca grid = ca.GridInfo(ca.Vec3Di(64, 64, 32)) mType = ca.MEM_DEVICE # Initialize memory manager by allocating 4 64x64x32 pools of memory on the GPU ca.ThreadMemoryManager.init(grid, mType, 4) TempIm1 = ca.ManagedImage3D(grid, mType) #using 1/4 pools TempIm2 = ca.ManagedImage3D(grid, mType) #using 2/4 pools TempVF1 = ca.ManagedField3D(grid, mType) #using 5/5 pools TempVF2 = ca.ManagedField3D(grid, mType) #using 8/8 pools del(TempIm1) #using 7/8 pools TempVF3 = ca.ManagedField3D(grid, mType) #using 10/10 pools del(TempVF1) #using 7/10 pools TempIm3 = ca.ManagedImage3D(grid, mType) #using 8/10 pools global_mm = ca.ThreadMemoryManager.instance() print 'Total number of mem pools:', global_mm.getNumPools() grid1 = ca.GridInfo(ca.Vec3Di(32,64,64)) #Allowed grid2 = ca.GridInfo(ca.Vec3Di(100,100,1)) #Allowed grid3 = ca.GridInfo(ca.Vec3Di(1, 1, 1)) #Allowed grid4 = ca.GridInfo(ca.Vec3Di(64, 64, 64)) #Not Allowed TempIm1 = ca.ManagedImage3D(grid1, mType) TempIm2 = ca.ManagedImage3D(grid2, mType) TempIm3 = ca.ManagedImage3D(grid3, mType) TempIm4 = ca.ManagedImage3D(grid4, mType) #Will throw an Exception newgrid = ca.GridInfo(ca.Vec3Di(50, 50, 1)) mType = ca.MEM_DEVICE mem_man_2 = ca.MemoryManager(grid, mType, 1) TempIm = ca.ManagedImage3D(newgrid, mType, mem_man_2) TempVF = ca.ManagedField3D(newgrid, mType, mem_man_2) print 'Total number of mem pools:', mem_man_2.getNumPools() del(mem_man_2) #delete the local memory manager ca.ThreadMemoryManager.destroy() #delete the thread memory manager