FPGAのDE10-NanoでOpenCLを使えるよう環境を構築する。

必要なもの

Intel FPGA SDK for OpenCLのインストール

#!/bin/sh
# source quartus.sh

INTEL_DIR=/run/media/root/HD-PCTU3-EXT4/_SDK/intelFPGA
#INTEL_DIR=/run/media/root/HD-PCTU3-EXT4/_SDK/intelFPGA_lite

pushd $INTEL_DIR/modelsim_ase
[ ! -e linux_rh60 ] && ln -s linuxaloem linux_rh60
popd

export QSYS_ROOTDIR="$INTEL_DIR/quartus/sopc_builder/bin"
export PATH=$INTEL_DIR/quartus/bin:$INTEL_DIR/qsys/bin:$INTEL_DIR/quartus/sopc_builder/bin:$INTEL_DIR/modelsim_ase/bin:$PATH

export CPLUS_INCLUDE_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.4.7:/usr/include/c++/4.4.7:/usr/include/c++/4.4.7/x86_64-redhat-linux
#export CPLUS_INCLUDE_PATH=$INTEL_DIR/modelsim_ase/gcc-4.7.4-linux/include/c++/4.7.4
export LD_LIBRARY_PATH=$INTEL_DIR/modelsim_ase/gcc-4.7.4-linux/lib
source $INTEL_DIR/hls/init_hls.sh

export ALTERAOCLSDKROOT=$INTEL_DIR/hld
export AOCL_BOARD_PACKAGE_ROOT=$INTEL_DIR/hld/board/c5soc
export LD_LIBRARY_PATH=$ALTERAOCLSDKROOT/host/linux64/lib
export LD_LIBRARY_PATH=$AOCL_BOARD_PACKAGE_ROOT/linux64/lib
source $INTEL_DIR/hld/init_opencl.sh

#export LD_LIBRARY_PATH=/root/intelFPGA/16.1/embedded/ds-5/sw/gcc/arm-linux-gnueabihf/bin

#dnf install libX11.i686 libXext.i686 libXft.i686 ncurses-compat-libs.i686 glibc-devel.i686
#i++ counter.cpp   -march=x86-64 -o test-x86-64 -I /usr/include/c++/7/ -I /usr/include/c++/7/x86_64-redhat-linux/
#i++ counter.cpp   -march=x86-64 -o test-x86-64 -I ../../../modelsim_ase/gcc-4.7.4-linux/include/c++/4.7.4/ -I ../../../modelsim_ase/gcc-4.7.4-linux/include/c++/4.7.4/i686-pc-linux-gnu/ -L/run/media/root/HD-PCTU3-EXT4/_SDK/intelFPGA_lite/hls/linux64/lib/dspba/linux64 -L/usr/lib/gcc/x86_64-redhat-linux/7/

#http://mirror.centos.org/centos/7/os/x86_64/Packages/
# rpm -Uvh compat-gcc-44-* --nodeps
# cd intelFPGA/hls/examples/counter/
# make
# ./test-x86-64
# make test-gpp
# ./test-gpp
# make test-fpga

#http://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=205&No=1046&PartNo=4
# aoc -march=emulator add.cl -o add.aocx
#-fast-compile

#amdgpu
#https://boinc.berkeley.edu/dev/forum_thread.php?id=11417
# /usr/lib/dkms/common.postinst amdgpu 17.50-511655.el7

参考

  • https://qiita.com/homelith/items/a80a5e4d45ea9280145a
  • http://www.xcalablemp.org/download/workshop/4th/fujita.pdf