diff --git a/build_metal.sh b/build_metal.sh index 0fa0a77914c..6c1854fd5e2 100755 --- a/build_metal.sh +++ b/build_metal.sh @@ -1,10 +1,6 @@ #!/bin/bash set -eo pipefail -if [ -z "$PYTHON_ENV_DIR" ]; then - PYTHON_ENV_DIR=$(pwd)/python_env -fi - if [ -z "$CONFIG" ]; then echo "Build type defaulted to Release" else @@ -21,21 +17,7 @@ echo "Building tt-metal" cmake -B build -G Ninja cmake --build build --target install -echo "Creating virtual env in: $PYTHON_ENV_DIR" -python3 -m venv $PYTHON_ENV_DIR - -source $PYTHON_ENV_DIR/bin/activate - -echo "Setting up virtual env" -python3 -m pip config set global.extra-index-url https://download.pytorch.org/whl/cpu -python3 -m pip install setuptools wheel - -echo "Installing dev dependencies" -python3 -m pip install -r $(pwd)/tt_metal/python_env/requirements-dev.txt - -echo "Installing tt-metal" -pip install -e . -pip install -e ttnn +./scripts/build_scripts/create_venv.sh if [ "$CONFIG" != "ci" ]; then echo "Building cpp tests" diff --git a/scripts/build_scripts/build_with_profiler_opt.sh b/scripts/build_scripts/build_with_profiler_opt.sh index b347982dc5e..3b0a1c7942d 100755 --- a/scripts/build_scripts/build_with_profiler_opt.sh +++ b/scripts/build_scripts/build_with_profiler_opt.sh @@ -13,6 +13,7 @@ fi remove_default_log_locations -cmake -B build && cmake --build build --target clean && rm -rf build -PYTHON_ENV_DIR=$(pwd)/build/python_env ENABLE_TRACY=1 ENABLE_PROFILER=1 ./build_metal.sh -cmake --build build --target programming_examples -- -j`nproc` +ENABLE_TRACY=1 ENABLE_PROFILER=1 cmake -B build -G Ninja && cmake --build build --target clean +cmake --build build --target install +cmake --build build --target programming_examples +PYTHON_ENV_DIR=$(pwd)/build/python_env ./scripts/build_scripts/create_venv.sh diff --git a/scripts/build_scripts/create_venv.sh b/scripts/build_scripts/create_venv.sh new file mode 100755 index 00000000000..04392d30553 --- /dev/null +++ b/scripts/build_scripts/create_venv.sh @@ -0,0 +1,23 @@ + +#!/bin/bash +set -eo pipefail + +if [ -z "$PYTHON_ENV_DIR" ]; then + PYTHON_ENV_DIR=$(pwd)/python_env +fi + +echo "Creating virtual env in: $PYTHON_ENV_DIR" +python3 -m venv $PYTHON_ENV_DIR + +source $PYTHON_ENV_DIR/bin/activate + +echo "Setting up virtual env" +python3 -m pip config set global.extra-index-url https://download.pytorch.org/whl/cpu +python3 -m pip install setuptools wheel + +echo "Installing dev dependencies" +python3 -m pip install -r $(pwd)/tt_metal/python_env/requirements-dev.txt + +echo "Installing tt-metal" +pip install -e . +pip install -e ttnn