Skip to content

Commit

Permalink
add developer container
Browse files Browse the repository at this point in the history
Problem: it is hard to build this for use on a native solution
Solution: create a development container. We intiially targeted a VSCode
devcontainer, but ran into considerable issue that we have not figured out
yet! A good fall-back is to use a basic container that can be provided
via an automated build.

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Jun 17, 2023
1 parent 4852a48 commit e32a851
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: build PerfFlowAspect

on:

# Publish packages on release
release:
types: [published]

# We might want to remove this, OR provide a base container
# that will more quickly build from, or use cache
pull_request: []

# On push to main we build and deploy images
push:
branches:
- main

jobs:
build:
env:
container: ghcr.io/flux-framework/perf-flow-aspect
permissions:
packages: write

runs-on: ubuntu-latest
name: Build
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Pull Layers
run: docker pull ${{ env.container }}:latest || echo "No layers to pull"

- name: Build Container
run: docker build -t ${{ env.container }}:latest .

- name: GHCR Login
if: (github.event_name != 'pull_request')
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Tag and Push Release Image
if: (github.event_name == 'release')
run: |
tag=${GITHUB_REF#refs/tags/}
echo "Tagging and releasing ${{ env.container }}:${tag}"
docker tag ${{ env.container }}:latest ${{ env.container }}:${tag}
docker push ${{ env.container }}:${tag}
- name: Deploy
if: (github.event_name != 'pull_request')
run: docker push ${{ env.container }}:latest
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM ubuntu:20.04

LABEL maintainer="Vanessasaurus <@vsoch>"

# docker build -t perf-flow-aspect .

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y clang llvm-dev libjansson-dev libssl-dev wget bison flex make cmake python3 python3-pip llvm-12 && \
apt-get install -y mpich sudo pciutils

RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin && \
mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 && \
wget https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda-repo-ubuntu2004-12-1-local_12.1.0-530.30.02-1_amd64.deb && \
dpkg -i cuda-repo-ubuntu2004-12-1-local_12.1.0-530.30.02-1_amd64.deb && \cp /var/cuda-repo-ubuntu2004-12-1-local/cuda-*-keyring.gpg /usr/share/keyrings/ && \
apt-get update && \
apt-get -y install cuda && \
ln -s -T /usr/bin/make /usr/bin/gmake

ENV PATH=/usr/local/cuda-12.1/bin:$PATH

# Python helpers
RUN python3 -m pip install --upgrade pip pytest setuptools flake8 rstfmt black

# Install PerfFlowAspect to /usr (so root sees it too)
WORKDIR /code
COPY . /code
RUN cd src/c && \
mkdir -p build install && \
cd build && \
cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_INSTALL_PREFIX=/usr -DLLVM_DIR=/usr/lib/llvm-10/cmake .. && \
cmake ${CMAKE_OPTS} .. && \
make VERBOSE=1 && \
make install

53 changes: 53 additions & 0 deletions docs/developer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
PerfFlowAspect Development
==========================

This is a short developer guide for using the included development environment.
While we do not provide VSCode (there was `a bug we could not figure out <https://github.com/flux-framework/PerfFlowAspect/issues/112>`_) we provide a Dockerfile
that makes it easy to build and use PerfFlow!

Building Container
------------------

You can build the container from scratch:


.. code-block:: console
$ docker build -t ghcr.io/flux-framework/perf-flow-aspect .
Note that for a faster build (or no build!), you can pull or use an existing container:


.. code-block:: console
$ docker pull ghcr.io/flux-framework/perf-flow-aspect
To shell into the container:

.. code-block:: console
$ docker run -it ghcr.io/flux-framework/perf-flow-aspect
Once inside, you can cd to where the tests are, and run a few!


.. code-block:: console
cd src/c/build/test
./t0001-cbinding-basic.t
Note that if you don't have a GPU, these probably will error (I do not)!
Here is how to run Python tests:


.. code-block:: console
cd src/python/test
./t0001-pybinding-basic.t
You'll again have issues without an actual GPU.
And that's it! Note that we will update this documentation as we create more examples.

0 comments on commit e32a851

Please sign in to comment.