Struct faiss::InterruptCallback

struct InterruptCallback

Public Functions

virtual bool want_interrupt() = 0
inline virtual ~InterruptCallback()

Public Static Functions

static void clear_instance()
static void check()

check if:

  • an interrupt callback is set

  • the callback returns true if this is the case, then throw an exception. Should not be called from multiple threads.

static bool is_interrupted()

same as check() but return true if is interrupted instead of throwing. Can be called from multiple threads.

static size_t get_period_hint(size_t flops)

assuming each iteration takes a certain number of flops, what is a reasonable interval to check for interrupts?

Public Static Attributes

static std::mutex lock
static std::unique_ptr<InterruptCallback> instance