Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Release GIL around C functions #391

Open
wants to merge 8 commits into
base: branch-0.13
Choose a base branch
from

Commits on Jan 14, 2020

  1. Mark C level functions as nogil

    These functions should be safe to use without the Python GIL as they are
    not creating or destroying Python objects. So mark them as such.
    
    Note: This does **not** actually release the GIL. We still have to do
    that ourselves. However this allows us to use these in code sections
    where we have already released the GIL. We can also continue to use them
    when we have the GIL as well.
    jakirkham committed Jan 14, 2020
    Configuration menu
    Copy the full SHA
    34b65dc View commit details
    Browse the repository at this point in the history
  2. Drop object definitions

    Cython already infers these are `object` type given the assignment type.
    So these definitions can be dropped without any loss in affect. This
    will make it easier to move the assignment into the GIL block later.
    jakirkham committed Jan 14, 2020
    Configuration menu
    Copy the full SHA
    a603c54 View commit details
    Browse the repository at this point in the history
  3. Make callbacks nogil, but acquire GIL internally

    As these functions are effectively called from `nogil` contexts now
    given the C functions calling them are `nogil`, make them `nogil` as
    well, but acquire the GIL internally for the parts of the function that
    require it. Namely when the Python callback is run and its results are
    added to the asyncio Future.
    jakirkham committed Jan 14, 2020
    Configuration menu
    Copy the full SHA
    7d3b137 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4d97b4a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d808ba5 View commit details
    Browse the repository at this point in the history
  6. Release GIL before calling UCX functions

    Go ahead and release the GIL before calling UCX functions. They should
    not be creating, destroying, or modifying any Python objects. Once any
    of our callbacks are called that do need to manipulate Python objects,
    we make sure to reacquire the GIL anyways.
    jakirkham committed Jan 14, 2020
    Configuration menu
    Copy the full SHA
    5cbc5e2 View commit details
    Browse the repository at this point in the history
  7. Coerce port to uint16_t

    As this is the type expected by the C level functions that we call later
    when using `port`, go ahead and coerce it to `uint16_t` in advance.
    This should make it easier to release the GIL later on.
    jakirkham committed Jan 14, 2020
    Configuration menu
    Copy the full SHA
    c293849 View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2020

  1. Configuration menu
    Copy the full SHA
    65721dd View commit details
    Browse the repository at this point in the history