|
7 | 7 | #include "utils/archive_utils.h" |
8 | 8 | #include "utils/system_info_utils.h" |
9 | 9 | // clang-format on |
10 | | -#include "utils/cortex_utils.h" |
11 | 10 | #include "utils/cuda_toolkit_utils.h" |
12 | 11 | #include "utils/engine_matcher_utils.h" |
13 | 12 | #include "utils/file_manager_utils.h" |
@@ -125,6 +124,11 @@ bool EngineInitCmd::Exec() const { |
125 | 124 | return true; |
126 | 125 | } |
127 | 126 |
|
| 127 | + if (cuda_driver_version.empty()) { |
| 128 | + CTL_WRN("No cuda driver, continue with CPU"); |
| 129 | + return true; |
| 130 | + } |
| 131 | + |
128 | 132 | // download cuda toolkit |
129 | 133 | const std::string jan_host = "https://catalog.jan.ai"; |
130 | 134 | const std::string cuda_toolkit_file_name = "cuda.tar.gz"; |
@@ -164,35 +168,30 @@ bool EngineInitCmd::Exec() const { |
164 | 168 | << cuda_driver_version << "/" << system_info.os |
165 | 169 | << "/" << cuda_toolkit_file_name; |
166 | 170 |
|
167 | | - LOG_DEBUG << "Cuda toolkit download url: " << jan_host |
| 171 | + LOG_DEBUG << "Cuda toolkit download url: " |
168 | 172 | << cuda_toolkit_url.str(); |
169 | | - auto cuda_toollkit_local_path = |
170 | | - file_manager_utils::GetExecutableFolderContainerPath() / |
| 173 | + auto cuda_toolkit_local_path = |
| 174 | + file_manager_utils::GetContainerFolderPath( |
| 175 | + file_manager_utils::DownloadTypeToString( |
| 176 | + DownloadType::CudaToolkit)) / |
171 | 177 | cuda_toolkit_file_name; |
| 178 | + LOG_DEBUG << "Download to: " << cuda_toolkit_local_path.string(); |
172 | 179 | auto downloadCudaToolkitTask{DownloadTask{ |
173 | 180 | .id = download_id, |
174 | 181 | .type = DownloadType::CudaToolkit, |
175 | 182 | .items = {DownloadItem{.id = download_id, |
176 | 183 | .downloadUrl = cuda_toolkit_url.str(), |
177 | | - .localPath = cuda_toollkit_local_path}}, |
| 184 | + .localPath = cuda_toolkit_local_path}}, |
178 | 185 | }}; |
179 | 186 |
|
180 | 187 | download_service.AddDownloadTask( |
181 | 188 | downloadCudaToolkitTask, [&](const DownloadTask& finishedTask) { |
182 | | - // TODO(any) This is a temporary fix. The issue will be fixed when we has CIs |
183 | | - // to pack CUDA dependecies into engine release |
184 | | - auto get_engine_path = [](std::string_view e) { |
185 | | - if (e == "cortex.llamacpp") { |
186 | | - return cortex_utils::kLlamaLibPath; |
187 | | - } else { |
188 | | - return cortex_utils::kTensorrtLlmPath; |
189 | | - } |
190 | | - }; |
191 | | - std::string engine_path = |
192 | | - file_manager_utils::GetCortexDataPath().string() + |
193 | | - get_engine_path(engineName_); |
| 189 | + auto engine_path = |
| 190 | + file_manager_utils::GetEnginesContainerPath() / |
| 191 | + engineName_; |
194 | 192 | archive_utils::ExtractArchive( |
195 | | - finishedTask.items[0].localPath.string(), engine_path); |
| 193 | + finishedTask.items[0].localPath.string(), |
| 194 | + engine_path.string()); |
196 | 195 |
|
197 | 196 | try { |
198 | 197 | std::filesystem::remove(finishedTask.items[0].localPath); |
|
0 commit comments