Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix re-run smart build bug #165

Merged
merged 6 commits into from
Mar 19, 2022
Merged
Changes from 1 commit
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
16 changes: 16 additions & 0 deletions smartsim/_core/_cli/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import os
import sys
from pathlib import Path

Expand All @@ -9,6 +10,8 @@
from smartsim._core._install import builder
from smartsim._core._install.buildenv import BuildEnv, SetupError, Version_, Versioner
from smartsim._core._install.builder import BuildError
from smartsim._core.config import CONFIG
from smartsim._core.utils.helpers import installed_redisai_backends
from smartsim.log import get_logger

smart_logger_format = "[%(name)s] %(levelname)s %(message)s"
Expand Down Expand Up @@ -97,6 +100,13 @@ def __init__(self):
str(args.device), pt, tf, onnx, args.torch_dir, args.libtensorflow_dir
)

backends = [
backend.capitalize() for backend in installed_redisai_backends()
]
logger.info(
(", ".join(backends) if backends else "No") + " backend(s) built"
)

except (SetupError, BuildError) as e:
logger.error(str(e))
exit(1)
Expand Down Expand Up @@ -144,6 +154,12 @@ def build_redis_ai(
print(f" ONNX {self.versions.ONNX}: {color_bool(onnx)}\n")
print(f"Building for GPU support: {color_bool(device == 'gpu')}\n")

if os.path.isdir(CONFIG.lib_path) and os.listdir(CONFIG.lib_path):
logger.error(
"If you wish to re-run `smart build`, you must first run `smart clean`."
)
exit(1)

# Check for onnx and tf in user python environemnt and prompt user
# to download them if they are not installed. this should not break
# the build however, as we use onnx and tf directly from RAI instead
Expand Down