Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 47 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,49 @@ defines a subset of the vAccel API.

### building

To build, first clone the repo and its submodules:
To build, first clone the repo:

```bash
git clone https://github.com/nubificus/python-vaccel --recursive
git clone https://github.com/nubificus/python-vaccel
```

#### vAccelRT

In order to build the python bindings for vAccel, we first need to build vAccelRT:
In order to build the python bindings for vAccel, we first need a vAccelRT
installation. We can either build it from source, or get the latest binary
release:

##### Build from source

```bash
cd libs/vaccelrt
mkdir -p libs
git clone https://github.com/cloudkernels/vaccelrt --recursive
cd vaccelrt
mkdir build
cd build
cmake -DBUILD_PLUGIN_NOOP=yes -DCMAKE_INSTALL_PREFIX=../../install ../
cmake -DBUILD_PLUGIN_NOOP=yes -DCMAKE_INSTALL_PREFIX=/usr/local ../
make
make install
cd ../../../
```

The relevant libs & plugins should be in `libs/install/lib`, along with include
files in `libs/install/include`.
The relevant libs & plugins should be in `/usr/local/lib`, along with include
files in `/usr/local/include`.

#### helper lib
##### Get the binary release:

Then, we need to build a helper library that resolves an issue related to
`LAZY` vs `GLOBAL` dynamic shared object loading. So, at the top level
directory of this repo, run:
We currently build vaccelrt as a `deb` package, installable in `/usr/local/`.
Get the latest deb:

```bash
make
```
wget https://s3.nbfc.io/nbfc-assets/github/vaccelrt/master/x86_64/Release-deb/vaccel-0.5.0-Linux.deb
```

to build `libvaccel-python.so` and place it in `libs/install/lib`.
and install it:

```
dpkg -i vaccel-0.5.0-Linux.deb
```

#### python bindings

Expand All @@ -60,18 +69,38 @@ python3 builder.py
The module should be ready. To test run:

```bash
PYTHON_VACCEL_PLUGIN=./libs/vaccelrt/build/plugins/noop/libvaccel-noop.so LD_LIBRARY_PATH=./libs/install/lib PYTHONPATH=$PYTHONPATH:. python3 vaccel/test.py
export VACCEL_BACKENDS=/usr/local/lib/libvaccel-noop.so
export LD_LIBRARY_PATH=/usr/local/lib
export PYTHONPATH=$PYTHONPATH:.
python3 vaccel/test.py
```
Alternatively, you could build the pip package:

```
pip3 install build
python3 -m build
```

and install it:

```
pip install dist/vaccel*.tar.gz
```

## Test

To run the tests:

```bash
# Run tests
PYTHON_VACCEL_PLUGIN=./libs/vaccelrt/build/plugins/noop/libvaccel-noop.so LD_LIBRARY_PATH=./libs/install/lib PYTHONPATH=$PYTHONPATH:. pytest
export VACCEL_BACKENDS=/usr/local/lib/libvaccel-noop.so
export LD_LIBRARY_PATH=/usr/local/lib
export PYTHONPATH=$PYTHONPATH:.
pytest


# Test coverage
PYTHON_VACCEL_PLUGIN=./libs/vaccelrt/build/plugins/noop/libvaccel-noop.so LD_LIBRARY_PATH=./libs/install/lib PYTHONPATH=$PYTHONPATH:. pytest --cov=vaccel tests/
export VACCEL_BACKENDS=/usr/local/lib/libvaccel-noop.so
export LD_LIBRARY_PATH=/usr/local/lib
export PYTHONPATH=$PYTHONPATH:.
pytest --cov=vaccel tests/
```
Loading