Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a macro to override the use of std::cerr #508

Merged
merged 4 commits into from
Oct 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hnswlib/hnswalg.h
Original file line number Diff line number Diff line change
@@ -105,8 +105,8 @@ class HierarchicalNSW : public AlgorithmInterface<dist_t> {
if ( M <= 10000 ) {
M_ = M;
} else {
std::cerr << "warning: M parameter exceeds 10000 which may lead to adverse effects." << std::endl;
std::cerr << " Cap to 10000 will be applied for the rest of the processing." << std::endl;
HNSWERR << "warning: M parameter exceeds 10000 which may lead to adverse effects." << std::endl;
HNSWERR << " Cap to 10000 will be applied for the rest of the processing." << std::endl;
M_ = 10000;
}
maxM_ = M_;
9 changes: 9 additions & 0 deletions hnswlib/hnswlib.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#pragma once

// https://github.com/nmslib/hnswlib/pull/508
// This allows others to provide their own error stream (e.g. RcppHNSW)
#ifndef HNSWLIB_ERR_OVERRIDE
#define HNSWERR std::cerr
#else
#define HNSWERR HNSWLIB_ERR_OVERRIDE
#endif

#ifndef NO_MANUAL_VECTORIZATION
#if (defined(__SSE__) || _M_IX86_FP > 0 || defined(_M_AMD64) || defined(_M_X64))
#define USE_SSE