Skip to content

Commit 609097d

Browse files
committed
Keep CUDA installation files after download and installation
- Preserve main installer .run file after successful installation - Keep all .deb package files (NCCL, cuDNN, TensorRT, nvidia-utils) for future use - Only cleanup temporary extract directories, not installation files - Files remain in temp directory for faster reinstallations
1 parent b1d531f commit 609097d

1 file changed

Lines changed: 17 additions & 25 deletions

File tree

backend/cuda_installer.py

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,11 +1347,10 @@ async def _install_nccl_linux(self, cuda_version: str, cuda_path: str) -> None:
13471347
f"Failed to copy {f}: {copy_err}"
13481348
)
13491349

1350-
# Cleanup
1350+
# Cleanup temporary extract directory only (keep .deb files)
13511351
shutil.rmtree(extract_dir, ignore_errors=True)
1352-
for deb_path in [nccl_path, nccl_dev_path]:
1353-
if os.path.exists(deb_path):
1354-
os.remove(deb_path)
1352+
# Keep .deb files for future use
1353+
logger.info(f"NCCL packages kept at: {nccl_path}, {nccl_dev_path}")
13551354

13561355
await self._broadcast_log_line("NCCL extracted to CUDA directory")
13571356
await self._broadcast_progress(
@@ -1549,10 +1548,11 @@ async def _install_nvidia_smi_linux(self, cuda_path: str) -> None:
15491548
}
15501549
)
15511550

1552-
# Cleanup
1551+
# Cleanup temporary extract directory only (keep .deb file)
15531552
shutil.rmtree(extract_dir, ignore_errors=True)
1553+
# Keep .deb file for future use
15541554
if os.path.exists(nvidia_utils_path):
1555-
os.remove(nvidia_utils_path)
1555+
logger.info(f"nvidia-utils package kept at: {nvidia_utils_path}")
15561556

15571557
else:
15581558
await self._broadcast_log_line(
@@ -1764,11 +1764,10 @@ async def _install_cudnn_linux(self, cuda_version: str, cuda_path: str) -> None:
17641764
f"Failed to copy {f}: {copy_err}"
17651765
)
17661766

1767-
# Cleanup
1767+
# Cleanup temporary extract directory only (keep .deb files)
17681768
shutil.rmtree(extract_dir, ignore_errors=True)
1769-
for deb_path in [cudnn_path, cudnn_dev_path]:
1770-
if os.path.exists(deb_path):
1771-
os.remove(deb_path)
1769+
# Keep .deb files for future use
1770+
logger.info(f"cuDNN packages kept at: {cudnn_path}, {cudnn_dev_path}")
17721771

17731772
await self._broadcast_log_line("cuDNN extracted to CUDA directory")
17741773
await self._broadcast_progress(
@@ -2033,16 +2032,13 @@ async def _install_tensorrt_linux(self, cuda_version: str, cuda_path: str) -> No
20332032
f"Failed to copy {f}: {copy_err}"
20342033
)
20352034

2036-
# Cleanup
2035+
# Cleanup temporary extract directory only (keep .deb files)
20372036
shutil.rmtree(extract_dir, ignore_errors=True)
2038-
for deb_path in [
2039-
tensorrt_path,
2040-
tensorrt_dev_path,
2041-
tensorrt_plugin_path,
2042-
tensorrt_plugin_dev_path,
2043-
]:
2044-
if os.path.exists(deb_path):
2045-
os.remove(deb_path)
2037+
# Keep .deb files for future use
2038+
logger.info(
2039+
f"TensorRT packages kept at: {tensorrt_path}, {tensorrt_dev_path}, "
2040+
f"{tensorrt_plugin_path}, {tensorrt_plugin_dev_path}"
2041+
)
20462042

20472043
await self._broadcast_log_line("TensorRT extracted to CUDA directory")
20482044
await self._broadcast_progress(
@@ -2152,12 +2148,8 @@ async def _runner():
21522148
f"Updated process environment with CUDA {version} paths"
21532149
)
21542150

2155-
# Cleanup installer file
2156-
try:
2157-
if os.path.exists(installer_path):
2158-
os.remove(installer_path)
2159-
except Exception as exc:
2160-
logger.warning(f"Failed to cleanup installer: {exc}")
2151+
# Keep installer file for future use (not deleting)
2152+
logger.info(f"Installer file kept at: {installer_path}")
21612153

21622154
except Exception as exc:
21632155
self._last_error = str(exc)

0 commit comments

Comments
 (0)