Skip to content

Commit

Permalink
Updated build n test script to remove onnx dependency from torch vari…
Browse files Browse the repository at this point in the history
…ants (#3567)

* removed unnecessary && condition that did not default DENABLE_TORCH to OFF when building aimet w/ onnx variant
* edited comments of docker_install.md to add clarity
* shortened docker build extra_opts if statements to be shorter and more readable
* fixed if statment nesting
* fixed typo in torch variant extra_opts concatenation

Signed-off-by: Trentin Wilkens <quic_twilkens@quicinc.com>
  • Loading branch information
quic-twilkens authored Dec 7, 2024
1 parent b3ec5e0 commit 338eb2a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 26 deletions.
40 changes: 15 additions & 25 deletions dobuildntest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -397,40 +397,30 @@ if [ $run_build -eq 1 ]; then
cd $buildFolder

extra_opts=""

if [ -n "$SW_VERSION" ]; then
extra_opts+=" -DSW_VERSION=${SW_VERSION}"
fi
# Add build options based on variant

if [ -n "$AIMET_VARIANT" ]; then
# Add build options based on variant
if [[ "$AIMET_VARIANT" == *"gpu"* ]]; then
extra_opts+=" -DENABLE_CUDA=ON"
fi
if [[ "$AIMET_VARIANT" == *"cpu"* ]]; then
elif [[ "$AIMET_VARIANT" == *"cpu"* ]]; then
extra_opts+=" -DENABLE_CUDA=OFF"
fi
if [[ "$AIMET_VARIANT" == *"tf"* ]]; then
extra_opts+=" -DENABLE_TENSORFLOW=ON"
fi
if [[ "$AIMET_VARIANT" == *"torch"* ]]; then
extra_opts+=" -DENABLE_TORCH=ON"
fi
if [[ "$AIMET_VARIANT" == *"onnx"* ]]; then
extra_opts+=" -DENABLE_ONNX=ON"
fi
if [[ "$AIMET_VARIANT" != *"tf"* ]]; then
extra_opts+=" -DENABLE_TENSORFLOW=OFF"
fi
if [[ "$AIMET_VARIANT" != *"torch"* ]] && [[ "$AIMET_VARIANT" != *"onnx"* ]]; then
extra_opts+=" -DENABLE_TORCH=OFF"
fi
if [[ "$AIMET_VARIANT" != *"onnx"* ]]; then
extra_opts+=" -DENABLE_ONNX=OFF"
fi
if [[ "$AIMET_VARIANT" == "${variant_docs}" ]]; then
#TODO For doc variant, cmake "test" targets are NOT supported at this time
extra_opts+=" -DENABLE_TESTS=OFF"
# explicitly enable ONNX for docs variant since it is not present in variant string
extra_opts+=" -DENABLE_ONNX=ON"
# For doc variant, cmake "test" targets are NOT supported AND we need to enable all frameworks.
extra_opts+=" -DENABLE_TESTS=OFF -DENABLE_TENSORFLOW=ON -DENABLE_TORCH=ON -DENABLE_ONNX=ON"
elif [[ "$AIMET_VARIANT" == *"tf"* ]]; then
extra_opts+=" -DENABLE_TENSORFLOW=ON -DENABLE_TORCH=OFF -DENABLE_ONNX=OFF"
elif [[ "$AIMET_VARIANT" == *"torch"* ]]; then
extra_opts+=" -DENABLE_TENSORFLOW=OFF -DENABLE_TORCH=ON -DENABLE_ONNX=OFF"
elif [[ "$AIMET_VARIANT" == *"onnx"* ]]; then
extra_opts+=" -DENABLE_TENSORFLOW=OFF -DENABLE_TORCH=OFF -DENABLE_ONNX=ON"
else
echo -e "ERROR: Invalid variant string!"
exit 3
fi
fi
# Do not exit on failure by default from this point forward
Expand Down
4 changes: 3 additions & 1 deletion packaging/docker_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ mkdir build && cd build
# To include torch, use -DENABLE_TORCH=ON. To exclude torch, use -DENABLE_TORCH=OFF.
# To include tensorflow, use -DENABLE_TENSORFLOW=ON. To exclude tensorflow, use -DENABLE_TENSORFLOW=OFF.
# To include onnx, use -DENABLE_ONNX=ON. To exclude onnx, use -DENABLE_ONNX=OFF.
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DENABLE_CUDA=ON -DENABLE_TORCH=ON -DENABLE_TENSORFLOW=ON -DENABLE_ONNX=ON
# Add a installation location -DCMAKE_INSTALL_PREFIX="<install_path>"
# Following is an example command for the Torch GPU variant with installation within the current build path. Please modify it as appropriate.
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DENABLE_CUDA=ON -DENABLE_TORCH=ON -DENABLE_TENSORFLOW=OFF -DENABLE_ONNX=OFF -DCMAKE_INSTALL_PREFIX="./staging/universal"

make -j8
```
Expand Down

0 comments on commit 338eb2a

Please sign in to comment.