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