Skip to content

Calling omp_get_num_devices segfaults or returns wrong number of devices #48

Description

@ggeorgakoudis

Running the test program:

from numba.openmp import omp_get_num_devices

print("devices=", omp_get_num_devices())

causes a segfault. The culprit is missing initialization of the libomptarget runtime.

The error is different when we indirectly initialize libomptarget through a target region, for example:

from numba.openmp import omp_get_num_devices
from numba.openmp import njit
from numba.openmp import openmp_context as openmp

@njit
def test():
    with openmp("target"):
        print("Hello from the target region!")

print("devices=", omp_get_num_devices())

This does not crash but wrongfully prints devices= 0 because the implementation falls back to the libomp handling default value of 0.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions