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

Add WIN macro for non-win function #360

Merged
merged 8 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions include/filter_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ DISKANN_DLLEXPORT tsl::robin_map<std::string, std::vector<uint32_t>> generate_la
* Each data file is saved under the following format:
* input_data_path + "_" + label
*/
#ifndef _WINDOWS
template <typename T>
inline tsl::robin_map<std::string, std::vector<uint32_t>> generate_label_specific_vector_files(
path input_data_path, tsl::robin_map<std::string, uint32_t> labels_to_number_of_points,
Expand Down Expand Up @@ -181,6 +182,7 @@ inline tsl::robin_map<std::string, std::vector<uint32_t>> generate_label_specifi
return label_id_to_orig_id;
#endif
}
#endif

inline std::vector<uint32_t> loadTags(const std::string &tags_file, const std::string &base_file)
{
Expand Down
15 changes: 12 additions & 3 deletions src/windows_aligned_file_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "windows_aligned_file_reader.h"
#include <iostream>
#include "utils.h"
#include <stdlib.h>

#define SECTOR_LEN 4096

Expand Down Expand Up @@ -43,9 +44,17 @@ void WindowsAlignedFileReader::register_thread()
FILE_ATTRIBUTE_READONLY | FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED | FILE_FLAG_RANDOM_ACCESS, NULL);
if (ctx.fhandle == INVALID_HANDLE_VALUE)
{
harsha-simhadri marked this conversation as resolved.
Show resolved Hide resolved
std::stringstream ss;
ss << m_filename.c_str();
diskann::cout << "Error opening " << ss.str() << " -- error=" << GetLastError() << std::endl;
const size_t c_max_filepath_len = 256;
harsha-simhadri marked this conversation as resolved.
Show resolved Hide resolved
size_t actual_len = 0;
char filePath[c_max_filepath_len];
harsha-simhadri marked this conversation as resolved.
Show resolved Hide resolved
if (wcstombs_s(&actual_len, filePath, c_max_filepath_len, m_filename.c_str(), m_filename.length()) == 0)
{
diskann::cout << "Error opening " << filePath << " -- error=" << GetLastError() << std::endl;
}
else
{
diskann::cout << "Error converting wchar to char -- error=" << GetLastError() << std::endl;
}
}

// create IOCompletionPort
Expand Down