LoginSignup
2
1

More than 3 years have passed since last update.

Ubuntu 18.04の上で手軽にIntel HLS(19.2.0.57)を使うためにDockerでCentOS7を動かす

Last updated at Posted at 2021-01-28

タイトルのまま...なのですが,以前
Ubuntu16の上で手軽にIntel HLSを使うためにDockerでCentOS7を動かすで環境をつくってたのだけど,19.2.0.57をインストールしようとしたら若干手順の変更が必要だったのでメモ.

なお,ホストであるUbuntu 16.04環境の /opt/intelFPGA_pro以下にQuartus一式がインストールしてある,という想定です.ちょっと変則的ですが、環境変数をこんな感じでセットするとすることを想定.

quartus_env.sh
export LC_ALL=C
export LANG=C
export QSYS_ROOTDIR=/opt/intelFPGA_pro/quartus_19.2.0b57/quartus/sopc_builder/bin
export PATH=/opt/intelFPGA_pro/quartus_19.2.0b57/quartus/bin:$PATH
export PATH=/opt/intelFPGA_pro/quartus_19.2.0b57/qsys/bin:$PATH
export PATH=/opt/intelFPGA_pro/19.2/modelsim_ase/bin:$PATH
source /opt/intelFPGA_pro/hls/init_hls.sh

また、vsimが実行できるように

sudo ln -s /opt/intelFPGA_pro/19.2/modelsim_ase/linux /opt/intelFPGA_pro/19.2/modelsim_ase/linux_rh60

とかしとく。

準備

適当な作業ディレクトリを用意する

% mkdir -p $HOME/docker/intel_hls
% mkdir -p $HOME/docker/intel_hls/intel_hls
% mkdir -p $HOME/docker/intel_hls/intel_hls/files
% cp quartus_env.sh $HOME/docker/intel_hls/intel_hls/files/

quartus_env.shは、$HOME/docker/intel_hls/intel_hlsの下においておく。

Dockerファイルの用意

↓の中身の Dockerfile という名前のファイルを$HOME/docker/intel_hls/intel_hlsの下に用意する.sshでログインする前提は行儀が悪い??

FROM centos:centos7

ADD quartus_env.sh /
RUN mkdir -p /opt
RUN yum -y update
RUN yum -y groupinstall "Development Tools"
RUN yum -y install epel-release
RUN yum -y install which
RUN yum -y install zlib-devel
RUN yum -y install glibc.i686 glibc-devel.i686 libX11.i686 libXext.i686 libXft.i686 ncurses-devel.i686
RUN yum -y install passwd openssh-server initscripts
RUN sed -ri 's/^#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN echo 'root:password' | chpasswd
RUN ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]

以前との違いは、compat-gcc44とかインストールしないこと.インストールするとあとでIntel HLS向けのgccのセットアップでコケる.

docker-compose.yamlの準備

こんな感じのdocker-compose.yamlを、$HOME/docker/intel_hlsの下に作成する。

docker-compose.yaml
version: '3'
services:
  intel_hls:
    build: ./intel_hls
    image: intel-hls
    container_name: intel_hls
    ports:
      - "30022:22"
    volumes:
      - /opt:/opt
      - /home:/home

準備が終わったところ

% tree $HOME/docker/intel_hls
/home/miyo/docker/intel_hls
├── docker-compose.yaml
└── intel_hls
    ├── Dockerfile
    └── files
        └── quartus_env.sh

2 directories, 3 files

とこんな感じのファイルが $HOME/docker/intel_hls に作成されたことになる。

コンテナの作成と起動

ファイルが用意できたら,コンテナ作って起動.

% cd $HOME/docker/intel_hls
% docker-compose build 
% docker-compose up -d

ホストの/opt/homeをそれぞれDockerゲスト内でも/optにマウントして使えるようにしている.

終了と二回目以降は,

% docker-compose stop
% docker-compose up -d

とか。

HLSを使う

localhostの30022ポートにsshでログインして操作。

% source /quartus_env.sh

初回はinstall_gccを実行しろと言われるので実行する.

/opt/intelFPGA_pro/hls/install_gcc

終わったら動作確認.

% cd /root
% cp -r /opt/intelFPGA_pro/hls/examples .
% cd examples/counter/
% make
% ./test-x86-64
% make test-gpp
% ./test-gpp
% make test-fpga
% ./test-fpga
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1