diff options
-rw-r--r-- | README.md | 19 | ||||
-rw-r--r-- | analysis/README.md | 2 | ||||
-rw-r--r-- | flake.lock | 37 | ||||
-rw-r--r-- | flake.nix | 58 | ||||
-rw-r--r-- | nix/configuration.nix | 37 | ||||
-rw-r--r-- | src/README.md | 57 |
6 files changed, 131 insertions, 79 deletions
@@ -11,10 +11,12 @@ Check the `README` in each directory for more information. ## Getting dependencies The easiest way to install the required dependencies is using Nix. -After [installing it](https://nixos.org/download/), simply run `nix develop`. -This environment includes everything necessary for building the program, visualisations, and thesis. +After [installing it](https://nixos.org/download/), simply run one of the two commands below: -You can also build the program itself with `nix build .#default`. + - `nix develop .#full` for a full environment with everything required to build the project, visualisations, and thesis. (approx 3.4G disk space) + - `nix develop .#minimal` for a smaller environment, with only enough to build the project and run tests (approx 1.9G disk space). + +You can also build the program itself with `nix build .#default`, or see below to run a test VM. Alternatively, manually set up the following programs: @@ -27,3 +29,14 @@ Alternatively, manually set up the following programs: - To build the thesis: - Texlive, with the packages listed in `nix/tex-env.nix` - `latexmk` + +Once you have dependencies installed, check the `README` in each directory for details on how to reproduce our results. + +## Building a testing VM + +The VM which we used for testing can be fully rebuilt by running `nix build .#vm`. This requires around 3.1G on disk. + +After building, run `./result/bin/run-candelabra-vm` to start it. +The credentials are `root` / `candelabra`, and you can use SSH if desired. + +The VM has candelabra prebuilt as `candelabra-cli`, but no tools for visualisation or building the thesis. diff --git a/analysis/README.md b/analysis/README.md index c2311e5..d883113 100644 --- a/analysis/README.md +++ b/analysis/README.md @@ -10,7 +10,7 @@ To use new data, first generate some new data locally. In `../src/`: ``` $ just cost-models # approx 10m -$ just comparisons 2>&1 | tee ../analysis/current/log # approx 1hr 30m +$ just selections --compare 2>&1 | tee ../analysis/current/log # approx 1hr 30m ``` We need to also write the log output when comparing since we use this during analysis. To put this data in the right place, in `../analysis`: @@ -38,6 +38,42 @@ "type": "github" } }, + "nixlib": { + "locked": { + "lastModified": 1711846064, + "narHash": "sha256-cqfX0QJNEnge3a77VnytM0Q6QZZ0DziFXt6tSCV8ZSc=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "90b1a963ff84dc532db92f678296ff2499a60a87", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixos-generators": { + "inputs": { + "nixlib": "nixlib", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711932680, + "narHash": "sha256-CEpVtyB7uyRprTuiG+lpWWMvM/C0CbY/dbBuxT5BDwM=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "1f4c32ca4295bb7cca1e48a2f39b65490b249b0b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1709128929, @@ -55,6 +91,7 @@ "root": { "inputs": { "crane": "crane", + "nixos-generators": "nixos-generators", "nixpkgs": "nixpkgs", "rust-overlay": "rust-overlay" } @@ -9,11 +9,16 @@ nixpkgs.follows = "nixpkgs"; }; }; + nixos-generators = { + url = "github:nix-community/nixos-generators"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs @ { self, nixpkgs, + nixos-generators, crane, rust-overlay, }: let @@ -24,33 +29,48 @@ }; tex-env = pkgs.callPackage ./nix/tex-env.nix inputs; racket-env = pkgs.callPackage ./nix/racket-env.nix inputs; + rust-toolchain = pkgs.rust-bin.fromRustupToolchain ((builtins.fromTOML (builtins.readFile ./src/rust-toolchain.toml)).toolchain // {profile = "minimal";}); candelabra = pkgs.callPackage ./nix/candelabra.nix inputs; in rec { - devShells.${system}.default = pkgs.mkShell { - buildInputs = [ - tex-env - racket-env + devShells.${system} = { + minimal = pkgs.mkShell { + buildInputs = [ + rust-toolchain + racket-env + pkgs.just # command runner + pkgs.inotify-tools + ]; + }; + full = pkgs.mkShell { + buildInputs = [ + rust-toolchain + racket-env + pkgs.just # command runner + pkgs.inotify-tools - pkgs.just # command runner - pkgs.biber # bibliography backend - pkgs.inotify-tools + tex-env + pkgs.biber # bibliography backend - pkgs.livebook # datavis - # god is dead - pkgs.nodejs - pkgs.nodePackages.vega-cli - pkgs.nodePackages.vega-lite - ]; + pkgs.livebook # datavis + # god is dead + pkgs.nodejs + pkgs.nodePackages.vega-cli + pkgs.nodePackages.vega-lite + ]; + }; }; - packages.${system}.default = candelabra; + packages.${system} = { + default = candelabra; + vm = nixos-generators.nixosGenerate { + inherit system; + specialArgs = { + inherit inputs tex-env racket-env candelabra; + }; + modules = [./nix/configuration.nix]; - nixosConfigurations.default = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { - inherit inputs tex-env racket-env candelabra; + format = "vm"; }; - modules = [./nix/configuration.nix]; }; }; } diff --git a/nix/configuration.nix b/nix/configuration.nix index 6338c63..39e76a2 100644 --- a/nix/configuration.nix +++ b/nix/configuration.nix @@ -21,14 +21,8 @@ nix = { settings.experimental-features = ["nix-command" "flakes" "ca-derivations"]; - gc = { - automatic = true; - dates = "03:15"; - options = "--delete-older-than 1d"; - }; }; - # Everything below here is just boring machine setup networking.hostName = "candelabra"; networking.useDHCP = lib.mkDefault true; @@ -38,32 +32,17 @@ # SSH Access services.openssh = { enable = true; - settings.PermitRootLogin = "prohibit-password"; + settings.PermitRootLogin = "yes"; }; - users.users.root.openssh.authorizedKeys.keys = [ - "no-touch-required sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIPpKjZfzPN1KxVskFRnmTTCwzyCtjwcXVZc4i1rNfl9oAAAABHNzaDo= me@aria.rip" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPJN58ZzY9WZgaHYlIN6w1RtleaRpcX7gRr4j7m6aHso candelabra" # CI - ]; - - # Boot & filesystems - boot.loader.grub.enable = true; - boot.loader.grub.device = "/dev/sda"; - - boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/b7946a55-0573-4be9-801b-5ca9afc7b3f3"; - fsType = "ext4"; - }; - - swapDevices = [ - {device = "/dev/disk/by-uuid/9101d36f-dba8-4dda-8f4b-8dc8c1d37fe9";} - ]; + users.users.root.password = "candelabra"; + services.getty.autologinUser = "root"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; system.stateVersion = "23.11"; + + system.activationScripts.copy-candelabra-src = '' + echo "copying candelabra source to /root/..."; + cp -r ${../.} /root/candelabra; + ''; } diff --git a/src/README.md b/src/README.md index a2691a3..60ab951 100644 --- a/src/README.md +++ b/src/README.md @@ -7,45 +7,48 @@ First, setup the dependencies as detailed in the root of the repository. Building is done with Cargo as normal: `cargo build`. This places the executable in `./target/debug/candelabra-cli`. +This is not necessary if using the testing VM, and you should replace `cargo run` with `candelabra-cli` in all commands below. + ## Creating cost models -To build and view cost models, first find an implementation to look at: +To build and view a cost model, first pick an implementation to look at: -``` -$ cargo run -- list-library -[...] -Available container implementations: - primrose_library::VecMap - primrose_library::VecSet - std::vec::Vec - std::collections::BTreeSet - std::collections::BTreeMap - primrose_library::SortedVecSet - std::collections::LinkedList - primrose_library::SortedVecMap - primrose_library::SortedVec - std::collections::HashMap - std::collections::HashSet -``` + - primrose_library::VecMap + - primrose_library::VecSet + - std::vec::Vec + - std::collections::BTreeSet + - std::collections::BTreeMap + - primrose_library::SortedVecSet + - std::collections::LinkedList + - primrose_library::SortedVecMap + - primrose_library::SortedVec + - std::collections::HashMap + - std::collections::HashSet -To view the cost model for a single implementation, run `cargo run -- cost-model <impl>`. +To view the cost model for a single implementation, run `just cost-model <impl>`. -Alternatively, run `just cost-model <impl>` to look at a single implementation, or `just cost-models` to view models for all implementations. -The latter will clear the cache before running. +Alternatively, run `just cost-models` to view models for all implementations. +This will clear the cache before running. Cost models are also saved to `target/candelabra/benchmark_results` as JSON files. To analyse your built cost models, copy them to `../analysis/current/candelabra/benchmark_results` and see the README in `../analysis/`. ## Profiling applications -To profile an application in the `tests/` directory and display the results, run `cargo run -- --manifest-path tests/Cargo.toml -p <project> profile`. - -Alternatively, run `just profile <project>`. - +To profile an application in the `tests/` directory and display the results, run `just profile <project>`. Profiling info is also saved to `target/candelabra/profiler_info/` as JSON. ## Selecting containers -To print the estimated cost of using each implementation in a project, run `cargo run -- --manifest-path tests/Cargo.toml -p <project> select`. +To print the estimated cost of using each implementation in a project, run `just select <project>`. +Alternatively, run `just selections` to run selection for all test projects. -Alternatively, run `just select <project>` for a single project, or `just selections` to run selection for all test projects. -You can add `--compare` to any of these commands to also benchmark the project with every assignment of implementations, and print out the results. +You can add `--compare` to either of these commands to also benchmark the project with every assignment of implementations, and print out the results. + +## Running the full test suite + +To run everything we did, from scratch: + +``` +$ just cost-models # approx 10m +$ just selections --compare 2>&1 | tee ../analysis/current/log # approx 1hr 30m +``` |