Skip to content

Commit

Permalink
Update version of Torch compatible with cuDNN 8
Browse files Browse the repository at this point in the history
  • Loading branch information
ashao committed Sep 18, 2024
1 parent df09ce0 commit e69c271
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
10 changes: 5 additions & 5 deletions smartsim/_core/_install/redisaiBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ def build(self) -> None:
cmake_command = self._rai_cmake_cmd()
build_command = self._rai_build_cmd

logger.info("Configuring CMake Build")
if self.verbose:
print(" ".join(cmake_command))
self.run_command(cmake_command, self.build_path)

if self.platform.device.is_rocm():
pytorch_rocm_arch = os.environ.get("PYTORCH_ROCM_ARCH")
if pytorch_rocm_arch is not None:
Expand All @@ -174,6 +169,11 @@ def build(self) -> None:
"if you are supplying your own version of libtensorflow."
)

logger.info("Configuring CMake Build")
if self.verbose:
print(" ".join(cmake_command))
self.run_command(cmake_command, self.build_path)

logger.info("Building RedisAI")
if self.verbose:
print(" ".join(build_command))
Expand Down
25 changes: 24 additions & 1 deletion smartsim/_core/_install/utils/retrieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from urllib.request import urlretrieve

import git
import tqdm

from smartsim._core._install.platform import Architecture, OperatingSystem
from smartsim._core._install.types import PathLike
Expand All @@ -43,6 +44,24 @@ class UnsupportedArchive(Exception):
pass


class _TqdmUpTo(tqdm.tqdm):
"""Provides `update_to(n)` which uses `tqdm.update(delta_n)`.
From tqdm doumentation for progress bar when downloading
"""
def update_to(self, b=1, bsize=1, tsize=None):
"""
b : int, optional
Number of blocks transferred so far [default: 1].
bsize : int, optional
Size of each block (in tqdm units) [default: 1].
tsize : int, optional
Total size (in tqdm units). If [default: None] remains unchanged.
"""
if tsize is not None:
self.total = tsize
return self.update(b * bsize - self.n) # also sets self.n = b * bsize

def _from_local_archive(
source: PathLike,
destination: pathlib.Path,
Expand Down Expand Up @@ -84,7 +103,11 @@ def _from_http(
:param source: URL to a particular package
:param destination: Where to unpack the archive
"""
local_file, _ = urlretrieve(source, **kwargs)
with _TqdmUpTo(unit='B', unit_scale=True, unit_divisor=1024, miniters=1,
desc=source.split('/')[-1]) as t: # all optional kwargs
local_file, _ = urlretrieve(source, reporthook=t.update_to, **kwargs)
t.total = t.n

_from_local_archive(local_file, destination)
os.remove(local_file)

Expand Down

0 comments on commit e69c271

Please sign in to comment.