为了兼容 fpgaconf -b 00 -d 04 -f 1 xxx.bin

重新实现

#!/bin/bash
B=${}
D=${}
F=${}
BDF=${B##0x}:${D##0x}.${F##0x}
FILE=${%.*}.aocx
mv "$7" "$FILE"
DEVPATH=/sys/devices/pci0000:/*/0000:$BDF/fpga/
echo "Try to find $DEVPATH"
if [ -d $DEVPATH ]
then
ACL=`ls $DEVPATH`
ACL=${ACL##intel-fpga-dev.}
echo "FIND FPGA device: acl$ACL"
else
echo "Can not find FPGA device: $BDF"
exit 1
fi
PRE="/home/centos"
source $PRE/intelrtestack/init_env.sh
export CL_CONTEXT_COMPILER_MODE_ALTERA=3
export CL_CONTEXT_COMPILER_MODE_INTELFPGA=3
export INTELFPGAOCLSDKROOT="$PRE/intelrtestack/intelFPGA_pro/aclrte-linux64"
export ALTERAOCLSDKROOT="$INTELFPGAOCLSDKROOT"
export AOCL_BOARD_PACKAGE_ROOT="$OPAE_PLATFORM_ROOT/opencl/opencl_bsp"
$AOCL_BOARD_PACKAGE_ROOT/linux64/libexec/setup_permissions.sh
source $INTELFPGAOCLSDKROOT/init_opencl.sh
echo "Start to program by aocl ==========================================="
echo " aocl program acl$ACL $7"
aocl program acl$ACL $FILE > /tmp/intel_aocl_program.log 2>&1
exit $? export IE_INSTALL="/opt/intel/computer_vision_sdk_fpga_2018.3.343/deployment_tools"
source $IE_INSTALL/../bin/setupvars.sh
export PATH="$PATH:$PRE/inference_engine_samples/intel64/Release"
alias mo="python3.6 $IE_INSTALL/model_optimizer/mo.py"

cyborg 烧写的command

acc-get

curl -g -X GET http://localhost/accelerator/v1/accelerators/deployables \
-H "Content-Type: application/json" -H "Accept: application/json" \
-H "X-Auth-Token: $(openstack token issue -f value -c id)" \
|python -m json.tool |grep '"uuid":' | tail -n |cut -d '"' -f

acc-program

curl -s -g -X PATCH http://localhost/accelerator/v1/accelerators/deployables/$UUID/program \
-H "Content-Type: application/json" -H "Accept: application/json" \
-H "X-Auth-Token: $(openstack token issue -f value -c id)" \
-d "[{
\"path\": \"/program\",
\"op\": \"replace\",
\"value\": [{
\"image_uuid\": \"$IMGUUID\"
}]
}]" | python -m json.tool

acc-show

curl -g -s -X GET http://localhost/accelerator/v1/accelerators/deployables \
-H "Content-Type: application/json" -H "Accept: application/json" \
-H "X-Auth-Token: $(openstack token issue -f value -c id)" |python -m json.tool

create-img

openstack image create --file $FILE --property vendor=intel --property type=resnet --tag INTEL --tag FPGA $IMGNAME

cyborg-env

export FILE="/opt/intel/computer_vision_sdk_fpga_2018.3.343/a10_dcp_bitstreams/2-0-1_RC_FP11_ResNet.aocx"
export IMGNAME=ResNetForObama
echo "source ~/devstack/openrc admin admin"

image-get

openstack image list |grep $IMGNAME | awk -F'| ' '{print $2}'

image-list

openstack image list
05-11 16:26