| 1 |
/* |
| 2 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 |
* |
| 4 |
* This source code is licensed under the MIT license found in the |
| 5 |
* LICENSE file in the root directory of this source tree. |
| 6 |
*/ |
| 7 |
|
| 8 |
// -*- c -*- |
| 9 |
|
| 10 |
#ifndef FAISS_DEVICE_UTILS_C_H |
| 11 |
#define FAISS_DEVICE_UTILS_C_H |
| 12 |
|
| 13 |
#include <cublas_v2.h> |
| 14 |
#include <cuda_runtime_api.h> |
| 15 |
#include "../faiss_c.h" |
| 16 |
|
| 17 |
#ifdef __cplusplus |
| 18 |
extern "C" { |
| 19 |
#endif |
| 20 |
|
| 21 |
/// Returns the number of available GPU devices |
| 22 |
int faiss_get_num_gpus(int* p_output); |
| 23 |
|
| 24 |
/// Starts the CUDA profiler (exposed via SWIG) |
| 25 |
int faiss_gpu_profiler_start(); |
| 26 |
|
| 27 |
/// Stops the CUDA profiler (exposed via SWIG) |
| 28 |
int faiss_gpu_profiler_stop(); |
| 29 |
|
| 30 |
/// Synchronizes the CPU against all devices (equivalent to |
| 31 |
/// cudaDeviceSynchronize for each device) |
| 32 |
int faiss_gpu_sync_all_devices(); |
| 33 |
|
| 34 |
#ifdef __cplusplus |
| 35 |
} |
| 36 |
#endif |
| 37 |
#endif |