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

Disable mmap for models on windows #2963

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions src/modelmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ ModelManager::ModelManager(const std::string& modelCacheDirectory, MetricRegistr
metricRegistry(registry),
pythonBackend(pythonBackend) {
OV_LOGGER("ov::Core(): {}", reinterpret_cast<void*>(this->ieCore.get()));
#ifdef _WIN32
// On Windows, we do not want to use mmap in order to support model version management
ieCore->set_property(ov::AnyMap{{ov::enable_mmap(false)}});
#endif
// Take --cache_dir from CLI
if (this->modelCacheDirectory.empty()) {
this->modelCacheDirectory = ovms::Config::instance().cacheDir();
Expand Down
15 changes: 0 additions & 15 deletions src/test/http_rest_api_handler_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,6 @@ TEST_F(ConfigReload, startWith1DummyThenAddVersion) {
EXPECT_EQ(expectedJson2, response);
EXPECT_EQ(status, ovms::StatusCode::OK_RELOADED);

// Workaround to unload before removing the model,
// because on windows does not close the handle (uses mmap)
#ifdef _WIN32
this->UnloadConfig(t.getManager());
#endif
std::filesystem::remove_all(getGenericFullPathForTmp("/tmp/dummy"));
}

Expand Down Expand Up @@ -391,11 +386,6 @@ TEST_F(ConfigReload, startWithMissingXmlThenAddAndReload) {
EXPECT_EQ(expectedJson2, response);
EXPECT_EQ(status, ovms::StatusCode::OK_RELOADED);

// Workaround to unload before removing the model,
// because on windows does not close the handle (uses mmap)
#ifdef _WIN32
this->UnloadConfig(t.getManager());
#endif
std::filesystem::remove_all(getGenericFullPathForTmp("/tmp/dummy"));
}

Expand All @@ -418,11 +408,6 @@ TEST_F(ConfigReload, startWithEmptyModelDir) {
ASSERT_EQ(status, ovms::StatusCode::OK_NOT_RELOADED);
EXPECT_EQ(expectedJson, response);

// Workaround to unload before removing the model,
// because on windows does not close the handle (uses mmap)
#ifdef _WIN32
this->UnloadConfig(t.getManager());
#endif
std::filesystem::remove_all("/tmp/dummy");
}

Expand Down