Skip to content

Latest commit

 

History

History
54 lines (43 loc) · 2.24 KB

README.md

File metadata and controls

54 lines (43 loc) · 2.24 KB

Project Setup with Docker

Build Docker Image

Use the following commands to build a Docker image with a Bitorch Engine installation. This is currently only targeted and tested for CUDA 11.8 or 12.1 and Torch 2.2.x.

# cd docker
# you should be in this `docker` directory
docker build -t bitorch/engine .
# if you do not want to include installation of example requirements, use this instead:
docker build --target no-examples -t bitorch/engine .

After building, the docker image should contain:

  • The selected torch package (limited to those that we modified to support gradients for non-floating-point tensors)
  • A ready-built bitorch engine, and its requirements
  • Everything is installed in a conda environment with Python (currently 3.10)

Build Options

Depending on your setup, you may want to adjust some options through build arguments:

  • CUDA version, e.g. add --build-arg FROM_IMAGE="pytorch/pytorch:2.2.0-cuda12.1-cudnn8-devel" for CUDA 12.1
  • repository URL, e.g. add --build-arg GIT_URL="https://accesstoken:tokenpassword@github.com/MyFork/bitorch-engine.git"
  • Bitorch Engine branch or tag, e.g. add --build-arg GIT_BRANCH="v1.2.3"
  • installing requirements for development, e.g. --build-arg BUILD_TARGET=".[dev]"
  • if there is a problem, set the environment variable BUILDKIT_PROGRESS=plain to see all output

Here is an example:

BUILDKIT_PROGRESS=plain docker build -t bitorch/engine --build-arg BUILD_TARGET=".[dev]" --build-arg GIT_BRANCH="mybranch" .

Run Docker Container

After building the image you can run a container based on it with:

docker run -it --rm --gpus all bitorch/engine:latest

For Development

A docker image without the code cloned, e.g. for mounting a local copy of the code, can be made easily with the target build-ready:

# cd docker
# you should be in this `docker` directory
docker build -t bitorch/engine:build-ready --target build-ready .
docker run -it --rm --gpus all --volume "$(pwd)/..":/bitorch-engine bitorch/engine:build-ready
# in docker container:
cd /bitorch-engine
pip install -e ".[dev]" -v

However, this means the build results will not be persisted in the image, so you probably want to mount the same directory every time.