Introduction | 1. Connecting to your F1 instance | 2. Experiencing F1 acceleration | 3. Developing F1 applications | 4. Wrapping-up |
In this module you will start an EC2 F1 instance using the FPGA Developer AMI and connect to it using a remote desktop client. Once connected, you will download the workshop files and confirm you can execute a simple application on F1.
For this event, each registered participant will be required to start an EC2 F1 instance, therefore, participants need to have experience with:
- AWS account and launching EC2 instances
- EC2 Key Pair (.pem)
- EC2 Security Groups
- IAM username and credentials
- Setting up AWS CLI
- Connecting to a running instance using SSH or PuTTy
-
Sign into your AWS account and go to EC2
-
Select Region US-East (N. Virginia). The pull down is located in the upper right corner of the console.
-
Launch an F1 Instance (f1.2xlarge) using the FPGA developer AMI from the EC2 Console.
-
Once the instance is running, find and note the IPv4 Public IP address of your instance.
- You will be using this IP address to connect to your instance.
- The IPv4 Public IP address is displayed in EC2 Console next to the instance status.
Some AWS accounts may have a F1 instance limit equal to 0. If your F1 instance fails to launch due to your account has an instance limit equal to 0: During the workshop, raise your hand for assistance so we can manaully raise the limit on your account. After the workshop, use AWS support to submit for a F1 instance limit increase.
Windows Users - Connecting to Your Linux Instance from Windows Using PuTTY
-
In the SSH client, use the IPv4 Public IP of your instance:
ssh -i <.pem file> centos@<IPv4 Public IP>
-
Run a setup script to configure GUI and download workshop files.
source <(curl -s https://s3.amazonaws.com/aws-ec2-f1-reinvent-17/setup_script/setup_reinvent.sh)
This setup script performs the following tasks:
- Download and setup the aws-fpga repository in (/home/centos).
- Download and setup the aws-fpga-app-notes repository in (/home/centos).
- Install packages to setup a GUI Desktop on the FPGA Developer AMI.
- Set a user password for the 'centos' user.
- IMPORTANT: Please take a note of the password it generates at the end. You will need to use it to connect using RDP.
- The setup script is a one time setup and completes in 8-15 mins. Feel free to use this time to read the workshop.
The instance you just started should now be configured with remote desktop protocol (RDP) services.
-
From your local machine, start a remote desktop protocol client
- On Windows: press the Windows key and type "remote desktop".
- You should see the "Remote Desktop Connection" in the list of programs.
- Alternatively you can also simply type
mstsc.exe
in the Windows run prompt.
- On Linux: RDP clients such a Remmina or Vinagre are suitable.
- On macOS: use the Microsoft Remote Desktop from the Mac App Store.
- On Windows: press the Windows key and type "remote desktop".
-
In the RDP client, enter the IPv4 Public IP of your instance.
-
IMPORTANT: Before connecting, set your remote desktop client to use 24-bit or less for color depth
- On Windows: In the bottom-left corner of connection prompt, click Options, then select the Display tab and set Colors to True Colors (24 bit)
-
Click Connect. This should bring up a message about connection certificates.
-
Click Yes to dismiss the message. The Remote Desktop Connection window opens with a login prompt.
-
Login with the following credentials:
- User: centos
- Password: ******** (Generated as part of the setup script)
- Look for output like below:
INFO: Setting password for user 'centos' INFO: ************************************** INFO: *** PASSWORD : reinvent2017_123 **** INFO: **************************************
-
Click Ok.
You should now be connected to the remote F1 instance running Centos 7.
-
In the remote instance, double click on the Chromium Web Browser icon.
- It opens the browser and loads the workshop instructions.
Note: if a "keyring" popup comes up, click Cancel.
-
Continue following the workshop instructions from within the remote instance and the Chromium browser.
- We suggest you perform all your copy-paste from the instructions to the shell within the RDP session to avoid issues.
-
Open a new terminal by right-clicking anywhere in the Desktop area and selecting Open Terminal.
-
In the terminal, verify that the reInvent17_Developer_Workshop within the aws-fpga-apps-notes repository exists and that the aws-fpga repository exists.
ls -lrtha ~/aws-fpga-app-notes ls -lrtha ~/aws-fpga
-
Source the SDAccel environment from the aws-fpga repository.
cd ~/aws-fpga source sdaccel_setup.sh source $XILINX_SDX/settings64.sh
Note: the sdaccel_setup.sh script might generate warning messages, but these can be safely ignored.
The hello world example is an OpenCL application with a simple vector-addition accelerator. This example uses a precompiled FPGA binary to reduce compilation time and streamline the workshop.
-
Compile the host application
# Go to the example directory cd ~/aws-fpga-app-notes/reInvent17_Developer_Workshop/helloworld_ocl # Compile the host application (./helloworld) make TARGETS=hw DEVICES=$AWS_PLATFORM exe
-
Confirm the presence of the precompiled FPGA binary.
ls -la ./xclbin/vector_addition.hw.xilinx_aws-vu9p-f1_4ddr-xpr-2pr_4_0.awsxclbin
-
Execute the host application with the precompiled FPGA binary on the F1 instance.
sudo sh source /opt/Xilinx/SDx/2017.1.rte/setup.sh ./helloworld
-
The host application executes using the vector_addition kernel running in the FPGA and produces the following results:
Device/Slot[0] (/dev/xdma0, 0:0:1d.0) xclProbe found 1 FPGA slots with XDMA driver running platform Name: Xilinx Vendor Name : Xilinx Found Platform Found Device=xilinx:aws-vu9p-f1:4ddr-xpr-2pr:4.0 XCLBIN File Name: vector_addition INFO: Importing ./vector_addition.hw.xilinx_aws-vu9p-f1_4ddr-xpr-2pr_4_0.awsxclbin Loading: './vector_addition.hw.xilinx_aws-vu9p-f1_4ddr-xpr-2pr_4_0.awsxclbin' Result = 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 TEST PASSED sh-4.2#
-
You compiled a host application and successfully executed it on F1 using a pre-compiled Amazon FPGA Image (AFI).
-
Close your terminal.
exit exit
This concludes this first module.
Start the next module: 2: Experiencing F1 acceleration