Merge c67085e369 into 43de73cbd6
This commit is contained in:
commit
ebd32b8d3e
|
|
@ -77,7 +77,7 @@ public:
|
|||
}
|
||||
m_size = sb.st_size;
|
||||
if (m_size > 0) {
|
||||
m_data = mmap(nullptr, m_size, prot, MAP_PRIVATE, m_handle.get(), 0);
|
||||
m_data = mmap(nullptr, m_size, prot, MAP_PRIVATE | MAP_POPULATE, m_handle.get(), 0);
|
||||
if (m_data == MAP_FAILED) {
|
||||
throw std::runtime_error("Can not create file mapping for " + path + ", err=" + std::strerror(errno));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,6 +113,14 @@ private:
|
|||
0, // offset_align >> 32,
|
||||
0, // offset_align & 0xffffffff,
|
||||
m_size);
|
||||
|
||||
WIN32_MEMORY_RANGE_ENTRY memoryRange;
|
||||
memoryRange.VirtualAddress = m_data;
|
||||
memoryRange.NumberOfBytes = m_size;
|
||||
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
PrefetchVirtualMemory(hProcess, 1, &memoryRange, 0);
|
||||
|
||||
if (!m_data) {
|
||||
throw std::runtime_error("Can not create map view for " + path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import argparse
|
|||
import sys
|
||||
import os
|
||||
import yaml
|
||||
import urllib.request
|
||||
|
||||
from pathlib import Path
|
||||
from pprint import pprint
|
||||
|
|
@ -31,8 +32,23 @@ sys.path.insert(0, str(UTILS_DIR))
|
|||
|
||||
from proc_utils import cmd_exec
|
||||
from path_utils import check_positive_int
|
||||
from platform_utils import os_type_is_windows
|
||||
|
||||
|
||||
def page_cache_cleanup():
|
||||
retcode = 0
|
||||
if os_type_is_windows():
|
||||
# Download to a temporary file
|
||||
EmptyStandbyList_exe_path = urllib.request.urlretrieve(
|
||||
"https://github.com/vurusovs/EmptyStandbyList/raw/master/EmptyStandbyList.exe")[0]
|
||||
retcode, _ = cmd_exec([EmptyStandbyList_exe_path])
|
||||
else:
|
||||
cmd = ["sudo", "sh", "-c", "echo 1 > /proc/sys/vm/drop_caches"]
|
||||
retcode, _ = cmd_exec(cmd)
|
||||
if (retcode):
|
||||
raise Exception("Page cache clean failed")
|
||||
|
||||
|
||||
def parse_stats(stats: list, res: dict):
|
||||
"""Parse raw statistics from nested list to flatten dict"""
|
||||
for element in stats:
|
||||
|
|
@ -72,6 +88,9 @@ def run_timetest(args: dict, log=None):
|
|||
if log is None:
|
||||
log = logging.getLogger("run_timetest")
|
||||
|
||||
if args["hint"] == "cold":
|
||||
page_cache_cleanup()
|
||||
|
||||
cmd_common = prepare_executable_cmd(args)
|
||||
ov_env = os.environ
|
||||
ov_env['OPENVINO_LOG_LEVEL'] = '4'
|
||||
|
|
@ -156,6 +175,12 @@ def cli_parser():
|
|||
dest="output_precision",
|
||||
type=str,
|
||||
help="Change output model precision")
|
||||
parser.add_argument("-hint",
|
||||
default="cold", # TODO: revert after custom CI runs
|
||||
choices=["warm", "cold"],
|
||||
dest="hint",
|
||||
type=str,
|
||||
help="Configure environment to perform measurements")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,13 @@ def pytest_addoption(parser):
|
|||
action='store_true',
|
||||
help="Enable model cache usage",
|
||||
)
|
||||
test_args_parser.addoption(
|
||||
"--hint",
|
||||
default="cold", # TODO: revert after custom CI runs
|
||||
choices=["warm", "cold"],
|
||||
type=str,
|
||||
help="Configure environment to perform measurements",
|
||||
)
|
||||
db_args_parser = parser.getgroup("timetest database use")
|
||||
db_args_parser.addoption(
|
||||
'--db_submit',
|
||||
|
|
@ -130,6 +137,11 @@ def model_cache(request):
|
|||
"""Fixture function for command-line option."""
|
||||
return request.config.getoption('model_cache')
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def hint(request):
|
||||
"""Fixture function for command-line option."""
|
||||
return request.config.getoption('hint')
|
||||
|
||||
|
||||
# -------------------- CLI options --------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ from scripts.run_timetest import run_timetest
|
|||
REFS_FACTOR = 1.2 # 120%
|
||||
|
||||
|
||||
def test_timetest(instance, executable, niter, cl_cache_dir, model_cache, model_cache_dir,
|
||||
def test_timetest(instance, executable, niter, cl_cache_dir, model_cache, model_cache_dir, hint,
|
||||
test_info, temp_dir, validate_test_case, prepare_db_info):
|
||||
"""Parameterized test.
|
||||
|
||||
|
|
@ -76,6 +76,7 @@ def test_timetest(instance, executable, niter, cl_cache_dir, model_cache, model_
|
|||
"input_precision": input_precision,
|
||||
"output_precision": output_precision,
|
||||
"model_cache": model_cache,
|
||||
"hint": hint,
|
||||
}
|
||||
logging.info("Run timetest once to generate any cache")
|
||||
retcode, msg, _, _, _ = run_timetest({**exe_args, "niter": 1}, log=logging)
|
||||
|
|
|
|||
Loading…
Reference in New Issue