Skip to content

Commit 4ff8fca

Browse files
author
Dmitry Rozhkov
authored
Merge pull request #413 from bart0sh/PR0085-add-fpga-preprogrammed-screencast
FPGA demo: add screencast for preprogrammed mode
2 parents 6afddb4 + bf66be9 commit 4ff8fca

File tree

3 files changed

+194
-15
lines changed

3 files changed

+194
-15
lines changed

demo/readme.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,29 @@ Only one worker node has a GPU. The time difference in transcoding speed is capt
5353
## Intel® FPGA Device Plugin demo videos
5454

5555
The screencasts demonstrate the deployment of the Intel® FPGA Device Plugin for
56-
Kubernetes. Demo 1 executes a native loopback 3 (NLB3) workload, and demo 2 runs an [OpenCL workload](https://www.intel.com/content/www/us/en/programmable/support/support-resources/design-examples/design-software/opencl/matrix-multiplication.html) to do English letters recognition, and compares time used with and without FPGA to show the acceleration. The demos begin
57-
with a fully [configured Kubernetes cluster](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/)
58-
with the [Go runtime](https://golang.org/doc/install).
56+
Kubernetes.
5957

60-
### Demo 1 (NLB3) platform configuration
58+
- Demo 1 executes a native loopback 3 (NLB3) workload in preprogrammed mode
59+
- Demo 2 executes NLB3 workload in orchestrated mode
60+
- Demo 3 runs an [OpenCL workload](https://www.intel.com/content/www/us/en/programmable/support/support-resources/design-examples/design-software/opencl/matrix-multiplication.html) to do English letters recognition, and compares time used with and without FPGA to show the acceleration.
61+
62+
The demos begin with a fully [configured Kubernetes cluster](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/).
63+
64+
### Demo 1 and 2 (NLB3) platform configuration
6165

6266
- Hardware
63-
- 1-node, 2x Intel@ Xeon@ Gold 6140M CPU @ 2.30GHz
64-
- Total memory 377 GB
65-
- Intel® Arria® 10 GX FPGA
67+
- 1-node, Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
68+
- Total memory 62 GB
69+
- 2 x Intel® Arria® 10 GX FPGA Programmable Acceleration Card(PAC)
6670
- Software
67-
- Ubuntu 18.04.2 LTS (Kernel: 4.15.0-60-generic)
68-
- Kubernetes* 1.13
69-
- CRI-O 1.13.1
71+
- openSUSE Leap 15.1 (Kernel: 5.4.5-1.g47eef04-default)
72+
- Kubernetes* 1.17
73+
- CRI-O 1.13.1 (for orchestrated mode)
74+
- Docker 19.03.1 (for preprogrammed mode)
75+
- runc 1.0.0-rc8
7076
- Intel® FPGA Device Plugin built from master branch
7177

72-
### Demo 2 (OpenCL) platform configuration
78+
### Demo 3 (OpenCL) platform configuration
7379

7480
- Hardware
7581
- Multi-node, FPGA host has 24 cores Intel(R) Xeon(R) Gold 6252N CPU @ 2.30GHz
@@ -86,17 +92,21 @@ with the [Go runtime](https://golang.org/doc/install).
8692
1. Validate the status of the [Kubernetes cluster](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/).
8793
2. Clone the [Intel Device Plugins for Kubernetes source](https://github.com/intel/intel-device-plugins-for-kubernetes).
8894
3. Provision the [admission controller webhook](https://github.com/intel/intel-device-plugins-for-kubernetes/blob/master/cmd/fpga_admissionwebhook/README.md).
89-
4. Provision the [Intel® FPGA Device Plugin](https://github.com/intel/intel-device-plugins-for-kubernetes/blob/master/cmd/fpga_plugin/README.md).
90-
5. Build the opae-nlb-demo or fpga-opencl-centos image
95+
4. Create bitstream storage (for orchestrated mode only)
96+
5. Provision the [Intel® FPGA Device Plugin](https://github.com/intel/intel-device-plugins-for-kubernetes/blob/master/cmd/fpga_plugin/README.md).
9197
6. Run the NLB3 or OpenCL workload.
9298

9399
### Screencasts
94100

95-
Intel® FPGA Device Plugin deployment with orchestrated/region mode and NLB workload:
101+
- Intel® FPGA Device Plugin deployment in preprogrammed mode
102+
103+
[<img src="https://asciinema.org/a/78iLCNz4W344vm4oSrDuJ6g6i.svg" width="700">](https://asciinema.org/a/78iLCNz4W344vm4oSrDuJ6g6i)
104+
105+
- Intel® FPGA Device Plugin deployment with orchestrated/region mode and NLB workload:
96106

97107
[<img src="https://asciinema.org/a/JuYzNxx9n0eQ1vQBzy86GYBki.svg" width="700">](https://asciinema.org/a/JuYzNxx9n0eQ1vQBzy86GYBki)
98108

99-
Intel® FPGA Device Plugin deployment with orchestrated/region mode and OpenCL workload:
109+
- Intel® FPGA Device Plugin deployment with orchestrated/region mode and OpenCL workload:
100110

101111
[<img src="https://asciinema.org/a/344184.svg" width="700">](https://asciinema.org/a/344184)
102112

demo/screencast-fpga-preprogrammed.sh

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
#!/bin/bash -e
2+
3+
PV='pv -qL'
4+
5+
# check if FPGA devices exist
6+
if [ -d /sys/class/fpga ] ; then
7+
DRIVER=OPAE
8+
DEVICE_PREFIX=/dev/intel-fpga-port
9+
elif [ -d /sys/class/fpga_region ] ; then
10+
DRIVER=DFL
11+
DEVICE_PREFIX=/dev/dfl-port
12+
else
13+
>&2 echo 'ERROR: FPGA devices not found or kernel drivers not loaded'
14+
exit 1
15+
fi
16+
17+
command()
18+
{
19+
speed=$2
20+
[ -z "$speed" ] && speed=10
21+
22+
echo "> $1" | $PV $speed
23+
sh -c "$1"
24+
echo | $PV $speed
25+
}
26+
27+
out()
28+
{
29+
speed=$2
30+
[ -z "$speed" ] && speed=10
31+
32+
echo "$1" | $PV $speed
33+
echo | $PV $speed
34+
}
35+
36+
cleanup()
37+
{
38+
clear
39+
out 'Cleanup demo artifacts' 200
40+
command 'kubectl delete pod test-fpga-preprogrammed || true' 200
41+
command 'kubectl delete -f plugins/deployments/fpga_admissionwebhook/mappings-collection.yaml || true' 200
42+
command 'kubectl delete -k plugins/deployments/fpga_admissionwebhook/default || true' 200
43+
command './plugins/scripts/deploy-fpgaplugin.sh cleanup' 200
44+
command 'kubectl annotate node --all fpga.intel.com/device-plugin-mode-' 200
45+
command 'rm -rf plugins' 200
46+
}
47+
48+
record()
49+
{
50+
clear
51+
out 'Record this screencast'
52+
command "asciinema rec -t 'Intel FPGA Device Plugin for Kubernetes in preprogrammed mode with $DRIVER kernel driver.' Intel-FPGA-Device-Plugin-for-Kubernetes-preprogrammed-$DRIVER-Demo.cast -c 'sh ./screencast-fpga-preprogrammed.sh play'" 300
53+
}
54+
55+
screen1()
56+
{
57+
clear
58+
out "This screencast demonstrates deployment of the Intel FPGA Plugin for Kubernetes in preprogrammed mode with $DRIVER kernel driver"
59+
out "Let's get started!"
60+
out '1. Check if Kubernetes node is in good shape:'
61+
command 'kubectl get nodes'
62+
command 'kubectl get pods -n kube-system'
63+
sleep 2
64+
out 'Check if cert-manager is running:'
65+
command 'kubectl get pods -n cert-manager'
66+
sleep 2
67+
out 'Check if docker is running k8s pods:'
68+
command 'docker ps --format "table {{.Names}}"'
69+
sleep 2
70+
}
71+
72+
screen2()
73+
{
74+
clear
75+
rm -rf plugins
76+
out '2. Clone Intel Device Plugins for Kubernetes repository'
77+
command "git clone https://github.com/intel/intel-device-plugins-for-kubernetes plugins" 15
78+
}
79+
80+
screen3()
81+
{
82+
clear
83+
out '3. Deploy admission controller webhook'
84+
command 'kubectl apply -k plugins/deployments/fpga_admissionwebhook/default'
85+
sleep 3
86+
out 'Deploy example mappings:'
87+
command 'kubectl apply -f plugins/deployments/fpga_admissionwebhook/mappings-collection.yaml'
88+
sleep 3
89+
out 'Check if webhook pod is running:'
90+
command 'kubectl get pods -n intelfpgawebhook-system'
91+
sleep 2
92+
out 'Check its logs:'
93+
command "kubectl logs $(kubectl get pods -n intelfpgawebhook-system| grep intelfpgawebhook-controller-manager | awk '{print $1}') -n intelfpgawebhook-system"
94+
sleep 2
95+
}
96+
97+
screen4()
98+
{
99+
clear
100+
out '5. Deploy FPGA plugin'
101+
command './plugins/scripts/deploy-fpgaplugin.sh'
102+
sleep 4
103+
out 'Check if its pod is runnning:'
104+
command 'kubectl get pod | grep intel-fpga-plugin'
105+
sleep 2
106+
out 'Check if resource fpga.intel.com/af-<af id> is allocatable:'
107+
command 'kubectl describe node |grep -A4 Allocatable'
108+
sleep 2
109+
}
110+
111+
screen5()
112+
{
113+
clear
114+
out '6. Run OPAE workload that uses NLB3 bitstream'
115+
out 'Check if devices are programmed with NLB3:'
116+
command 'cat /sys/class/*/*/*/afu_id'
117+
out 'Run workload:'
118+
command 'cat plugins/demo/test-fpga-preprogrammed.yaml'
119+
command 'kubectl create -f plugins/demo/test-fpga-preprogrammed.yaml'
120+
sleep 5
121+
out 'Look at the test output'
122+
command 'kubectl logs test-fpga-preprogrammed'
123+
}
124+
125+
screen6()
126+
{
127+
clear
128+
out 'Summary:' 15
129+
out "This screencast demonstrated 'Preprogrammed' use case for FPGA:" 15
130+
out ' - FPGA device was already programmed with NLB3 bitstream' 15
131+
out ' - desired bitstream resource was specified in the pod spec as fpga.intel.com/arria10.dcp1.2-nlb3-preprogrammed' 15
132+
out ' - the machinery mapped fpga.intel.com/arria10.dcp1.2-nlb3-preprogrammed into the pair of region id/AFU id using admission controller webhook' 15
133+
out
134+
out 'More detailed information about Intel Device Plugins can be found at https://github.com/intel/intel-device-plugins-for-kubernetes' 15
135+
}
136+
137+
if [ "$1" == 'play' ] ; then
138+
if [ -n "$2" ] ; then
139+
screen$2
140+
else
141+
for n in $(seq 6) ; do screen$n ; sleep 3; done
142+
fi
143+
elif [ "$1" == 'cleanup' ] ; then
144+
cleanup
145+
elif [ "$1" == 'record' ] ; then
146+
record
147+
else
148+
echo 'Usage: screencast-fpga-preprogrammed.sh [--help|help|-h] | [play [<screen number>]] | [cleanup] | [record]'
149+
fi

demo/test-fpga-preprogrammed.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: test-fpga-preprogrammed
5+
spec:
6+
containers:
7+
- name: test-container
8+
image: intel/opae-nlb-demo:devel
9+
imagePullPolicy: IfNotPresent
10+
securityContext:
11+
capabilities:
12+
add:
13+
[IPC_LOCK]
14+
resources:
15+
limits:
16+
fpga.intel.com/arria10.dcp1.2-nlb3-preprogrammed: 1
17+
cpu: 1
18+
hugepages-2Mi: 20Mi
19+
20+
restartPolicy: Never

0 commit comments

Comments
 (0)