forked from M-Labs/nac3
1
0
Fork 0

flake: use nac3devices example for PGO

This commit is contained in:
Sebastien Bourdeauducq 2022-04-18 23:57:57 +08:00
parent 05be5e93c4
commit 2777a6e05f
2 changed files with 43 additions and 6 deletions

View File

@ -18,7 +18,28 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"sipyco": "sipyco"
}
},
"sipyco": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1649724535,
"narHash": "sha256-15Nun4EY35j+6SPZkjzZtyH/ncxLS60KuGJjFh5kSTc=",
"owner": "m-labs",
"repo": "sipyco",
"rev": "939f84f9b5eef7efbf7423c735d1834783b6140e",
"type": "github"
},
"original": {
"owner": "m-labs",
"repo": "sipyco",
"type": "github"
} }
} }
}, },

View File

@ -2,8 +2,10 @@
description = "The third-generation ARTIQ compiler"; description = "The third-generation ARTIQ compiler";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11; inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11;
inputs.sipyco.url = github:m-labs/sipyco;
inputs.sipyco.inputs.nixpkgs.follows = "nixpkgs";
outputs = { self, nixpkgs }: outputs = { self, nixpkgs, sipyco }:
let let
pkgs = import nixpkgs { system = "x86_64-linux"; }; pkgs = import nixpkgs { system = "x86_64-linux"; };
in rec { in rec {
@ -81,11 +83,25 @@
); );
nac3artiq-profile = pkgs.stdenvNoCC.mkDerivation { nac3artiq-profile = pkgs.stdenvNoCC.mkDerivation {
name = "nac3artiq-profile"; name = "nac3artiq-profile";
src = self; src = pkgs.fetchFromGitHub {
buildInputs = [ (python3-mimalloc.withPackages(ps: [ ps.numpy nac3artiq-instrumented ])) pkgs.lld_13 pkgs.llvmPackages_13.libllvm ]; owner = "m-labs";
repo = "artiq";
rev = "dd57fdc530baf926a5f354dc1c2bd90564affd96";
sha256 = "sha256-hcqVcToYWkc3oDFkKr9wZUF65ydiSYVHdmiGiu2Mc1c=";
};
buildInputs = [
(python3-mimalloc.withPackages(ps: [ ps.numpy ps.jsonschema sipyco.packages.x86_64-linux.sipyco nac3artiq-instrumented ]))
pkgs.lld_13
pkgs.llvmPackages_13.libllvm
];
phases = [ "buildPhase" "installPhase" ]; phases = [ "buildPhase" "installPhase" ];
# TODO: get more representative code. buildPhase =
buildPhase = "python $src/nac3artiq/demo/demo.py"; ''
export PYTHONPATH=$src
python -m artiq.frontend.artiq_ddb_template $src/artiq/examples/nac3devices/nac3devices.json > device_db.py
cp $src/artiq/examples/nac3devices/nac3devices.py .
python -m artiq.frontend.artiq_compile nac3devices.py
'';
installPhase = installPhase =
'' ''
mkdir $out mkdir $out