Skip to content

firstbatchxyz/dkn-compute-node

Repository files navigation

logo

Dria Compute Node

Dria Compute Node serves the computation results within Dria Knowledge Network.

License: Apache-2.0 Workflow: Tests Downloads Docker Version Discord

Use the Dria Compute Launcher to run a compute node with many more features!

Releases

For production images:

  • Versioned: With each release, a versioned image is deployed on Docker hub with the version tag :vX.X.X.
  • Latest: The latest production image is always under the :latest tag.

For development images:

  • Master: On each push to master branch, a new image is created with the tag master-<commit>-<timestamp>.
  • Unstable: The latest development image is always under the :unstable tag.

You can see the list of deployed images on Docker Hub.

Development

If you have a feature that you would like to add with respect to its respective issue, or a bug fix, feel free to fork & create a PR!

If you would like to run the node from source (which is really handy during development), you can use our shorthand scripts within the Makefile. You can see the available commands with:

make help

You can run the binary as is:

cargo run

# specify custom .env file
DKN_COMPUTE_ENV=./path/to/.env cargo run

If you have a valid .env file, you can run the latest Docker image via compose as well:

docker compose up

# Ollama without any GPUs
docker compose --profile=ollama-cpu up
# Ollama for NVIDIA gpus
docker compose --profile=ollama-cuda up
# Ollama for AMD gpus
docker compose --profile=ollama-rocm up

Tip

You can specify a custom initial RPC address with DKN_INITIAL_RPC_ADDR.

Testing

You can the tests as follows:

cargo test --workspace

We also have some benchmarking and profiling scripts, see node performance for more details.

Documentation

You can view the entire crate-level documentation with:

cargo doc --open --no-deps --document-private-items

Styling

Lint and format with:

cargo clippy --workspace
cargo fmt -v

Profiling

We have scripts to profile both CPU and Memory usage. A special build is created for profiling, via a custom profiling feature, such that the output inherits release mode but also has debug symbols.

Furthermore, the profiling build will exit automatically after a certain time, as if CTRL+C has been pressed. This is needed by the memory profiling tool in particular.

CPU Profiling: To create a flamegraph of the application, the command below will create a profiling build that inherits release mode, except with debug information:

DKN_EXIT_TIMEOUT=120 cargo flamegraph --root --profile=profiling --bin dkn-compute

Note

CPU profiling may require super-user access.

Memory Profiling: To profile memory usage, we make use of cargo-instruments:

DKN_EXIT_TIMEOUT=120 cargo instruments --profile=profiling -t Allocations --bin dkn-compute

Tip

You can adjust the profiling duration via the DKN_EXIT_TIMEOUT variable, which takes a number of seconds until termination.

License

This project is licensed under the Apache License 2.0.

About

Compute Node of Dria Knowledge Network.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 7

Languages