This file is indexed.

/usr/include/af/cuda.h is in libarrayfire-dev 3.3.2+dfsg1-4.

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
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*******************************************************
 * Copyright (c) 2014, 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
 ********************************************************/

#include <af/defines.h>
#include <af/exception.h>
#include <cuda.h>
#include <cuda_runtime.h>

#ifdef __cplusplus
extern "C" {
#endif

#if AF_API_VERSION >= 31
/**
   Get the stream for the CUDA device with \p id in ArrayFire context

   \param[out] stream CUDA Stream of device with \p id in ArrayFire context
   \param[in] id ArrayFire device id
   \returns \ref af_err error code

   \ingroup cuda_mat
 */
AFAPI af_err afcu_get_stream(cudaStream_t* stream, int id);
#endif

#if AF_API_VERSION >= 31
/**
   Get the native device id of the CUDA device with \p id in ArrayFire context

   \param[out] nativeid native device id of the CUDA device with \p id in ArrayFire context
   \param[in] id ArrayFire device id
   \returns \ref af_err error code

   \ingroup cuda_mat
 */
AFAPI af_err afcu_get_native_id(int* nativeid, int id);
#endif

#if AF_API_VERSION >= 32
/**
   Set the CUDA device with given native id as the active device for ArrayFire

   \param[in] nativeid native device id of the CUDA device
   \returns \ref af_err error code

   \ingroup cuda_mat
 */
AFAPI af_err afcu_set_native_id(int nativeid);
#endif

#ifdef __cplusplus
}
#endif

#ifdef __cplusplus

namespace afcu
{

#if AF_API_VERSION >= 31
/**
   Get the stream for the CUDA device with \p id in ArrayFire context

   \param[in] id ArrayFire device id
   \returns cuda stream used by CUDA device

   \ingroup cuda_mat
 */
static inline cudaStream_t getStream(int id)
{
    cudaStream_t retVal;
    af_err err = afcu_get_stream(&retVal, id);
    if (err!=AF_SUCCESS)
        throw af::exception("Failed to get CUDA stream from ArrayFire");
    return retVal;
}
#endif

#if AF_API_VERSION >= 31
/**
   Get the native device id of the CUDA device with \p id in ArrayFire context

   \param[in] id ArrayFire device id
   \returns cuda native id of device

   \ingroup cuda_mat
 */
static inline int getNativeId(int id)
{
    int retVal;
    af_err err = afcu_get_native_id(&retVal, id);
    if (err!=AF_SUCCESS)
        throw af::exception("Failed to get CUDA device native id from ArrayFire");
    return retVal;
}
#endif

#if AF_API_VERSION >= 32
/**
   Set the CUDA device with given native id as the active device for ArrayFire

   \param[in] nativeId native device id of the CUDA device

   \ingroup cuda_mat
 */
static inline void setNativeId(int nativeId)
{
    af_err err = afcu_set_native_id(nativeId);
    if (err!=AF_SUCCESS)
        throw af::exception("Failed to change active CUDA device to the device with given native id");
}
#endif

}
#endif