Jenkinsのインストール(CentOS on raspberry pi3)
インストール手順は以下にアリ。
RedHat Repository for Jenkins
追記:Javaがない、といってJenkinsの起動に失敗します。動作確認はまた後日。
# sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo: wget: コマンドが見つかりません
wgetがない、と言われたので以下に書き換え。
sudo curl -o /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
中身を確認すると。
# more /etc/yum.repos.d/jenkins.repo
[jenkins]
name=Jenkins-stable
baseurl=http://pkg.jenkins.io/redhat-stable
gpgcheck=1
後は指示通り。まとめると以下。
sudo curl -o /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install jenkins
Raspberry Pi3にCentOS
CentOSが入るらしいのでやってみた。
wi-fiのドライバを別途ダウンロードする必要があるので、Raspberry Pi3に有線LANが必要。
ダウンロード
More download choicesへ。
http://wiki.centos.org/Download
AltArch Releasesの中に、RaspberryPi3 (img)があるのでこれを使う。
上記を解凍して(7zipなど)、イメージ書き込みツールでSDカードに書き込み。ここはraspbianと同じ。
ログイン
ログインID、パスワードはroot/centos。ここに書いてある。
https://wiki.centos.org/SpecialInterestGroup/AltArch/Arm32/RaspberryPi3
rootのパスワードの変更
#passwd
ディスクの拡張
ディスクの拡張は以下。/root/READMEに書いてある。
If you want to automatically resize your / partition, just type the following (as root user):
/usr/local/bin/rootfs-expand
Wifiの認識
Wifiの認識は以下。ファイルを落として再起動。これをやってもwifiのアダプタを認識するだけなので、設定は別。
For wifi on the rpi3, just proceed with those steps :
curl --location https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80211/brcm/brcmfmac43430-sdio.bin > /usr/lib/firmware/brcm/brcmfmac43430-sdio.bin
curl --location https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80
211/brcm/brcmfmac43430-sdio.txt > /usr/lib/firmware/brcm/brcmfmac43430-sdio.txtsystemctl reboot
Wifiの設定(raspberry Pi3にcentos7を入れてみた - Qiitaより)
[root@centos-rpi3 ~]# nmcli d
デバイス タイプ 状態 接続
eth0 ethernet 接続済み eth0
wlan0 wifi 管理無し --
lo loopback 管理無し --
$ nmcli d wifi
# -> Wifiアクセスポイントのリストが一覧されます
$ nmcli d wifi connect
キーボードの設定(raspberry Pi3にcentos7を入れてみた - Qiitaより)
centos
$ localectl set-keymap jp106
$ localectl set-keymap jp-OADG109A##System Localeを変更もしておきます
$ localectl set-locale LANG=ja_JP.utf8##localectlで確認
$ localectl
System Locale: LANG=ja_JP.utf8
VC Keymap: jp-OADG109A
X11 Layout: jp
X11 Model: jp106
X11 Options: terminate:ctrl_alt_bksp
Abstract Base Classのテスト
Abstract Base Classのテスト。
メソッド名が同じで、引数が異なるオブジェクトの生成と実行のサンプルです。
メソッド名を共通で固定したいので、Abstract Base Classを使ってみました。
変数名にnameを使っていたら、「TypeError: 'str' object is not callable」と怒られたのでclassNameとしています。
# -*- coding: utf-8 -*- from abc import ABCMeta, abstractmethod # 抽象クラス class CalcNode(metaclass=ABCMeta): @abstractmethod def className(self): pass @abstractmethod def calc(self): pass #抽象クラスの中身。Zero,Add,Subの3つのクラス class classZero(CalcNode): def __init__(self): self.name = "Zero" def className(self): return self.name def calc(self,val1=1,val2=2): return 0 class classAdd(CalcNode): def __init__(self): self.name= "Add" def className(self): return self.name def calc(self,val1=1,val2=2): return val1+val2 class classSub(CalcNode): def __init__(self): self.name= "Sub" def className(self): return self.name def calc(self,val1=1,val2=2): return val1-val2 def factory(className): if className=="Zero": return classZero() elif className=="Add": return classAdd() elif className=="Sub": return classSub() else: raise def main(): nodes=(factory("Add"), factory("Zero"), factory("Sub")) for node in nodes: print(node.className()) print(node.calc(val1=2,val2=5)) print(node.calc(val2=5,val1=2)) #入れ替えても大丈夫 print(node.calc(2,5)) #変数名を省いても大丈夫 print(node.calc(val1=100)) #片方だけ入れても大丈夫 print(node.calc(val2=100)) #片方だけ入れても大丈夫 print(node.calc()) #何も入れなくても大丈夫 #main()を実行する if __name__== '__main__': main()
Failed to create session. CUDA_ERROR_INVALID_DEVICE
古いGPUがついていると、こんなエラーになることがある。
$cd /usr/local/lib/python3.5/dist-packages/tensorflow/models/image/mnist $/usr/local/lib/python3.5/dist-packages/tensorflow/models/image/mnist$ python3 convolutional.py I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so locally I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so locally I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so locally I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcuda.so.1 locally I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so locally Extracting data/train-images-idx3-ubyte.gz Extracting data/train-labels-idx1-ubyte.gz Extracting data/t10k-images-idx3-ubyte.gz Extracting data/t10k-labels-idx1-ubyte.gz I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties: name: GeForce GTX 1070 major: 6 minor: 1 memoryClockRate (GHz) 1.7465 pciBusID 0000:01:00.0 Total memory: 7.92GiB Free memory: 7.79GiB W tensorflow/stream_executor/cuda/cuda_driver.cc:590] creating context when one is currently active; existing: 0x314aa00 E tensorflow/core/common_runtime/direct_session.cc:135] Internal: failed initializing StreamExecutor for CUDA device ordinal 1: Internal: failed call to cuDevicePrimaryCtxRetain: CUDA_ERROR_INVALID_DEVICE Traceback (most recent call last): File "convolutional.py", line 339, in <module> tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 43, in run sys.exit(main(sys.argv[:1] + flags_passthrough)) File "convolutional.py", line 284, in main with tf.Session() as sess: File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1186, in __init__ super(Session, self).__init__(target, graph, config=config) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 551, in __init__ self._session = tf_session.TF_NewDeprecatedSession(opts, status) File "/usr/lib/python3.5/contextlib.py", line 66, in __exit__ next(self.gen) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/errors_impl.py", line 469, in raise_exception_on_not_ok_status pywrap_tensorflow.TF_GetCode(status)) tensorflow.python.framework.errors_impl.InternalError: Failed to create session.
こうやって実行すれば、GPUを0だけ使用して、実行する。
$CUDA_VISIBLE_DEVICES=0 python3 convolutional.py
以下でも可。
$export CUDA_VISIBLE_DEVICES=0 $python3 convolutional.py
以下の定数も必要な様子。
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64" export CUDA_HOME=/usr/local/cuda
CUCA Toolkitのインストール (network deb)
Ubuntu 16.04にCUCA Toolkitのインストールした時のメモ。
CUDA ToolkitCUDA 8.0 Downloads https://developer.nvidia.com/cuda-downloads
Select Target Platformから
Operating System:Linux
Architecture:x86_64
Distribution:Ubuntu
Version:16.04
Installer Typeで、[deb (network)]を選ぶと、
実行手順として以下を実行しろ、と言われる。
cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb自体は、wgetでローカルに保存しておく。
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
Installation Instructions: 1. sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb 2. sudo apt-get update 3. sudo apt-get install cuda
Enterキーが押せない
Ubuntu16.04のインストールの話。
最後に、メディアを抜いて、Enterキーを押せ、と出る。
Please remove installation media and close tray and press enter.
しかし、それまで使えていたUSBのキーボードは認識しない様子。
困り果てて、しばらく(10分くらい?)放置してたら自動的に再起動したっぽい。
PS/2の端子のあるキーボードで押せるかどうか。。。
CUCA Toolkitのインストール
CUCA Toolkitのインストール
Ubuntu 16.04にCUCA Toolkitのインストールした時のメモ。
CUDA ToolkitCUDA 8.0 Downloads https://developer.nvidia.com/cuda-downloads
[Select Target Platform]から
Operating System:Linux
Architecture:x86_64
Distribution:Ubuntu
Version:16.04
Installer Typeで、[deb (network)]を選ぶと、
実行手順として以下を実行しろ、と言われるが。。。
Installation Instructions: 1. `sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb` 2. `sudo apt-get update` 3. `sudo apt-get install cuda`
エラーとなる。
$ sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb dpkg: アーカイブ cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb の処理中 にエラーが発生しました (--install): アーカイブにアクセスできません: そのようなファイルやディレクトリはありません 処理中にエラーが発生しました: cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.deb
仕方がないので、Installer Typeをrunfile (local)に変更してファイルをダウンロード。バージョンは適宜書き換え。
wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run
Installation Instructions: 1. Run `sudo sh cuda_8.0.61_375.26_linux.run` 2. Follow the command-line prompts
1.を実行すると、以下などを聞かれる。
- ドライバのインストール
- サンプルのインストール
CUCA Toolkitのインストールエラーのメモ
まだ整理できてない。
こんなコマンドを打っている
sudo ln -sf /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/libGL.so.1
sudo sh cuda_8.0.61_375.26_linux-run -silent -driver