Giter Site home page Giter Site logo

Comments (4)

TsXor avatar TsXor commented on June 15, 2024

I tried to let __del__ wait for the events, and surprisingly, it worked:

    def __del__(self):
        self.finish()
        self.base_data.release()

all arrays let their refcount(CL) drop to 0 when they are GC-ed!

from pyopencl.

TsXor avatar TsXor commented on June 15, 2024

I propose to add a switch for the constructor of pyopencl.array.Array. For example, pygc. When it is True, __del__ will work, or __del__ will immediately return.

from pyopencl.

TsXor avatar TsXor commented on June 15, 2024

I think we should add it because manually freeing memory can sometimes be ugly.
For example, manual freeing of mem for

x = somewhatarray
y = x
for _i in range(100):
    y = y*2

should be:

x = somewhatarray
y = x
for _i in range(100):
    y_bak = y
    y = y_bak*2
    y_bak.finish()
    y_bak.base_data.release()
    del y_bak

from pyopencl.

inducer avatar inducer commented on June 15, 2024

As far as I can tell, this is all behaving as designed. Please point if that is not so, in your view.

from pyopencl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.