LoginSignup
2
2

More than 1 year has passed since last update.

UbuntuのDockerコンテナでCinebenchを測定

Last updated at Posted at 2022-05-06

はじめに

UbuntuのDockerコンテナ上で、Wineを利用しCinebenchを動作させてみます。

CinebenchはドイツのMAXSON社が無償で配布しているCPUのグラフィックベンチマークソフトです。
純粋なCPU性能を測定できるベンチマークとして注目を集めており、2020年にR23がリリースされています。
Cinebench R23ではWindows版に加え、Mac版(M1チップ対応)が配布されています。
Ubuntuで動作させるためには、Wineを利用してWindowsアプリケーションとして動作させる必要があるようです。
参考:WineHQのCinebench動作確認状況

注意点

今回の測定はDocker(コンテナ型仮想化)とWineを使って環境構築をしますが、性能面では素のOSに比べ余分なオーバヘッドが発生する可能性があります。
測定結果はあくまで、この環境上での性能値であるということで、他のリファレンスでも確認されることをお勧めします。
@y-vectorfieldさんコメントありがとうございました。)

Docker-Wine環境作成

Wineは7.7-stagingを利用しています。(7.0-stableではCinebenchがうまく動作しないため)
その他のバージョンは動作環境・バージョンを参照。
Dockerfile、docker-compose.yamlは以下です。

  • Dockerfile
# Dockerfile
# imageはubuntu:20.04などを利用(ここではいつものnvidiaのimageを使っています..)
# FROM ubuntu:20.04
FROM nvidia/cuda:11.4.2-cudnn8-devel-ubuntu20.04

# nvidiaのimageを使う場合のCUDAパッケージのセキュリティ強化(2022/4/28)に伴う設定
# https://developer.nvidia.com/blog/updatng-the-cuda-linux-gpg-repository-key
ENV CUDA_VERSION=11.4
RUN rm /etc/apt/sources.list.d/cuda.list
# RUN rm /etc/apt/sources.list.d/nvidia-ml.list
RUN apt-key del 7fa2af80
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64/7fa2af80.pub

# パッケージインストール
ENV TZ=Asia/Tokyo
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt upgrade -y
RUN apt install -y gnupg2 wget git build-essential curl vim unzip software-properties-common sudo

# Wineのインストール
RUN dpkg --add-architecture i386
RUN curl -fsSL https://dl.winehq.org/wine-builds/winehq.key | apt-key add -
RUN add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
RUN apt install -y --install-recommends winehq-staging

# Geditのインストール(動作確認に利用)
RUN DEBIAN_FRONTEND=noninteractive apt install -y gedit

# USERの設定
ARG UID=1000
ARG GID=1000
ARG USER=user
ARG PASSWORD=user
RUN mkdir -p /home/${USER} && mkdir -p /etc/sudoers.d && \
    echo "${USER}:x:${UID}:${GID}:User,,,:/home/${USER}:/bin/bash" >> /etc/passwd && \
    echo "${USER}:x:${UID}:" >> /etc/group && \
    echo "${USER} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${USER} && \
    chmod 0440 /etc/sudoers.d/${USER} && \
    chown ${UID}:${GID} -R /home/${USER}

USER ${USER}
WORKDIR /home/${USER}/app

  • docker-compose.yaml
version: '3.8'
services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    runtime: nvidia                    # GPUを認識させない場合は不要
    environment:
      - DISPLAY=${DISPLAY}             # ホスト側のXserverを利用するため設定
      - NVIDIA_VISIBLE_DEVICES=all     # GPUを認識させない場合は不要
      - NVIDIA_DRIVER_CAPABILITIES=all # GPUを認識させない場合は不要
    ports:
      - 8888:8888                      # ポートは特に開けなくても良い
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix  # ホスト側のXserverを利用するため設定
      - ../volume:/home/volume         # データボリュームはお好みで設定
    tty: true
  • コンテナの起動
$ sudo docker-compose up -d
$ sudo docker-compose exec app /bin/bash

Wineの設定

  • winecfgを実行し、GUIで設定を変更します。
$ wine --version
wine-7.7 (Staging)
$ winecfg

※ Wineの初回起動時にはWine Mono Installerが立ち上がるためインストールします。

  • ApplicationsからWindows Version: Windows 10を選択します。

Screenshot from 2022-05-06 23-57-52.png

  • Geditでの試走行
    Geditを立ち上げて、GNOMEのGUI(テキストエディタ)が立ち上がることを確認します。
$ gedit &

Cinebenchの起動と測定

  • CinebenchはWindows10版をダウンロードして展開します。
$ mkdir -p cinebench && cd cinebench
$ wget https://installer.maxon.net/cinebench/CinebenchR23.zip
$ unzip -qq CinebenchR23.zip
  • 起動はwine64(64bit)を使います。
$ wine64 Cinebench.exe
  • CinebenchのGUIが立ち上がるので、測定を開始します。
    Screenshot from 2022-05-07 00-51-01.png

  • 測定結果はMulti Core: 7349pts, Single Core: 1197 ptsでした。

おわりに

今回はUbuntuでCinebenchを測定するため、Wine環境のコンテナを構築しました。
Wineのバージョンによっては動作しないことがあるようなので注意です。

動作環境・バージョン

OS: Ubuntu 20.04.4 LTS
Kernel: 5.4.0-109-generic
Docker: 20.10.8
Docker Compose: 2.4.1
CPU: Intel Core(TM) i7-9700 CPU
GPU(1): NVIDIA GeForce RTX 2080 Ti
(1)CinebenchはCPUのベンチマークです

参考

  • Qiita

2
2
4

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
2