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