Upgrade to Pro — share decks privately, control downloads, hide ads and more …

FPGAX9 AWS F1 instance

TT
September 24, 2017

FPGAX9 AWS F1 instance

AmazonのクラウドFPGA、F1インスタンスの開発環境でHellowWorld的なものをやってみた。

TT

September 24, 2017
Tweet

Other Decks in Technology

Transcript

  1. '1("%FWFMPQFS".*  wίϚϯυϥΠϯ wαϯϓϧͰ)FMMP8PSME͢Δ͚ͩͳΒͪ͜ΒͰ0, w(6* wσεΫτοϓ؀ڥͷ௥Ճ͕ඞཁ w7/$ͷηοτΞοϓ $ sudo yum

    -y install gnome-classic-session gnome- terminal nautilus-open-terminal liberation-mono-fonts tigervnc-server.x86_64 $ vncserver -geometry 1440x900
 Password: ύεϫʔυ(2ճ) •ϙʔτϑΥϫʔυͰ઀ଓ
  2. 44)ϩάΠϯͨ͠Β  $ cd src/project_data $ git clone https://github.com/aws/aws-fpga $

    cd aws-fpga $ source hdk_setup.sh BXTGQHBΛμ΢ϯϩʔυˍηοτΞοϓ
  3. ΞοϓϩʔυͱΠϝʔδ࡞੒ϦΫΤετ  $ aws s3 mb s3://cl_hello_world_01 $ aws s3

    mb s3://cl_hello_world_01/dcp $ aws s3 mb s3://cl_hello_world_01/log $ aws s3 cp build/checkpoints/to_aws/ *.Developer_CL.tar s3://cl_hello_world_01/dcp/ ίϯιʔϧ͔ΒόέοτϙϦγʔͰΞΫηεΛڐՄ͢ΔΑ͏ઃఆ $ aws ec2 create-fpga-image --name cl_hello_world --description cl_hello_world --input- storage-location Bucket=cl_hello_world_01,Key=dcp/17_04_26-145828.Developer_CL.tar -- logs-storage-location Bucket=cl_hello_world_01,Key=log { "FpgaImageId": "afi-123456789XXXXXXXX", "FpgaImageGlobalId": "agfi-0987654321XXXXXXXXXXXX" } AFI ID,AGFI ID͕දࣔ͞ΕΔͷͰϝϞ͓ͬͯ͘
  4. Πϝʔδ࡞੒׬ྃ֬ೝ  •AFI͕࡞੒׬͍ྃͯ͠Δ͔Λ֬ೝ • aws ec2 describe-fpga-images --fpga-image-ids afi-0f0927bc2649e6259 {

    "Name": "cl_hellow_world", ... "FpgaImageGlobalId": "agfi-0f0e045f919413242", "Public": false, "State": { "Code": "available" }, "FpgaImageId": "afi-0f0927bc2649e6259", "Description": "cl_hello_world" }
  5. '̍Πϯελϯεʹϩʔυ͢Δ  w'ΠϯελϯεΛىಈ w Ϧʔδϣϯ/7JSHJOJB w '1("%FWFMPQFS".*Λ࢖༻ wBXTDPOpHVSFͰ*".ΩʔΛઃఆ $ cd

    src/project_data $ git clone https://github.com/aws/aws-fpga $ cd aws-fpga $ source sdk_setup.sh ←πʔϧྨ͕Πϯετʔϧ͞ΕΔ AFGIΛࢦఆͯ͠ɺΠϝʔδΛϩʔυˍ֬ೝ
  6. "'*͸γΣΞͰ͖ΔΒ͍͠  •FAQʹΑΔͱ࡞੒ͨ͠AFI͸ڞ༗Մೳͱͷ͜ͱ •ΠϝʔδͷϓϩύςΟʹPublic͕͋Δɻ
 ͜ΕΛtrueʹઃఆ͔ɻ { "Name": "cl_hellow_world", ... "FpgaImageGlobalId":

    "agfi-0f0e045f919413242", "Public": false, "State": { "Code": "available" }, "FpgaImageId": "afi-0f0927bc2649e6259", "Description": "cl_hello_world" } 
  7. FENBυϥΠό  $ cd aws-fpga/sdk/linux_kernel_drivers/edma $ sudo yum groupinstall "Development

    tools" $ sudo yum install kernel-devel $ echo 'edma' | sudo tee --append /etc/modules-load.d/ edma.conf $ sudo cp edma-drv.ko /lib/modules/`uname -r`/ $ sudo depmod $ sudo modprobe edma-drv` •edmaυϥΠό͸AMIʹΠϯετʔϧࡁΈͱॻ͔Ε͍ͯΔ͕ɺͳ ͔ͥೖ͍ͬͯͳ͍ɻखಈͰೖΕΔɻ aws-fpga/sdk/linux_kernel_drivers/edma/edma_install.md
  8. DM@ESBN@ENBΛࢼ͢ɺ͕ࣦഊ  •΋͏Ұͭαϯϓϧ cl_dram_dma Λࢼͨ͠ɻ •લड़ͷΑ͏ʹखಈͰೖΕΔɻ •ΠϝʔδΛ࡞੒&ϩʔυɻϥϯλΠϜΛmake࣮ͯ͠ߦɻ •ΤϥʔͰࣦഊɻrescan/rmmod/insmodͰ΋มԽͤͣɻ $ sudo

    ./test_dram_dma The slot appears loaded, but the pci vendor or device ID doesn't match the expected values You may need to rescan the fpga with fpga-describe-local-image -S 0 -R Note that rescanning can change which device file in /dev/ a FPGA will map to. To remove and re-add your edma driver and reset the device file mappings, run `sudo rmmod edma-drv && sudo insmod <aws-fpga>/sdk/linux_kernel_drivers/edma/edma-drv.ko` 2017-09-23T21:44:45.594093Z, test_dram_dma, ERROR, test_dram_dma.c +97: check_slot_config( The PCI vendor id and device of the loaded image are not the expected values. 2017-09-23T21:44:45.594150Z, test_dram_dma, ERROR, test_dram_dma.c +149: dma_example(): sl config is not correct 2017-09-23T21:44:45.594154Z, test_dram_dma, ERROR, test_dram_dma.c +58: main(): DMA exampl failed
  9. ४උ  w'1("%FWFMPQFS".*Λىಈͨ͠ΒɺԼهίϚ ϯυͰ४උ $ sudo yum install -y libstdc++-static

    gdb opencv libjpeg- turbo-devel libpng12-devel libtiff-devel compat-libtiff3 $ cd src/project_data $ git clone https://github.com/aws/aws-fpga $ cd aws-fpga $ source sdaccel_setup.sh $ source $XILINX_SDX/settings64.sh
  10. ϋʔυ΢ΣΞ޲͚ͷߏங  wNBLFͰ࡞੒ ͕͔͔࣌ؒΔ  wYDMCJOʹͰ͖ͨϑΝΠϧͱɺ4όέοτΛࢦఆͯ͠ɺ DSFBUF@TEBDDFM@BpTIΛ࣮ߦ w ͏·͍͚͘͹"'*Πϝʔδ͕࡞੒͞ΕΔ $

    make check TARGETS=hw DEVICES=$AWS_PLATFORM all $ $SDACCEL_DIR/tools/create_sdaccel_afi.sh -xclbin=xclbin/vector_addition.hw.xilinx_aws- vu9p-f1_4ddr-xpr-2pr_4_0.xclbin -o=vector_addition.hw.xilinx_aws-vu9p-f1_4ddr- xpr-2pr_4_0 -s3_bucket=cl_hello_world_01 -s3_dcp_key=dcp -s3_logs_key=log
  11. ผͳαϯϓϧIJHI@QFSG@NBU@NVMU  $ cd src/project_data/aws-fpga/SDAccel/examples/xilinx/acceleration/high_perf_mat_mult/ $ sudo sh sh-4.2# source

    /opt/Xilinx/SDx/2017.1.rte/setup.sh sh-4.2# ./high_perf_mat_mult 1000 1000 200 Creating context... Device/Slot[0] (/dev/xdma0, 0:0:1d.0) xclProbe found 1 FPGA slots with XDMA driver running INFO: Importing ./high_perf_mat_mult0.hw.xilinx_aws-vu9p-f1_4ddr-xpr-2pr_4_0.awsxclbin INFO: Loaded file Successfully skipped reloading of local image. INFO: Created Binary INFO: Built Program INFO: input matrix size: M= 1024, N= 1024, K= 256 INFO: hw matrix size: row= 32, col= 16, depth= 256 Creating Buffers... Copying Buffers to device.... Copying results to host.... INFO: Execution done INFO: kernel time 0.000789 seconds numOfOps 536870912.000000 Efficiency: 680.511168 GOPs INFO: Test Passed