Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stellaraccident/e4b0343bec6240c4e96380a027ce5d72 to your computer and use it in GitHub Desktop.
Save stellaraccident/e4b0343bec6240c4e96380a027ce5d72 to your computer and use it in GitHub Desktop.
Ubuntu 18.04 build torch-mlir
docker run --rm -it -v $(pwd):/work ubuntu:18.04 /bin/bash
In container history:
2 apt update
4 apt search clang
5 apt install clang
7 apt install python3
12 apt install python3-pip
13 python3 -m pip install cmake==3.21.3
14 python3 -m pip install ninja
17 cd /work/torch-mlir
21 alias python=python3
22 python --version
23 python -m pip install --upgrade pip
25 python -m pip install --pre torch torchvision pybind11 -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
26 cmake -GNinja -Bbuild -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DPython3_FIND_VIRTUALENV=ONLY -DLLVM_ENABLE_PROJECTS=mlir -DLLVM_EXTERNAL_PROJECTS=torch-mlir -DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR=`pwd` -DMLIR_ENABLE_BINDINGS_PYTHON=ON -DLLVM_TARGETS_TO_BUILD=host external/llvm-project/llvm
28 cmake --build build --target tools/torch-mlir/all
29 cmake --build build --target check-torch-mlir
30 export PYTHONPATH=`pwd`/build/tools/torch-mlir/python_packages/torch_mlir:`pwd`/examples
31 python -m e2e_testing.torchscript.main --filter Conv2d --verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment