-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
64 lines (50 loc) · 1.59 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# check if pytorch is in /opt/pytorch-install
if [ ! -d "/opt/pytorch-install" ]; then
echo "Pytorch not found in /opt/pytorch-install"
# Download pytorch to /opt/pytorch-install
url=https://github.com/rodrigodzf/bela-torch/releases/download/master/pytorch-install.tar.gz
echo "Downloading Pytorch from $url"
wget -O - $url | tar -xz -C /opt
fi
echo "Building Neural Resonator Bela"
cmake -S . -B build \
-DENABLE_PYTORCH_FRONTEND=ON \
-DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake
cmake --build build -j
echo "Copying files to Bela"
# Copy the prebuild Bela libraries
# These libraries are generated when
# the Bela libs are compiled for the image
# However, to minimize the effort of
# compiling them again we just copy them here
# These will only work with the same Bela image
# that was used to build the current image
rsync \
--timeout=10 \
-avzP \
/sysroot/root/Bela/lib/* \
[email protected]:/root/Bela/lib
# Copy the pytorch files
ssh [email protected] "mkdir -p /opt/pytorch-install/lib"
rsync \
--timeout=10 \
-vzP \
/opt/pytorch-install/lib/* \
[email protected]:/opt/pytorch-install/lib
# Copy the executable to Bela
ssh [email protected] "mkdir -p ~/Bela/projects/NeuralResonatorBela"
rsync \
--timeout=10 \
-avzP build/bin/NeuralResonatorBela \
[email protected]:~/Bela/projects/NeuralResonatorBela
# Copy sketch.js to Bela
rsync \
--timeout=10 \
-avzP js/sketch.js \
[email protected]:~/Bela/projects/NeuralResonatorBela
# Copy the ckpt file to Bela
rsync \
--timeout=10 \
-avzP checkpoints/optimized_curious-salad-167.pt \
[email protected]:~/Bela/projects/NeuralResonatorBela