This file is indexed.

/usr/lib/python3/dist-packages/arrayfire/cuda.py is in python3-arrayfire 3.3.20160624-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
########################################################

"""
Functions specific to CUDA backend.

This module provides interoperability with other CUDA libraries.
"""

def get_stream(idx):
    """
    Get the CUDA stream used for the device `idx` by ArrayFire.

    Parameters
    ----------

    idx : int.
        Specifies the index of the device.

    Returns
    -----------
    stream : integer denoting the stream id.
    """

    import ctypes as ct
    from .util import safe_call as safe_call
    from .library import backend as backend

    if (backend.name() != "cuda"):
        raise RuntimeError("Invalid backend loaded")

    stream = ct.c_void_p(0)
    safe_call(backend.get().afcu_get_stream(ct.pointer(stream), idx))
    return stream.value

def get_native_id(idx):
    """
    Get native (unsorted) CUDA device ID

    Parameters
    ----------

    idx : int.
        Specifies the (sorted) index of the device.

    Returns
    -----------
    native_idx : integer denoting the native cuda id.
    """

    import ctypes as ct
    from .util import safe_call as safe_call
    from .library import backend as backend

    if (backend.name() != "cuda"):
        raise RuntimeError("Invalid backend loaded")

    native = ct.c_int(0)
    safe_call(backend.get().afcu_get_native_id(ct.pointer(native), idx))
    return native.value

def set_native_id(idx):
    """
    Set native (unsorted) CUDA device ID

    Parameters
    ----------

    idx : int.
        Specifies the (unsorted) native index of the device.
    """

    import ctypes as ct
    from .util import safe_call as safe_call
    from .library import backend as backend

    if (backend.name() != "cuda"):
        raise RuntimeError("Invalid backend loaded")

    safe_call(backend.get().afcu_set_native_id(idx))
    return