Build Your Own Binary
Compiling the binary yourself is an excellent way to use the Allocation Optimizer. You should use this route if a couple of reasons speak to you.
- You'd prefer not to trust a random binary off the internet.
- You have added your own features to the Allocation Optimizer, but would prefer the large, one-time cost of AOT compilation as opposed the small, every-time cost of JIT compilation.
In this documentation, we'll take you through the process of generating an app binary.
You can instead compile to a sysimage or to a library, but we don't natively support those ourselves. Look through the PackageCompiler documentation for steps if you would prefer one of those options..
Install Julia! We prefer to use juliaup
. You can install this via:
curl -fsSL https://install.julialang.org | sh
As of writing this documentation, the latest version of Julia is v1.10. This the version the Allocation Optimizer currently uses, and the version juliaup
will install by default. If juliaup
begins to use v1.11, then you may need to use juliaup
to manually install v1.11 via juliaup add 1.10
. Then, you can either set the default to be v1.10 using juliaup default 1.10
, or you can replace every time you see julia
with julia +1.10
below.
Clone this repository and cd
into it.
git clone https://github.com/graphprotocol/allocation-optimizer.git
cd allocation-optimizer
Start Julia.
julia --project
Install the dependencies
julia> ]
pkg> instantiate
Install a C-compiler such as GCC or Clang.
From the Julia REPL (the TUI that comes up when you use julia --project
), compile your app.
julia> using PackageCompiler
julia> create_app(".", "app")
If you are still in Pkg mode, pkg>
, hitting backspace will bring you back into the REPL.
Set up your configuration file. See Configuration for details.
Run the binary pointing at the configuration TOML that you would like to use.
./app/bin/AllocationOpt /path/to/your_config.toml