Skip to content

[QST] Does numba-cuda emit coverage for coverage.py? #888

Description

@qalshidi

Hi,

I ran the following with environment variables NUMBA_JIT_COVERAGE=1 and NUMBA_COVERAGE=1.

import numpy as np
from numba import cuda
import numba as nb

@nb.jit
def fn_w_branch(x):
    x[1] = 1
    x[2] = x[0] + x[1]
    if x[0] == 0:
        x[0] = 5
    else:
        x[0] = 7

@cuda.jit
def fn_1(x):
    x[0] = 5

@cuda.jit
def fn(x):
    x[0] = dev_fn(5)

@cuda.jit(device=True)
def dev_fn(x):
    if x == 5:
        return x + 5
    else:
        return x + 7

items = np.zeros(12)

fn_1[1,1](items)
print(items)

fn[1,1](items)
print(items)

fn_w_branch(items)
print(items)

The output I get after coverage run file.py coverage report -m is as follows:

Name            Stmts   Miss  Cover   Missing
---------------------------------------------
reproducer.py      28      5    82%   16, 20, 24-27
---------------------------------------------
TOTAL              28      5    82%

It seems the regular numba jit compiled code was measured but not the cuda jit code. Is there a way to make cuda jit compiled code emit coverage data?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions