Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
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
7 changes: 4 additions & 3 deletions engine/services/engine_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ cpp::result<bool, std::string> EngineService::UnzipEngine(
CTL_INF("Found cuda variant, extract it");
found_cuda = true;
// extract binary
auto cuda_path =
file_manager_utils::GetCudaToolkitPath(NormalizeEngine(engine));
auto cuda_path = file_manager_utils::GetCudaToolkitPath(
NormalizeEngine(engine), true);
archive_utils::ExtractArchive(path + "/" + cf, cuda_path.string(),
true);
}
Expand Down Expand Up @@ -434,7 +434,8 @@ cpp::result<bool, std::string> EngineService::DownloadCuda(
}};

auto on_finished = [engine](const DownloadTask& finishedTask) {
auto engine_path = file_manager_utils::GetCudaToolkitPath(engine);
auto engine_path = file_manager_utils::GetCudaToolkitPath(engine, true);

archive_utils::ExtractArchive(finishedTask.items[0].localPath.string(),
engine_path.string());
try {
Expand Down
5 changes: 3 additions & 2 deletions engine/utils/file_manager_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,14 @@ std::filesystem::path GetModelsContainerPath() {
return models_container_path;
}

std::filesystem::path GetCudaToolkitPath(const std::string& engine) {
std::filesystem::path GetCudaToolkitPath(const std::string& engine,
bool create_if_not_exist) {
auto engine_path = getenv("ENGINE_PATH")
? std::filesystem::path(getenv("ENGINE_PATH"))
: GetCortexDataPath();

auto cuda_path = engine_path / "engines" / engine / "deps";
if (!std::filesystem::exists(cuda_path)) {
if (create_if_not_exist && !std::filesystem::exists(cuda_path)) {
std::filesystem::create_directories(cuda_path);
}

Expand Down
3 changes: 2 additions & 1 deletion engine/utils/file_manager_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ void CreateDirectoryRecursively(const std::string& path);

std::filesystem::path GetModelsContainerPath();

std::filesystem::path GetCudaToolkitPath(const std::string& engine);
std::filesystem::path GetCudaToolkitPath(const std::string& engine,
bool create_if_not_exist = false);

std::filesystem::path GetEnginesContainerPath();

Expand Down