Home > Article > Operation and Maintenance > How to use f1 RTL after rules have been added to the security group to allow access to the SSH port
This article introduces how to use f1 RTL after adding rules in the security group to allow access to the SSH port, and focuses on the specific steps. The content of this article is very compact, and I hope you will study patiently.
Using f1 RTL
This article describes how to use f1 RTL (Register Transfer Level).
Note:
All operations described in this article must be performed by the same account and in the same region.
It is strongly recommended that you use RAM users to operate FaaS instances. To prevent accidental operations, you need to let RAM users perform only necessary operations. When operating FPGA images and downloads, because you need to download the original DCP project from the specified OSS Bucket, you must create a role for the FaaS management account and grant temporary permissions to allow the FaaS management account to access the specified OSS Bucket. If IP encryption is required, the RAM user must be granted KMS-related permissions. If permission checking is required, permission to view user resources must be granted.
Prerequisites
Create an f1 instance, ensure that the instance can access the public network, and rules have been added to the security group where the instance is located to allow SSH (22 ) port access.
Note: f1 instances can only use the FaaS F1 base image from the image market. For details, see Creating an f1 Instance.
You have logged in to the ECS management console and obtained the instance ID on the details page of the f1 instance.
You must first activate the OSS service and create an OSS Bucket to upload your files. Bucket and f1 instance must belong to the same account and the same region.
If you need encryption services, you also need to activate Key Management Service (KMS).
To use a RAM user to operate the FPGA, you must complete the following operations:
Create a RAM user and authorize it.
Create RAM role and authorize it.
Get AccessKey ID and AccessKey Secret.
Operation steps
Follow the following steps to use f1 RTL.
Step 1. Remotely connect to the f1 instance
Remotely connect to the Linux instance.
Step 2. Configure the basic environment
Run the following script to configure the basic environment.
source /opt/dcp1_0/script/f1_env_set.sh
Step 3. Compile the project
Run the following command:
cd /opt/dcp1_0/hw/samples/dma_afu run.sh
Note: The compilation time is long, please wait patiently.
Step 4. Make a mirror
Follow the following steps to make a mirror:
Run the command to initialize faascmd.
#如果需要,添加环境变量及运行权限 export PATH=$PATH:/opt/dcp1_0/script/ chmod +x /opt/dcp1_0/script/faascmd # 将hereIsYourSecretId替换为您的AccessKey ID,hereIsYourSecretKey替换为您的AccessKey Secret faascmd config --id=hereIsYourSecretId --key=hereIsYourSecretKey # 将hereIsYourBucket换为华东1地域里OSS Bucket名称 faascmd auth --bucket=hereIsYourBucket
Confirm that in the /opt/dcp1_0/hw/samples/dma_afu directory, run the following command to upload the gbs file.
faascmd upload_object --object=dma_afu.gbs --file=dma_afu.gbs
Run the following command to create an image.
# 将hereIsYourImageName替换为您的镜像名称 faascmd create_image --object=dma_afu.gbs --fpgatype=intel --name=hereIsYourImageName --tags=hereIsYourImageTag --encrypted=false --shell=V0.11
Step 5. Download the image
Follow the following steps to download the image to the f1 instance:
Check whether the image is successfully created: run the command faascmd list_images .
If "State":"success" appears in the returned result, it means that the image was successfully created. Please record the FpgaImageUUID displayed in the returned result, which will be used later.
Run the command to get the FPGA ID.
# 将hereIsYourInstanceId替换为您的f1实例ID faascmd list_instances --instanceId=hereIsYourInstanceId
The following are the returned results. Please record the FpgaUUID.
Run the command to download the FPGA image to the f1 instance.
# 将hereIsYourInstanceID替换为刚刚保存的实例ID;将hereIsFpgaUUID替换为上一条命令中记下的FpgaUUID;将hereIsImageUUID
Replace with the FpgaImageUUID noted in the previous step
faascmd download_image --instanceId=hereIsYourInstanceID --fpgauuid=hereIsFpgaUUID --fpgatype=intel --imageuuid=hereIsImageUUID --imagetype=afu --shell=V0.11
Run the command to check whether the download is successful.
# 将hereIsYourInstanceID替换为刚刚保存的实例ID;将hereIsFpgaUUID替换为上一条命令中记下的FpgaUUID; faascmd fpga_status --instanceId=hereIsYourInstanceID --fpgauuid=hereIsFpgaUUID
If "TaskStatus":"operating" appears in the return result, and the FpgaImageUUID is consistent with the FpgaImageUUID when downloading the image, the download is successful.
Step 6. Test
Run the following commands in sequence.
cd /opt/dcp1_0/hw/samples/dma_afu/sw make sudo LD_LIBRARY_PATH=/opt/dcp1_0/hw/samples/dma_afu/sw:$LD_LIBRARY_PATH ./fpga_dma_test 0
If you see the output as shown in the figure, the test is completed.
The above is the detailed content of How to use f1 RTL after rules have been added to the security group to allow access to the SSH port. For more information, please follow other related articles on the PHP Chinese website!