Faiss

- Main Page
- Namespaces
- Classes
- Files

- File List

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
GpuIndex.h
1
2 /**
3 * Copyright (c) 2015-present, Facebook, Inc.
4 * All rights reserved.
5 *
6 * This source code is licensed under the CC-by-NC license found in the
7 * LICENSE file in the root directory of this source tree.
8 */
9
10 // Copyright 2004-present Facebook. All Rights Reserved.
11
12 #pragma once
13
14 #include "../Index.h"
15
16 namespace faiss { namespace gpu {
17
18 class GpuResources;
19
20 class GpuIndex : public faiss::Index {
21 public:
22 GpuIndex(GpuResources* resources,
23 int device,
24 int dims,
25 faiss::MetricType metric);
26
27 inline int getDevice() const {
28 return device_;
29 }
30
31 GpuResources* getResources() {
32 return resources_;
33 }
34
35 // redeclare an abstract method to quiet SWIG warning
36 virtual void add(faiss::Index::idx_t,float const *) = 0;
37
38 protected:
39 /// Manages streans, cuBLAS handles and scratch memory for devices
40 GpuResources* resources_;
41
42 /// The GPU device we are resident on
43 int device_;
44 };
45
46 } } // namespace
faiss::gpu::GpuResources
Definition: GpuResources.h:24
faiss::gpu::GpuIndex
Definition: GpuIndex.h:20
faiss::gpu::GpuIndex::device_
int device_
The GPU device we are resident on.
Definition: GpuIndex.h:43
faiss::gpu::GpuIndex::add
virtual void add(faiss::Index::idx_t, float const *)=0
faiss::gpu::GpuIndex::resources_
GpuResources * resources_
Manages streans, cuBLAS handles and scratch memory for devices.
Definition: GpuIndex.h:40
faiss::Index::idx_t
long idx_t
all indices are this type
Definition: Index.h:64
faiss::Index
Definition: Index.h:61
faiss::MetricType
MetricType
Some algorithms support both an inner product vetsion and a L2 search version.
Definition: Index.h:44