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 // Copyright 2004-present Facebook. All Rights Reserved.
10
11 #pragma once
12
13 namespace faiss { namespace gpu {
14
15 #ifdef __CUDA_ARCH__
16 #if __CUDA_ARCH__ <= 700
17 constexpr int kWarpSize = 32;
18 #else
19 #error Unknown __CUDA_ARCH__; please define parameters for compute capability
20 #endif // __CUDA_ARCH__ types
21 #endif // __CUDA_ARCH__
22
23 #ifndef __CUDA_ARCH__
24 // dummy value for host compiler
25 constexpr int kWarpSize = 32;
26 #endif // !__CUDA_ARCH__
27
28 // This is a memory barrier for intra-warp writes to shared memory.
29 __forceinline__ __device__ void warpFence() {
30
31 #if __CUDA_ARCH__ >= 700
32 __syncwarp();
33 #else
34 // For the time being, assume synchronicity.
35 // __threadfence_block();
36 #endif
37 }
38
39 } } // namespace