|
1 |
| -cd ${LLAMA_FAST_ROOT} |
2 |
| -echo "Inside: $LLAMA_FAST_ROOT" |
3 |
| - |
4 |
| -echo "Cloning executorch to ${LLAMA_FAST_ROOT}/build/src" |
5 |
| -rm -rf ${LLAMA_FAST_ROOT}/build |
6 |
| -mkdir -p ${LLAMA_FAST_ROOT}/build/src |
7 |
| -cd ${LLAMA_FAST_ROOT}/build/src |
8 |
| -git clone https://github.com/pytorch/executorch.git |
9 |
| -cd executorch |
10 |
| -echo "Install executorch: submodule update" |
11 |
| -git submodule sync |
12 |
| -git submodule update --init |
13 |
| - |
14 |
| -echo "Applying fixes" |
15 |
| -cp ${LLAMA_FAST_ROOT}/scripts/fixes_et/module.cpp ${LLAMA_FAST_ROOT}/build/src/executorch/extension/module/module.cpp # ET uses non-standard C++ that does not compile in GCC |
16 |
| -cp ${LLAMA_FAST_ROOT}/scripts/fixes_et/managed_tensor.h ${LLAMA_FAST_ROOT}/build/src/executorch/extension/runner_util/managed_tensor.h # ET is missing headers for vector/memory. This causes downstream issues when building runner-et. |
17 |
| - |
18 |
| -echo "Building and installing python libraries" |
19 |
| -if [ -n "${ET_NO_PYBIND}" ]; then |
20 |
| - echo "Not installing pybind" |
21 |
| - ./install_requirements.sh |
22 |
| -else |
23 |
| - echo "Installing pybind" |
24 |
| - ./install_requirements.sh --pybind xnnpack |
25 |
| -fi |
26 |
| - |
27 |
| -echo "Building and installing C++ libraries" |
28 |
| -echo "Inside: ${PWD}" |
29 |
| -mkdir cmake-out |
30 |
| -cmake -DCMAKE_BUILD_TYPE=Release -DEXECUTORCH_BUILD_OPTIMIZED=ON -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON -DEXECUTORCH_BUILD_XNNPACK=ON -S . -B cmake-out -G Ninja |
31 |
| -cmake --build cmake-out |
32 |
| -cmake --install cmake-out --prefix ${LLAMA_FAST_ROOT}/build/install |
| 1 | +#!/bin/bash |
| 2 | +# Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | +# All rights reserved. |
| 4 | +# |
| 5 | +# This source code is licensed under the BSD-style license found in the |
| 6 | +# LICENSE file in the root directory of this source tree. |
| 7 | + |
| 8 | +set -exu |
| 9 | + |
| 10 | +install_pip_dependencies() { |
| 11 | + echo "Intalling common pip packages" |
| 12 | + |
| 13 | + pip install wheel |
| 14 | + pip install cmake |
| 15 | + pip install ninja |
| 16 | + pip install zstd |
| 17 | + pushd ${LLAMA_FAST_ROOT} |
| 18 | + pip install -r ./requirements.txt |
| 19 | + popd |
| 20 | +} |
| 21 | + |
| 22 | +install_executorch() { |
| 23 | + echo "Cloning executorch to ${LLAMA_FAST_ROOT}/build/src" |
| 24 | + rm -rf ${LLAMA_FAST_ROOT}/build |
| 25 | + mkdir -p ${LLAMA_FAST_ROOT}/build/src |
| 26 | + pushd ${LLAMA_FAST_ROOT}/build/src |
| 27 | + git clone https://github.com/pytorch/executorch.git |
| 28 | + cd executorch |
| 29 | + echo "Install executorch: submodule update" |
| 30 | + git submodule sync |
| 31 | + git submodule update --init |
| 32 | + |
| 33 | + echo "Applying fixes" |
| 34 | + cp ${LLAMA_FAST_ROOT}/scripts/fixes_et/module.cpp ${LLAMA_FAST_ROOT}/build/src/executorch/extension/module/module.cpp # ET uses non-standard C++ that does not compile in GCC |
| 35 | + cp ${LLAMA_FAST_ROOT}/scripts/fixes_et/managed_tensor.h ${LLAMA_FAST_ROOT}/build/src/executorch/extension/runner_util/managed_tensor.h # ET is missing headers for vector/memory. This causes downstream issues when building runner-et. |
| 36 | + |
| 37 | + echo "Building and installing python libraries" |
| 38 | + echo "Building and installing python libraries" |
| 39 | + if [ "${ENABLE_ET_PYBIND}" = false ]; then |
| 40 | + echo "Not installing pybind" |
| 41 | + bash ./install_requirements.sh |
| 42 | + else |
| 43 | + echo "Installing pybind" |
| 44 | + bash ./install_requirements.sh --pybind xnnpack |
| 45 | + fi |
| 46 | + pip list |
| 47 | + |
| 48 | + echo "Building and installing C++ libraries" |
| 49 | + echo "Inside: ${PWD}" |
| 50 | + mkdir cmake-out |
| 51 | + cmake -DCMAKE_BUILD_TYPE=Release -DEXECUTORCH_BUILD_OPTIMIZED=ON -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON -DEXECUTORCH_BUILD_XNNPACK=ON -S . -B cmake-out -G Ninja |
| 52 | + cmake --build cmake-out |
| 53 | + cmake --install cmake-out --prefix ${LLAMA_FAST_ROOT}/build/install |
| 54 | + popd |
| 55 | +} |
| 56 | + |
| 57 | + |
| 58 | +ENABLE_ET_PYBIND="${1:-true}" |
| 59 | + |
| 60 | +pushd ${LLAMA_FAST_ROOT} |
| 61 | +install_pip_dependencies |
| 62 | +install_executorch $ENABLE_ET_PYBIND |
| 63 | +popd |
0 commit comments