Faiss
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
MemorySpace.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 
10 #pragma once
11 
12 #include "../../FaissAssert.h"
13 #include <cuda.h>
14 
15 #if CUDA_VERSION >= 8000
16 // Whether or not we enable usage of CUDA Unified Memory
17 #define FAISS_UNIFIED_MEM 1
18 #endif
19 
20 namespace faiss { namespace gpu {
21 
22 enum MemorySpace {
23  /// Managed using cudaMalloc/cudaFree
24  Device = 1,
25  /// Managed using cudaMallocManaged/cudaFree
26  Unified = 2,
27 };
28 
29 /// Allocates CUDA memory for a given memory space
30 void allocMemorySpace(MemorySpace space, void** p, size_t size);
31 
32 } }