Debian Codegraph @

c_api/gpu/StandardGpuResources_c.h

raw
1 /*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 // -*- c -*-
9
10 #ifndef FAISS_STANDARD_GPURESOURCES_C_H
11 #define FAISS_STANDARD_GPURESOURCES_C_H
12
13 #include <cuda_runtime_api.h>
14 #include "../faiss_c.h"
15 #include "GpuResources_c.h"
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 /// Default implementation of GpuResourcesProvider that allocates a cuBLAS
22 /// stream and 2 streams for use, as well as temporary memory
23 FAISS_DECLARE_CLASS_INHERITED(StandardGpuResources, GpuResourcesProvider)
24
25 FAISS_DECLARE_DESTRUCTOR(StandardGpuResources)
26
27 /// Default constructor for StandardGpuResources
28 int faiss_StandardGpuResources_new(FaissStandardGpuResources**);
29
30 /// Disable allocation of temporary memory; all temporary memory
31 /// requests will call cudaMalloc / cudaFree at the point of use
32 int faiss_StandardGpuResources_noTempMemory(FaissStandardGpuResources*);
33
34 /// Specify that we wish to use a certain fixed size of memory on
35 /// all devices as temporary memory
36 int faiss_StandardGpuResources_setTempMemory(
37 FaissStandardGpuResources*,
38 size_t size);
39
40 /// Set amount of pinned memory to allocate, for async GPU <-> CPU
41 /// transfers
42 int faiss_StandardGpuResources_setPinnedMemory(
43 FaissStandardGpuResources*,
44 size_t size);
45
46 /// Called to change the stream for work ordering
47 int faiss_StandardGpuResources_setDefaultStream(
48 FaissStandardGpuResources*,
49 int device,
50 cudaStream_t stream);
51
52 /// Called to change the work ordering streams to the null stream
53 /// for all devices
54 int faiss_StandardGpuResources_setDefaultNullStreamAllDevices(
55 FaissStandardGpuResources*);
56
57 #ifdef __cplusplus
58 }
59 #endif
60 #endif