Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
linfengjun 0c44a5ba2e | 2 years ago | |
---|---|---|
.. | ||
build_fpga_server_docker | 2 years ago | |
build_test_client_docker | 2 years ago | |
README.md | 2 years ago |
We will use an example to explain how a new docker image with desired contents such as your xclbin, your host code etc. can be built. Please note that any accelerator (FPGA) docker image should be derived form the base docker Xilinx image xilinxatg/aws-fpga-verify:20200131 already hosted at the Docker Hub.
To host a docker image, you need some sort of service. You can host it locally if you like (please read online docker instructions for that). However, this instruction uses Docker Hub as the hosting service.
Go to https://hub.docker.com/signup to create a Docker Hub account (if you do not have one already), and then create a docker repository.
In this document, we are using an example docker account named as memo40k and an example repository named as k8s. Please substitute these by your account and repository names respectively. Also, please note that you can set your repository as private if you do not want others to see it.
Step 1: Login to your Docker Hub account
#docker login -u <username> -p <password>
Here we will use our github folder docker/build_fpga_server_docker as an example. In this folder, "server" is a file folder that is to be added into our docker image. It has four files:
File | Description |
---|---|
fpga_algo.awsxclbin | This is the xclbin of the algorithm implemented on FPGA. |
fpga_host_exe | This is the host executable that downloads the xclbin to FPGA and interacts with the FPGA. |
fpga_server.py | This is a representative server program that calls the host executable and has ability to receive command from a client. One can merge this with host executable into one single server program in C++. |
run.sh | This sets environment and calls |
You can add any number of folders with any contents you need for your server to work.
The xilinxatg/aws-fpga-verify:20200131 on docker hub is the base image as mentioned earlier. In this example, the folder server will be added to an example location /opt/xilinx/k8s/ in the docker image.
#touch Dockerfile
create a dockerfile under the same folder with server
#vi Dockerfile
To add following two lines into Dockerfile
FROM xilinxatg/aws-fpga-verify:20200131
COPY docker /opt/xilinx/k8s/server
#docker build -t memo40k/k8s:accelator_pod .
It will build a new docker image called accelerator_pod using the docker file "Dockerfile" under the current folder
#docker images
You can run this command to check whether the new images accelerator_pod was created.
# docker run -it <imageID>
To test the docker image you just created, run the above. You should see the folder server added into the docker image.
#docker push memo40k/k8s:accelator_podk8
You are all set.
Please repeat the steps 2 to 4 with your desired executable contents for the client to create another docker image called test_client_pod. You can use build_test_client_docker as an example.
Use the yaml files: aws-accelator-pod.yaml and aws-test-client-pod.yaml to create accelerator and client pods respectively.
#kubectl create -f aws-accelator-pod.yaml
#kubectl create -f aws-test-client-pod.yaml
After creating the two pods, there will be an accelerator pod with FPGA access, a client pod without FPGA access, an accelerator pod deployment service and a fpga-server-svc network service as shown below.
#kubectl get pod
NAME READY STATUS RESTARTS AGE
accelator-pod-ff67ff8b8-mwff 1/1 Running 0 22h
test-client-pod 1/1 Running 0 23h
#kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
accelator-pod 1/1 1 1 22h
#kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
fpga-server-svc NodePort 10.96.59.3 <none> 8010:31600/TCP 22h
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 14d
#kubectl exec test-client-pod python /opt/xilinx/k8s/client/client.py
Note:
If the status of the accelerator pod shows as pending, please check whether the card is already assigned to another running pod. If so, please delete the running pod and recreate the accelerator pod.
面向多计算场景的一站式融合计算平台
CSS Go SVG Vue Markdown other
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》