Fix up the docker script / instructions after attempting to use it.

pull/74/head
Sean Silva 2020-10-09 10:21:07 -07:00
parent 631c8070df
commit d6b05c507a
2 changed files with 23 additions and 4 deletions

View File

@ -156,6 +156,8 @@ See `docker_shell_funcs.sh` for commands to modify if different.
```shell ```shell
# Build/start the container. # Build/start the container.
# Follow instructions here to allow running `docker` without `sudo`:
# https://docs.docker.com/engine/install/linux-postinstall/
source ./build_tools/docker_shell_funcs.sh source ./build_tools/docker_shell_funcs.sh
npcomp_docker_build # Only needed first time/on updates to docker files. npcomp_docker_build # Only needed first time/on updates to docker files.
npcomp_docker_start npcomp_docker_start
@ -173,7 +175,16 @@ npcomp_docker_stop
### Configure VSCode: ### Configure VSCode:
Attach to your running container by opening the Docker extension tab (left panel), right clicking on the container name, and selecting "Attach Visual Studio code". First, install the [VSCode Docker
extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) and [VSCode Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension.
Follow instructions here to allow running `docker` without `sudo`,
otherwise VSCode won't be able to use docker
https://docs.docker.com/engine/install/linux-postinstall/
(Note that VSCode has some daemons that you will need to kill/restart for
the instructions there to take effect; consider just rebooting your
machine)
Attach to your running container by opening the Docker extension tab (left panel), right clicking on the container name, and selecting "Attach Visual Studio code". The container name if you are using docker_shell_funcs.sh is `npcomp`.
Install extensions in container: Install extensions in container:
* CMake Tools * CMake Tools

View File

@ -1,3 +1,11 @@
# No shebang, please `source` this file!
# For example, add this to your `.bashrc`:
# ```
# source $WHERE_YOU_CHECKED_OUT_NPCOMP/build_tools/docker_shell_funcs.sh
# ```
td="$(realpath $(dirname "${BASH_SOURCE[0]}")/..)"
# Build the docker images for npcomp: # Build the docker images for npcomp:
# npcomp:build-pytorch-1.6 # npcomp:build-pytorch-1.6
# me/npcomp:build-pytorch-1.6 (additional dev packages and current user) # me/npcomp:build-pytorch-1.6 (additional dev packages and current user)
@ -14,14 +22,14 @@ function npcomp_docker_build() {
# Start a container named "npcomp" in the background with the current-user # Start a container named "npcomp" in the background with the current-user
# dev image built above. # dev image built above.
function npcomp_docker_start() { function npcomp_docker_start() {
local host_src_dir="${1-$HOME/src/mlir-npcomp}" local host_src_dir="${1-$td}"
if ! [ -d "$host_src_dir" ]; then if ! [ -d "$host_src_dir" ]; then
echo "mlir-npcomp source directory not found:" echo "mlir-npcomp source directory not found:"
echo "Pass path to host source directory as argument (default=$host_src_dir)." echo "Pass path to host source directory as argument (default=$host_src_dir)."
return 1 return 1
fi fi
docker volume create npcomp-build docker volume create npcomp-build
docker run -d --rm --name "$container" \ docker run -d --rm --name "npcomp" \
--mount source=npcomp-build,target=/build \ --mount source=npcomp-build,target=/build \
--mount type=bind,source=$host_src_dir,target=/src/mlir-npcomp \ --mount type=bind,source=$host_src_dir,target=/src/mlir-npcomp \
me/npcomp:build-pytorch-1.6 tail -f /dev/null me/npcomp:build-pytorch-1.6 tail -f /dev/null
@ -34,7 +42,7 @@ function npcomp_docker_stop() {
# Get an interactive bash shell to the "npcomp" container. # Get an interactive bash shell to the "npcomp" container.
function npcomp_docker_login() { function npcomp_docker_login() {
docker_execme -it npcomp /bin/bash docker exec --user $USER -it npcomp /bin/bash
} }
### Implementation helpers below. ### Implementation helpers below.