LoginSignup
2
1

More than 3 years have passed since last update.

QuantumCore のお試しとサーバ負荷

QuantumCore をインストールして、動かす時にサーバ負荷ってやはり気になりますよね。
そのあたり、ノートPCに入れた docker 上で試してみます。
(docker には 2core 2GB とリソースが振られています)

とりあえずインストールでひっかかった所

QuantumCoreをGCP(無料枠)で動かしてみた を参照させて頂いて、Windows10 上の docker 19.03.5 に構築した CentOS 7.7 でやってみました。インストール手順などは、参照先をご覧頂くとして、ひっかかった所をあげていきます。

docker exec で入ると環境変数反映しないのね・・・

docker exec -it [docker name] /bin/bash というような感じで docker に入ると、ユーザ自体は root になっているのですが、環境変数を反映していないので、環境変数関係でエラーがでます。ですので、ちゃんと root の環境変数読み込むようにします。

# cd /root/
# . .bash_profile

もしくは

# su -

root で動かすなら、どっちでもいいです。
まぁ、正式運用とかなら、root でやるのはおすすめしません・・・

これで、環境変数問題は解決する・・・はず。

pip install でエラー

# pip install requirements.txt

とやると、まとめて pip でインストールされるはずなのですが、うまくいきませんでした。

ERROR: Could not find a version that satisfies the requirement requirements.txt (from versions: none)
ERROR: No matching distribution found for requirements.txt

なので、とりあえず中身を一つずつインストールしましたが、それでエラーは出ませんでした。

では、負荷計測してみましょう

計50回くらい試してみました。

学習時間

最短は 1.1023838520050049
最長は 1.2119011878967285

まぁ、これは誤差の範囲のような気がします。

CPU負荷

31~36%くらいでした。
topだと12%くらいに見えるのですが、vmstat だと30%台で出ていました。
30%になるのは、1秒前後なので、負荷的にはわずかだと思います。

メモリー負荷

メモリーは、58MB 使用するくらいでそこまで使用量は多くありませんでした。

機械学習の結果は?

50回やってみると、正解率とF1値に多少のばらつきが出るようです。
ほぼほぼ同じ正解率とF1値なのですが、たまに違う値が出てきます。

結果貼っておきます

[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.2318134307861328}
acc= 0.984375
f1= 0.9843486952861954
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1527702808380127}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1398777961730957}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.201639175415039}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1144788265228271}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1613247394561768}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.4703526496887207}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1820614337921143}
acc= 0.9921875
f1= 0.9922010869565218
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1023838520050049}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.163525104522705}
acc= 0.9921875
f1= 0.9922010869565218
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1574749946594238}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.167022705078125}
acc= 0.9921875
f1= 0.9922010869565218
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1607372760772705}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1231114864349365}
acc= 0.984375
f1= 0.9842503959577272
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1752033233642578}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.181903600692749}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.2091014385223389}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1739671230316162}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1905741691589355}
acc= 0.9921875
f1= 0.9922010869565218
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1528575420379639}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1810216903686523}
acc= 0.984375
f1= 0.9842503959577272
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1509337425231934}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1574828624725342}
acc= 0.9921875
f1= 0.9922010869565218
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1093213558197021}
acc= 0.9921875
f1= 0.9922010869565218
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1390151977539062}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.167527675628662}
acc= 0.9921875
f1= 0.9922010869565218
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1776607036590576}
acc= 0.984375
f1= 0.9839769069919827
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1431849002838135}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1329083442687988}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1392054557800293}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1581971645355225}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1176540851593018}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1181950569152832}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1844444274902344}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1632635593414307}
acc= 0.984375
f1= 0.9842503959577272
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.201117753982544}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1654024124145508}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.184995174407959}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.154017686843872}
acc= 0.984375
f1= 0.9839254412475823
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.192983627319336}
acc= 0.984375
f1= 0.9842503959577272
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1211378574371338}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.2119011878967285}
acc= 0.984375
f1= 0.9842503959577272
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1723127365112305}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1598739624023438}
acc= 0.984375
f1= 0.9842503959577272
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.205549955368042}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1679303646087646}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1810824871063232}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1849102973937988}
acc= 0.9921875
f1= 0.9922010869565218
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1403276920318604}
acc= 0.9921875
f1= 0.9922010869565218
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.147097110748291}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1421785354614258}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1393120288848877}
acc= 0.9921875
f1= 0.9921496212121212
[root@49925e6418dc advent-calendar-2019]# python client.py
{'res': 'ok', 'train_time': 1.1349763870239258}
acc= 0.9921875
f1= 0.9921496212121212

まとめ

機械学習というと、ごりごりにマシンパワーと使って、時間もかかるというイメージがありましたが、今回やってみると、実行時間も短いですし、マシンパワーも余り必要ありません。適当なノートPC上で動いてしまうレベルなのでお手軽な感じです。もう少しお試し期間が残っているので、アドベントカレンダーとは関係ないですが、引き続きお試ししてみたいと思います。

参照リンク

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