From 5c6d85e6f3044fa60a0904388e9f5fd8b98a79f1 Mon Sep 17 00:00:00 2001 From: Kevin O'Brien Date: Thu, 2 Jul 2020 01:54:38 -0400 Subject: [PATCH] README change to add info on using prebuilt Docker images (#201) * Add description of prebuilt docker images * example Dockerfile using prebuilt container * vscode config files for Docker example * vscode files for Docker example * vscode files for Docker example * add Dockerfile info * typo * fix bad name for example file doc check failed because file name was incorrect Co-authored-by: Tian Jin --- README.md | 34 ++++++++++++++ .../.vscode/c_cpp_properties.json | 33 ++++++++++++++ docs/docker-example/.vscode/launch.json | 44 +++++++++++++++++++ docs/docker-example/.vscode/settings.json | 5 +++ docs/docker-example/Dockerfile | 19 ++++++++ 5 files changed, 135 insertions(+) create mode 100644 docs/docker-example/.vscode/c_cpp_properties.json create mode 100644 docs/docker-example/.vscode/launch.json create mode 100644 docs/docker-example/.vscode/settings.json create mode 100644 docs/docker-example/Dockerfile diff --git a/README.md b/README.md index 7c78209..bd41385 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,40 @@ The Open Neural Network Exchange implementation in MLIR (http://onnx.ai/onnx-mli | s390-Linux | [![Build Status](https://yktpandb.watson.ibm.com/jenkins/buildStatus/icon?job=ONNX-MLIR-Linux-s390x-Build)](https://yktpandb.watson.ibm.com/jenkins/job/ONNX-MLIR-Linux-s390x-Build/) | | x86-Windows | [![Build Status](https://dev.azure.com/onnx-pipelines/onnx/_apis/build/status/MLIR-Windows-CI?branchName=master)](https://dev.azure.com/onnx-pipelines/onnx/_build/latest?definitionId=9&branchName=master) | +## Prebuilt Container +An easy way to get started with ONNX-MLIR is to use a prebuilt docker image. These images are created as a result of a successful merge build on the trunk. +This means that the latest image represents the tip of the trunk. +Currently there are images for amd64, ppc64le and IBM System Z respectively saved in Docker Hub as onnxmlirczar/onnx-mlir-build:amd64, +onnxmlirczar/onnx-mlir-build:ppc64le and onnxmlirczar/onnx-mlir-build:s390x. To use one of these images either pull it directly from Docker Hub, +launch a container and run an interactive bash shell in it, or use it as the base image in a dockerfile. The container contains the full build tree including +the prerequisites and a clone of the source code. The source can be modified and onnx-mlir rebuilt from within the container, so it is possible to use it +as a development environment. It is also possible to attach vscode to the running container. An example Dockerfile and vscode configuration files can be +seen in the docs folder. The Dockerfile is shown here. + +[same-as-file]: <> (docs/docker-example/Dockerfile) +``` +FROM onnxmlirczar/onnx-mlir-build:amd64 + +WORKDIR /build +ENV HOME=/build +ENV PYENV_ROOT=$HOME/.pyenv +ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH +RUN pyenv global 3.7.0 +RUN pyenv rehash + +ENV PATH=$PATH:/build/bin +RUN apt-get update +RUN apt-get install -y python-numpy +RUN apt-get install -y python3-pip +RUN apt-get install -y gdb +RUN apt-get install -y lldb +RUN apt-get install -y emacs +WORKDIR /build/.vscode +ADD .vscode /build/.vscode +WORKDIR /build + +``` + ## Prerequisites ``` diff --git a/docs/docker-example/.vscode/c_cpp_properties.json b/docs/docker-example/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..6dac5fb --- /dev/null +++ b/docs/docker-example/.vscode/c_cpp_properties.json @@ -0,0 +1,33 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [], + "compilerPath": "/usr/bin/gcc", + "cStandard": "c11", + "cppStandard": "gnu++14", + "intelliSenseMode": "clang-x64" + }, + { + "name": "onnx-mlir-linux", + "includePath": [ + "${workspaceFolder}/**" + ], + "forcedInclude": [ + "${default}" + ], + "defines": [ + "ONNX_ML=1" + ], + "compilerPath": "/usr/bin/gcc", + "compilerArgs": ["-I${workspaceFolder}/llvm-project/mlir/include", "-I${workspaceFolder}/llvm-project/build/tools/mlir/include","-I${workspaceFolder}/llvm-project/include", "-I${workspaceFolder}/llvm-project/build/ßinclude"], + "cStandard": "c11", + "cppStandard": "c++14", + "intelliSenseMode": "${default}" + } + ], + "version": 4 +} diff --git a/docs/docker-example/.vscode/launch.json b/docs/docker-example/.vscode/launch.json new file mode 100644 index 0000000..7248920 --- /dev/null +++ b/docs/docker-example/.vscode/launch.json @@ -0,0 +1,44 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Debug onnx-mlir", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/onnx-mlir/build/bin/onnx-mlir", + "args": ["--EmitONNXIR","exampleop.onnx"], + "stopAtEntry": true, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "preLaunchTask": "", + "miDebuggerPath": "/usr/bin/gdb" + }, + { + "name": "(gdb) Attach", + "type": "cppdbg", + "request": "attach", + "program": "${workspaceFolder}/onnx-mlir/build/bin/onnx-mlir", + "processId": "${command:pickProcess}", + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} diff --git a/docs/docker-example/.vscode/settings.json b/docs/docker-example/.vscode/settings.json new file mode 100644 index 0000000..a71e1eb --- /dev/null +++ b/docs/docker-example/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "*.inc": "cpp" + } +} diff --git a/docs/docker-example/Dockerfile b/docs/docker-example/Dockerfile new file mode 100644 index 0000000..ab92365 --- /dev/null +++ b/docs/docker-example/Dockerfile @@ -0,0 +1,19 @@ +FROM onnxmlirczar/onnx-mlir-build:amd64 + +WORKDIR /build +ENV HOME=/build +ENV PYENV_ROOT=$HOME/.pyenv +ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH +RUN pyenv global 3.7.0 +RUN pyenv rehash + +ENV PATH=$PATH:/build/bin +RUN apt-get update +RUN apt-get install -y python-numpy +RUN apt-get install -y python3-pip +RUN apt-get install -y gdb +RUN apt-get install -y lldb +RUN apt-get install -y emacs +WORKDIR /build/.vscode +ADD .vscode /build/.vscode +WORKDIR /build