Skip to content

Commit

Permalink
Move developer instructions to docs/INTERNAL.md from README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
anujkaliaiitd committed Jul 9, 2024
1 parent 29f01d3 commit ecd6dfd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 48 deletions.
30 changes: 1 addition & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,7 @@ The `examples` directory contains detailed scripts/instructions to launch VMs fo

## 2. Get the Docker image


## 2.1. Option 1: With a pre-built Machnet

The pre-built images include support for common NIC models (e.g., public cloud
vNICs, ConnectX, Intel 10/100 GbE).

To use a pre-built image, pull it from Github container registry.
Pulling from GHCR requires an auth token:
Pulling our prebuilt Machnet docker image from GHCR requires an auth token:

1. Generate a Github personal access token for yourself (https://github.com/settings/tokens) with the read:packages scope. and store it in the `GITHUB_PAT` environment variable.
2. At `https://github.com/settings/tokens`, follow the steps to "Configure SSO" for this token.
Expand All @@ -66,27 +59,6 @@ echo ${GITHUB_PAT} | docker login ghcr.io -u <github_username> --password-stdin
docker pull ghcr.io/microsoft/machnet/machnet:latest
```

## 2.2. Option 2: Build the container yourself

## 2.2.1. Using the bake file

The top-level makefile allows building x86 and arm64 docker images across a
variety of microarchitecture capability levels (x86) or SOC targets (arm64).
Invoking "make" will create them for the architecture of the host.

To build a Machnet image for a specific architecture, e.g, x86-64-v4

```bash
$ docker buildx bake -f docker-bake x86-64-v4
```

## 2.2.2. Using docker directly

Using docker directly, you can override the defaults given by the bake file.
Please go over the inputs given to a target by the bakefile and use those as a
starting point; the dockerfiles also contain additional comments on
customization.

## 3. Start the Machnet process on both VMs

Using DPDK often requires unbinding the dedicated NIC from the OS. This will
Expand Down
48 changes: 29 additions & 19 deletions docs/INTERNAL.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,47 @@
This document is for developers of the Machnet service. It is not intended for
users of the Machnet service. For users, see the [README](README.md).

## Compiling Machnet
## Compiling Machnet as a Docker image

[Dockerfile](Dockerfile) is the reference for the required dependencies and the
overall build process. The following instructions follow the same steps as the
Dockerfile.
### Building the standard x86 image

```bash
docker build --no-cache -f dockerfiles/ubuntu-22.04.dockerfile --target machnet .
```

### Building custom images

The top-level makefile allows building x86 and arm64 docker images across a
variety of microarchitecture capability levels (x86) or SOC targets (arm64).
Invoking "make" will create them for the architecture of the host.

To build a Machnet image for a specific architecture, e.g, x86-64-v4

```bash
# On latest Ubuntu:
sudo apt -y install cmake pkg-config nlohmann-json3-dev ninja-build gcc-10 g++-10 doxygen graphviz python3-pip meson libhugetlbfs-dev libnl-3-dev libnl-route-3-dev
pip3 install pyelftools
# This requires a recent Docker version
$ docker buildx bake -f docker-bake x86-64-v4
```

## Manually compiling Machnet from source

For Ubuntu 20.04 we need at least versions `gcc-10`, `g++-10`, `cpp-10`. This step is not required for newer versions of Ubuntu.
```bash
# Set gcc-10 and g++-10 as the default compiler.
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
```
Install required packages
```bash
$ sudo apt -y install cmake pkg-config nlohmann-json3-dev ninja-build gcc g++ doxygen graphviz python3-pip meson libhugetlbfs-dev libnl-3-dev libnl-route-3-dev
$ pip3 install pyelftools
```

For Ubuntu 20.04 we need at least versions `gcc-10`, `g++-10`, `cpp-10`. This step is not required for newer versions of Ubuntu.
```bash
# Install and set gcc-10 and g++-10 as the default compiler.
$ sudo apt install gcc-10 g++-10
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
```

### Build and install rdma-core

```bash
# Remove conflicting packages
RUN apt-get --purge -y remove rdma-core librdmacm1 ibverbs-providers libibverbs-dev libibverbs1
$ RUN apt-get --purge -y remove rdma-core librdmacm1 ibverbs-providers libibverbs-dev libibverbs1
```

Now we install rdma-core from source:
Expand Down Expand Up @@ -68,12 +84,6 @@ The `machnet` binary will be available in `${REPOROOT}/build/src/apps/`. You ma
see more details about the `Machnet` program in this
[README](src/apps/machnet/README.md).

## Docker
```bash
# Build the docker image (from the root of the repository):
docker build --no-cache -f Dockerfile --target machnet .
```

## Tests

To run all tests, from ${REPOROOT}:
Expand Down

0 comments on commit ecd6dfd

Please sign in to comment.