Skip to content

Commit dd18adb

Browse files
authored
small fixes (#52)
* small fixes * split * toc * update * update * update * executable * 2019.1->2019.2
1 parent 2f9193c commit dd18adb

13 files changed

+276
-139
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ _build
66
model_1
77
model_2
88
model_3
9+
.DS_Store

_toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ chapters:
77
- file: part4_quantization.ipynb
88
- file: part5_bdt.ipynb
99
- file: part6_cnns.ipynb
10-
- file: part7_deployment.ipynb
10+
- file: part7a_bitstream.ipynb
11+
- file: part7b_deployment.ipynb
12+
- file: part7c_validation.ipynb

docker/Dockerfile.vivado

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ RUN mamba clean --all -f -y && \
3232
fix-permissions "/home/${NB_USER}"
3333

3434
LABEL org.opencontainers.image.source https://github.com/fastmachinelearning/hls4ml-tutorial
35+
36+
# ENV XILINX_VIVADO /opt/Xilinx/Vivado/2019.2
37+
COPY docker/start-notebook.sh /usr/local/bin/

docker/start-notebook.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# Copyright (c) Jupyter Development Team.
3+
# Distributed under the terms of the Modified BSD License.
4+
5+
set -e
6+
7+
# setup vivado 2019.2
8+
source /opt/Xilinx/Vivado/2019.2/settings64.sh
9+
10+
# The Jupyter command to launch
11+
# JupyterLab by default
12+
DOCKER_STACKS_JUPYTER_CMD="${DOCKER_STACKS_JUPYTER_CMD:=lab}"
13+
14+
if [[ -n "${JUPYTERHUB_API_TOKEN}" ]]; then
15+
echo "WARNING: using start-singleuser.sh instead of start-notebook.sh to start a server associated with JupyterHub."
16+
exec /usr/local/bin/start-singleuser.sh "$@"
17+
fi
18+
19+
wrapper=""
20+
if [[ "${RESTARTABLE}" == "yes" ]]; then
21+
wrapper="run-one-constantly"
22+
fi
23+
24+
# shellcheck disable=SC1091,SC2086
25+
exec /usr/local/bin/start.sh ${wrapper} jupyter ${DOCKER_STACKS_JUPYTER_CMD} ${NOTEBOOK_ARGS} "$@"

part1_getting_started.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"tf.random.set_seed(seed)\n",
2828
"import os\n",
2929
"\n",
30-
"os.environ['PATH'] = '/opt/Xilinx/Vivado/2019.2/bin:' + os.environ['PATH']"
30+
"os.environ['PATH'] = os.environ['XILINX_VIVADO'] + '/bin:' + os.environ['PATH']"
3131
]
3232
},
3333
{

part2_advanced_config.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"import plotting\n",
2626
"import os\n",
2727
"\n",
28-
"os.environ['PATH'] = '/opt/Xilinx/Vivado/2019.2/bin:' + os.environ['PATH']"
28+
"os.environ['PATH'] = os.environ['XILINX_VIVADO'] + '/bin:' + os.environ['PATH']"
2929
]
3030
},
3131
{

part3_compression.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"tf.random.set_seed(seed)\n",
2929
"import os\n",
3030
"\n",
31-
"os.environ['PATH'] = '/opt/Xilinx/Vivado/2019.2/bin:' + os.environ['PATH']"
31+
"os.environ['PATH'] = os.environ['XILINX_VIVADO'] + '/bin:' + os.environ['PATH']"
3232
]
3333
},
3434
{

part4_quantization.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"tf.random.set_seed(seed)\n",
2929
"import os\n",
3030
"\n",
31-
"os.environ['PATH'] = '/opt/Xilinx/Vivado/2019.2/bin:' + os.environ['PATH']"
31+
"os.environ['PATH'] = os.environ['XILINX_VIVADO'] + '/bin:' + os.environ['PATH']"
3232
]
3333
},
3434
{
@@ -251,7 +251,9 @@
251251
"hls_model.compile()\n",
252252
"\n",
253253
"y_qkeras = model.predict(np.ascontiguousarray(X_test))\n",
254-
"y_hls = hls_model.predict(np.ascontiguousarray(X_test))"
254+
"y_hls = hls_model.predict(np.ascontiguousarray(X_test))\n",
255+
"np.save('model_3/y_qkeras.npy', y_qkeras)\n",
256+
"np.save('model_3/y_hls.npy', y_hls)"
255257
]
256258
},
257259
{

part5_bdt.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"import matplotlib.pyplot as plt\n",
3333
"import os\n",
3434
"\n",
35-
"os.environ['PATH'] = '/opt/Xilinx/Vivado/2019.2/bin:' + os.environ['PATH']\n",
35+
"os.environ['PATH'] = os.environ['XILINX_VIVADO'] + '/bin:' + os.environ['PATH']\n",
3636
"np.random.seed(0)"
3737
]
3838
},

part6_cnns.ipynb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,10 @@
910910
"metadata": {},
911911
"outputs": [],
912912
"source": [
913+
"import os\n",
914+
"\n",
915+
"os.environ['PATH'] = os.environ['XILINX_VIVADO'] + '/bin:' + os.environ['PATH']\n",
916+
"\n",
913917
"synth = False # Only if you want to synthesize the models yourself (>1h per model) rather than look at the provided reports.\n",
914918
"if synth:\n",
915919
" hls_model.build(csim=False, synth=True, vsynth=True)\n",

0 commit comments

Comments
 (0)