Skip to content

Commit

Permalink
Fix default values for backend configs when not set (triton-inference…
Browse files Browse the repository at this point in the history
…-server#3317)

* Fix default values for backend configs when not set
- MinComputeCapability
- BackendDir
- StrictModelConfig

* review edits
  • Loading branch information
CoderHam committed Sep 13, 2021
1 parent f1540a3 commit 448b38d
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/core/tritonserver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,7 @@ class TritonServerOptions {
void SetExitOnError(bool b) { exit_on_error_ = b; }

bool StrictModelConfig() const { return strict_model_config_; }
void SetStrictModelConfig(bool b)
{
strict_model_config_ = b;
// Note the condition is reverted due to setting name is different
AddBackendConfig(
std::string(), "auto-complete-config", b ? "false" : "true");
}
void SetStrictModelConfig(bool b) { strict_model_config_ = b; }

ni::RateLimitMode RateLimiterMode() const { return rate_limit_mode_; }
void SetRateLimiterMode(ni::RateLimitMode m) { rate_limit_mode_ = m; }
Expand Down Expand Up @@ -246,8 +240,6 @@ class TritonServerOptions {
void SetMinSupportedComputeCapability(double c)
{
min_compute_capability_ = c;
AddBackendConfig(
std::string(), "min-compute-capability", std::to_string(c));
}

bool StrictReadiness() const { return strict_readiness_; }
Expand Down Expand Up @@ -275,11 +267,7 @@ class TritonServerOptions {
void SetMetricsInterval(uint64_t m) { metrics_interval_ = m; }

const std::string& BackendDir() const { return backend_dir_; }
void SetBackendDir(const std::string& bd)
{
backend_dir_ = bd;
AddBackendConfig(std::string(), "backend-directory", bd);
}
void SetBackendDir(const std::string& bd) { backend_dir_ = bd; }

const std::string& RepoAgentDir() const { return repoagent_dir_; }
void SetRepoAgentDir(const std::string& rad) { repoagent_dir_ = rad; }
Expand Down Expand Up @@ -1737,16 +1725,16 @@ TRITONSERVER_ServerNew(
lserver->SetModelRepositoryPaths(loptions->ModelRepositoryPaths());
lserver->SetModelControlMode(loptions->ModelControlMode());
lserver->SetStartupModels(loptions->StartupModels());
lserver->SetStrictModelConfigEnabled(loptions->StrictModelConfig());
bool strict_model_config = loptions->StrictModelConfig();
lserver->SetStrictModelConfigEnabled(strict_model_config);
lserver->SetRateLimiterMode(loptions->RateLimiterMode());
lserver->SetRateLimiterResources(loptions->RateLimiterResources());
lserver->SetPinnedMemoryPoolByteSize(loptions->PinnedMemoryPoolByteSize());
lserver->SetCudaMemoryPoolByteSize(loptions->CudaMemoryPoolByteSize());
lserver->SetMinSupportedComputeCapability(
loptions->MinSupportedComputeCapability());
double min_compute_capability = loptions->MinSupportedComputeCapability();
lserver->SetMinSupportedComputeCapability(min_compute_capability);
lserver->SetStrictReadinessEnabled(loptions->StrictReadiness());
lserver->SetExitTimeoutSeconds(loptions->ExitTimeout());
lserver->SetBackendCmdlineConfig(loptions->BackendCmdlineConfigMap());
lserver->SetHostPolicyCmdlineConfig(loptions->HostPolicyCmdlineConfigMap());
lserver->SetRepoAgentDir(loptions->RepoAgentDir());
lserver->SetBufferManagerThreadCount(loptions->BufferManagerThreadCount());
Expand All @@ -1758,6 +1746,20 @@ TRITONSERVER_ServerNew(
lserver->SetTensorFlowGPUMemoryFraction(
loptions->TensorFlowGpuMemoryFraction());

// SetBackendCmdlineConfig must be called after all AddBackendConfig calls
// have completed.
// Note that the auto complete config condition is reverted
// due to setting name being different
loptions->AddBackendConfig(
std::string(), "auto-complete-config",
strict_model_config ? "false" : "true");
loptions->AddBackendConfig(
std::string(), "min-compute-capability",
std::to_string(min_compute_capability));
loptions->AddBackendConfig(
std::string(), "backend-directory", loptions->BackendDir());
lserver->SetBackendCmdlineConfig(loptions->BackendCmdlineConfigMap());

ni::Status status = lserver->Init();
std::vector<std::string> options_headers;
options_headers.emplace_back("Option");
Expand Down

0 comments on commit 448b38d

Please sign in to comment.