Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Add execution mode option to PyHDK python tests #518

Merged
merged 5 commits into from
Jun 28, 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
6 changes: 6 additions & 0 deletions omniscidb/ConfigBuilder/ConfigBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,12 @@ bool ConfigBuilder::parseCommandLineArgs(int argc,
->default_value(config_->debug.enable_automatic_ir_metadata)
->implicit_value(true),
"Enable automatic IR metadata (debug builds only).");
opt_desc.add_options()(
"enable-gpu-code-compilation-cache",
po::value<bool>(&config_->debug.enable_gpu_code_compilation_cache)
->default_value(config_->debug.enable_gpu_code_compilation_cache)
->implicit_value(true),
"Enable GPU compilation code caching.");

// storage
opt_desc.add_options()(
Expand Down
2 changes: 1 addition & 1 deletion omniscidb/QueryEngine/NativeCodegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ std::shared_ptr<CompilationContext> Executor::optimizeAndCodegenGPU(

auto key = get_code_cache_key(query_func, cgen_state_.get());
auto cached_code = Executor::gpu_code_accessor->get_value(key);
if (cached_code) {
if (config_->debug.enable_gpu_code_compilation_cache && cached_code) {
return cached_code;
}

Expand Down
1 change: 1 addition & 0 deletions omniscidb/Shared/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ struct DebugConfig {
std::string build_ra_cache = "";
std::string use_ra_cache = "";
bool enable_automatic_ir_metadata = true;
bool enable_gpu_code_compilation_cache = true;
std::string log_dir = "hdk_log";
};

Expand Down
3 changes: 2 additions & 1 deletion python/pyhdk/hdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,7 @@ def schema(self):
"""
pass

def run(self):
def run(self, **kwargs):
"""
Run query with the current node as a query root node.

Expand Down Expand Up @@ -2624,6 +2624,7 @@ def ntile(self, tile_count):
def init(**kwargs):
if init._instance is None:
init._instance = HDK(**kwargs)
# TODO: kwargs are ignored here
return init._instance


Expand Down
38 changes: 38 additions & 0 deletions python/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# Copyright 2022 Intel Corporation.
#
# SPDX-License-Identifier: Apache-2.0


from pytest import fixture
from dataclasses import dataclass


def pytest_addoption(parser):
parser.addoption(
"--device", action="store", default="CPU", help="Choose device type (CPU/GPU)."
)


@dataclass
class ExecutionConfig:
enable_heterogeneous: bool
device_type: str


cpu_cfg = ExecutionConfig(False, "CPU")
gpu_cfg = ExecutionConfig(False, "GPU")
het_cfg = ExecutionConfig(True, "AUTO")


def get_execution_config(device_type: str):
if device_type.lower() == "cpu":
return cpu_cfg
if device_type.lower() == "gpu":
return gpu_cfg
raise ValueError("Unsupported exeuction config: " + str(device_type))


@fixture
def exe_cfg(request):
return get_execution_config(request.config.getoption("--device"))
Loading