Faiss

- Main Page
- Namespaces
- Classes
- Files

- File List

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
DeviceDefs.cuh
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 namespace faiss { namespace gpu {
13
14 #ifdef __CUDA_ARCH__
15 #if __CUDA_ARCH__ <= 700
16 constexpr int kWarpSize = 32;
17 #else
18 #error Unknown __CUDA_ARCH__; please define parameters for compute capability
19 #endif // __CUDA_ARCH__ types
20 #endif // __CUDA_ARCH__
21
22 #ifndef __CUDA_ARCH__
23 // dummy value for host compiler
24 constexpr int kWarpSize = 32;
25 #endif // !__CUDA_ARCH__
26
27 // This is a memory barrier for intra-warp writes to shared memory.
28 __forceinline__ __device__ void warpFence() {
29
30 #if CUDA_VERSION >= 9000
31 __syncwarp();
32 #else
33 // For the time being, assume synchronicity.
34 // __threadfence_block();
35 #endif
36 }
37
38 } } // namespace