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

Release OpenMP resources in blas_thread_shutdown #4080

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Commits on Jun 11, 2023

  1. blas_thread_shutdown: release OpenMP resources too

    OpenMP 5.0 introduced the function omp_pause_resource_all that instructs
    the runtime to "relinquish resources used by OpenMP on all devices". In
    practice, these resources include the locks that would otherwise trip up
    the runtime after a fork(). Releasing these resources in a function
    called by pthread_atfork() makes it possible for the child process to
    continue functioning after the runtime automatically re-acquires its
    resources.
    
    Thread safety: blas_thread_shutdown doesn't check whether there are
    other BLAS operations running in parallel, so this isn't any less safe
    than before with respect to OpenBLAS function calls. On the other hand,
    if there are other OpenMP operations in progress, asking the runtime to
    pause may result in unspecified behaviour. A hard pause is allowed to
    deallocate threadprivate variables too.
    aitap committed Jun 11, 2023
    Configuration menu
    Copy the full SHA
    ef015a6 View commit details
    Browse the repository at this point in the history
  2. utest: test fork safety on OpenMP >= 5

    In addition to testing fork safety on non-OpenMP builds, test it on
    OpenMP >= 5.0, where we get the ability to release the locks at fork()
    time.
    aitap committed Jun 11, 2023
    Configuration menu
    Copy the full SHA
    645eabe View commit details
    Browse the repository at this point in the history