kuroの覚え書き

96の個人的覚え書き

富士通PRIMERGY RX300S7で深層学習の学習環境を構築してみる(2)

続き

次にanacondaを入れる
最初普通にanacondaのサイトからインストーラをダウンロードしてきて

$ bash Anaconda3-5.3.1-Linux-x86_64.sh

とインストールしてtensorflowをpipで入れて・・・とやってみたのだが、glibcのバージョンがCentOS7では2.17、tensorflowが2.23を要求するということからドツボにはまり、glibcを別途用意してLD_LIBRARY_PATHで指定して、とか頑張ってみたのだが、今ひとつすっきりしないし、systemを破壊しそうでナニだったことから、anaconda自体をpyenvで隔離することにした。

anaconda はpyenvのもとにインストールし、systemのpython2.7もしくはpython3とは切り離しておく

$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"' >> ~/.bashrc
$ source ~/.bashrc

anacondaは最新版をインストール

$ pyenv install -l | grep anaconda

$ pyenv install anaconda3-5.3.1
$ pyenv rehash

$ pyenv global anaconda3-5.3.1 # anacondaをpythonのデフォルトに設定
$ echo 'export PATH="$PYENV_ROOT/versions/anaconda3-5.3.1/bin/:$PATH"' >> ~/.bashrc
$ source ~/.bashrc

$ conda update conda

CUDA toolkitとcudnnはcondaからインストールできるらしい

$ conda install cudatoolkit
$ conda install cudnn

tensorflow-gpuのインストールなのだが、どうもpython3.7では動かないらしい
TensorFlowをPython3で使う準備をする(Windows10) : としおの読書生活

というわけでanacondaで使うpythonを3.6に落とす。

$ conda install python=3.6

condaを使ってtensorflowをインストール

$ conda install tensorflow-gpu

pythonを起動してtensorflowがちゃんと入ったか確認してみる

$ python
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from tensorflow.python.client import device_lib
>>> device_lib.list_local_devices()
2019-04-18 09:27:07.652574: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX
2019-04-18 09:27:07.786044: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2000084999 Hz
2019-04-18 09:27:07.792889: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x564bc4bd80c0 executing computations on platform Host. Devices:
2019-04-18 09:27:07.793038: I tensorflow/compiler/xla/service/service.cc:158]   StreamExecutor device (0): <undefined>, <undefined>
2019-04-18 09:27:08.049509: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:998] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-04-18 09:27:08.050256: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x564bc4cc3680 executing computations on platform CUDA. Devices:
2019-04-18 09:27:08.050307: I tensorflow/compiler/xla/service/service.cc:158]   StreamExecutor device (0): GeForce GT 710, Compute Capability 3.5
2019-04-18 09:27:08.050639: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 with properties: 
name: GeForce GT 710 major: 3 minor: 5 memoryClockRate(GHz): 0.954
pciBusID: 0000:03:00.0
totalMemory: 980.94MiB freeMemory: 958.69MiB
2019-04-18 09:27:08.050682: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0
2019-04-18 09:27:08.060169: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-04-18 09:27:08.060206: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990]      0 
2019-04-18 09:27:08.060226: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0:   N 
2019-04-18 09:27:08.060495: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/device:GPU:0 with 733 MB memory) -> physical GPU (device: 0, name: GeForce GT 710, pci bus id: 0000:03:00.0, compute capability: 3.5)
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 2232806157292722847
, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 16136033629533297001
physical_device_desc: "device: XLA_CPU device"
, name: "/device:XLA_GPU:0"
device_type: "XLA_GPU"
memory_limit: 17179869184
locality {
}
incarnation: 1820044920749343627
physical_device_desc: "device: XLA_GPU device"
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 769327104
locality {
  bus_id: 1
  links {
  }
}
incarnation: 12295195253859629574
physical_device_desc: "device: 0, name: GeForce GT 710, pci bus id: 0000:03:00.0, compute capability: 3.5"
]

ちゃんと認識した

さて、環境が整ったっぽいのでkerasも入れてテストしてみよう
kerasのインストール

$ pip install keras

kerasのリポジトリをgit cloneしてmnist_cnn.pyというプログラムを走らせてみる

$ git clone https://github.com/fchollet/keras.git
$ cd keras/examples
$ python mnist_cnn.py
Using TensorFlow backend.
Downloading data from https://s3.amazonaws.com/img-datasets/mnist.npz
11493376/11490434 [==============================] - 5s 0us/step
x_train shape: (60000, 28, 28, 1)
60000 train samples
10000 test samples
WARNING:tensorflow:From /home/kkuro2/.pyenv/versions/anaconda3-5.3.1/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From /home/kkuro2/.pyenv/versions/anaconda3-5.3.1/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.
WARNING:tensorflow:From /home/kkuro2/.pyenv/versions/anaconda3-5.3.1/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
Train on 60000 samples, validate on 10000 samples
Epoch 1/12
2019-04-18 09:35:51.539905: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX
2019-04-18 09:35:51.551448: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2000084999 Hz
2019-04-18 09:35:51.552561: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x56298dfd6eb0 executing computations on platform Host. Devices:
2019-04-18 09:35:51.552623: I tensorflow/compiler/xla/service/service.cc:158]   StreamExecutor device (0): <undefined>, <undefined>
2019-04-18 09:35:51.683502: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:998] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-04-18 09:35:51.684277: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x56298e0c23d0 executing computations on platform CUDA. Devices:
2019-04-18 09:35:51.684383: I tensorflow/compiler/xla/service/service.cc:158]   StreamExecutor device (0): GeForce GT 710, Compute Capability 3.5
2019-04-18 09:35:51.684947: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 with properties: 
name: GeForce GT 710 major: 3 minor: 5 memoryClockRate(GHz): 0.954
pciBusID: 0000:03:00.0
totalMemory: 980.94MiB freeMemory: 958.69MiB
2019-04-18 09:35:51.685056: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0
2019-04-18 09:35:51.686590: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-04-18 09:35:51.686655: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990]      0 
2019-04-18 09:35:51.686696: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0:   N 
2019-04-18 09:35:51.687099: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 733 MB memory) -> physical GPU (device: 0, name: GeForce GT 710, pci bus id: 0000:03:00.0, compute capability: 3.5)
2019-04-18 09:35:57.798268: I tensorflow/stream_executor/dso_loader.cc:152] successfully opened CUDA library libcublas.so.10.0 locally
  128/60000 [..............................] - ETA: 1:30:39 - loss: 2.2983 - acc  256/60000 [..............................] - ETA: 45:50 - loss: 2.2962 - acc: 

(中略)

59776/60000 [============================>.] - ETA: 0s - loss: 0.0267 - acc: 0.959904/60000 [============================>.] - ETA: 0s - loss: 0.0269 - acc: 0.960000/60000 [==============================] - 76s 1ms/step - loss: 0.0271 - acc: 0.9917 - val_loss: 0.0344 - val_acc: 0.9881
Test loss: 0.03438230963442984
Test accuracy: 0.9881

という感じにテスト完了。ちゃんと機能しているっぽい。

epoch=20の学習によって損失値が
loss: 2.2962
loss: 0.0271
と下がっていることがわかる。

めでたしめでたし

batch_size = 128
num_classes = 10
epochs = 12

GPUあり00:15:28

GPU有り無しでどの程度違うのかはテストしてみないとな
ただ、GT710のメモリ1Gではちょっと足らないっぽいな。Running low on GPU memoryって警告が出っぱなしで、相当足を引っ張ってたっぽい
f:id:k-kuro:20190419101052p:plain


追記
ちなみにCPUの方は6core/12threadあるけど、1コア分しか働いてないね。サーバ本体のメモリは4GBしか積んでないけど、64%使用程度なので、十分らしい。
f:id:k-kuro:20190419101752p:plain

あえてGPUを使わずCPUだけを使って行うときは

$ export CUDA_VISIBLE_DEVICES=""

というふうにする

epoch=1でテストランしてみたところ
GPUあり:79秒
GPUなし:108秒
36%の高速化(w
と流石にローエンドGPUだけあって差はそんなもんか、というレベルだった。
#こりゃ手持ちの6core/12thread x 2のサーバでCPUだけでやったほうが速いんちゃう?
GPUメモリ不足が致命的なのかな。batch_sizeを下げるとかチューニングが必要なのかも


なお、GPUなしで走らせると
f:id:k-kuro:20190419105829p:plain
確かにCPUがフル回転している

終わったら

unset CUDA_VISIBLE_DEVICES

GPU使う設定に戻しておく

富士通PRIMERGY RX300S7で深層学習の学習環境を構築してみる

データ解析をする上で無視できない深層学習(deep learning)を使えるように勉強中なのだが、手元に実機があったほうがいろいろと試せて良いだろう、ということでサーバの1ノードを深層学習用GPUマシンにすることにした。
当初RX200S7 (XEON E5-2620 x2)の1UサーバにGPUを乗っけてテストを開始したのだが、流石に1Uでは窮屈かなと、2UのRX300S7 (XEON E5-2630L)を入手してみた。
#春は中古サーバが安く出回っていいね。
本当は2UだとフルハイトのPCIカードが刺さらないので、タワー型のサーバ機のほうが良いのだけど、そういう汎用性のありそうな機械はヤフオクでも結構値がつり上がっちゃうので、やむなく2Uラックサーバで我慢する。
GPUは画像を表示させるわけでもないのでx16フルに繋がっている必要はないから、仮想通貨マイナー御用達の外付けx1 PCI-eの基板などで外付けにすればいいのだろうが(そうするとRX300でなくてもいいとも言えるが)、とりあえずはテスト環境として、一番安価でCUDA対応しているNVIDIA GeForce GT710というロープラファイルでローエンドなグラフィックボードを入れてみた。

まずはいろいろとサイトを巡って情報収集。
いつもお世話になっています
CentOS 7 : CUDA 9.1 インストール : Server World
まずはここを参考にCUDAをインストールしてみる。

このページではCUDA9.1を入れているが、こういう情報はすぐに更新されていってしまうので、そのままやるという訳にはいかない。
そもそもいろいろ関係するもののバージョンの組み合わせによって動いたり動かなかったりするわけで、いつの間にか情報のあるバージョンがダウンロードできなくなっていたりするので厄介だ。かといってすべて最新バージョンにしたらだいたいはうまくいかないというのがこの世界。試行錯誤するしか無いのな。

2019年4月18の段階の各種最新バージョンは以下の通り
anaconda3-5.3.1
python 3.7.2
tensorflow-gpu-1.13.1
CUDA-10.1
nvidia-driver-418.43

まずはグラボをインストール。RX300S7のマニュアルを見るとグラボはPCI-slot5に挿せ、とあったので素直に従ってみたところ認識しないし。マニュアルをよくよく見てみると、slot5,6は2CPUでないと使えないとか書いてるし。どういうこっちゃ。結局グラボの装着順は(1) slot5, (2) slot4ということらしく、1CPUのときは(1)は飛ばして(2) slot4に挿す必要があるようで、わかりにくいことこの上ない。ついでにグラボを挿すとオンボードVGAは使えなくなるというおまけ付き。

とりあえずnvidiaのドライバを入れるために標準ドライバを切る。

# lsmod | grep nouveau
nouveau 1869689 0
mxm_wmi 13021 1 nouveau
video 24538 1 nouveau
wmi 21636 2 mxm_wmi,nouveau
drm_kms_helper 179394 2 mgag200,nouveau
ttm  114635 2 mgag200,nouveau
drm  429744 5 ttm,drm_kms_helper,mgag200,nouveau
i2c_algo_bit  13413 3 igb,mgag200,nouveau
# nano /etc/modprobe.d/blacklist-nouveau.conf
# cat /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0

# dracut --force
# reboot

次にドライバをインストール

必要なパッケージをインストール

# yum -y install kernel-devel-$(uname -r) kernel-header-$(uname -r) gcc make

インストールされているグラボを確認

# lspci | grep VGA
04:00.0 VGA compatible controller: NVIDIA Corporation GK208B [GeForce GT 710] (rev a1)
08:00.0 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G200e [Pilot] ServerEngines (SEP1) (rev 05)

ドライバをダウンロード

# wget http://jp.download.nvidia.com/XFree86/Linux-x86_64/418.43/NVIDIA-Linux-x86_64-418.43.run

インストール

# bash NVIDIA-Linux-x86_64-418.43.run
Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 418.43................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

途中のメッセージはすべてyesで進む
f:id:k-kuro:20190617124038p:plain

f:id:k-kuro:20190617124053p:plain

f:id:k-kuro:20190617124104p:plain
ちゃんと入ったか確認

# nvidia-smi

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.43  Driver Version: 418.43   |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap|  Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
|  0 GeForce GT 710 Off | 00000000:04:00.0 N/A | N/A |
| 50%  28C P0 N/A / N/A | 0MiB /  980MiB |  N/A Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes:  GPU Memory |
| GPU  PID  Type  Process name  Usage |
|=============================================================================|
| 0 Not Supported  |
+-----------------------------------------------------------------------------+

Not Supportedは気になるが、ローエンド機種なのでそういうものらしい

続いてCUDA10.1をダウンロードしてインストール

# wget https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-repo-rhel7-10.1.105-1.x86_64.rpm
# rpm -Uvh cuda-repo-rhel7-10.1.105-1.x86_64.rpm
# sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/cuda.repo
# yum --enablerepo=cuda,epel install cuda-10-1 xorg-x11-drv-nvidia dkms gcc make

いろいろ情報を見てもCUDA10.0までしか実績はなさそうだけど
gcc, makeはすでに最新版だったらしくインストールはされないのはいいが、DKMSのインストールでコケた

# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# yum --enablerepo=cuda,epel install cuda-10-1 xorg-x11-drv-nvidia dkms

とすることで回避

# nano /etc/profile.d/cuda101.sh

# cat /etc/profile.d/cuda101.sh
export PATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

ここで一旦再起動

# reboot

一般ユーザでログインして、テストプログラムを走らせてみる

$ cuda-install-samples-10.1.sh ./
Copying samples to ./NVIDIA_CUDA-10.1_Samples now...
Finished copying samples.

$ cd NVIDIA_CUDA-10.1_Samples/1_Utilities/deviceQuery
$ make
$ ./deviceQuery
./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 35
-> CUDA driver version is insufficient for CUDA runtime version
Result = FAIL

ここでまたエラーが出た。

NVIDIAのドライバを入れ直すと良いらしい

# bash NVIDIA-Linux-x86_64-418.43.run

改めてテスト

$ cd NVIDIA_CUDA-10.1_Samples/1_Utilities/deviceQuery
$ ./deviceQuery
./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "GeForce GT 710"
CUDA Driver Version / Runtime Version 10.1 / 10.1
CUDA Capability Major/Minor version number: 3.5
Total amount of global memory:  981 MBytes (1028587520 bytes)
( 1) Multiprocessors, (192) CUDA Cores/MP:  192 CUDA Cores
GPU Max Clock rate: 954 MHz (0.95 GHz)
Memory Clock rate:  800 Mhz
Memory Bus Width: 64-bit
L2 Cache Size:  524288 bytes
Maximum Texture Dimension Size (x,y,z)  1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory:  65536 bytes
Total amount of shared memory per block:  49152 bytes
Total number of registers available per block: 65536
Warp size:  32
Maximum number of threads per multiprocessor: 2048
Maximum number of threads per block:  1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment:  512 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels:  No
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping:  Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Device supports Compute Preemption: No
Supports Cooperative Kernel Launch: No
Supports MultiDevice Co-op Kernel Launch: No
Device PCI Domain ID / Bus ID / location ID:  0 / 4 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 10.1, CUDA Runtime Version = 10.1, NumDevs = 1
Result = PASS

これでCUDAはちゃんとインストールできたっぽい
続く

Macを起動したら自動でsshfsでマウント

まずはサーバの側の公開鍵・秘密鍵を設定

秘密鍵macの側で~/.ssh/kuro-server
などの名前で保存しておく

/usr/local/bin/sshfs kuro@192.168.1.100:/home/kuro ./mnt -o IdentityFile=~/.ssh/kuro-server

というスクリプトautomatorで作成してアプリとして保存。

アカウントの起動項目に設定。
以上。

homebrewにエラー再び

==> Upgrading ruby 
==> Downloading https://linuxbrew.bintray.com/bottles/ruby-2.6.1.x86_64_linux.bo
######################################################################## 100.0%
==> Pouring ruby-2.6.1.x86_64_linux.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /home/linuxbrew/.linuxbrew
Could not symlink bin/bundle
Target /home/linuxbrew/.linuxbrew/bin/bundle
is a symlink belonging to ruby. You can unlink it:
  brew unlink ruby

To force the link and overwrite all conflicting files:
  brew link --overwrite ruby

To list all files that would be deleted:
  brew link --overwrite --dry-run ruby

Possible conflicting files are:
/home/linuxbrew/.linuxbrew/bin/bundle -> /home/linuxbrew/.linuxbrew/Cellar/ruby/2.6.0_1/libexec/gembin/bundle
/home/linuxbrew/.linuxbrew/bin/bundler -> /home/linuxbrew/.linuxbrew/Cellar/ruby/2.6.0_1/libexec/gembin/bundler

んー。またrubyか。めんどくさいやっちゃなー。

あと、cufflinksがヘッドノードでは走るのに、計算ノードから起動しようとすると
Illegal installation
というエラーが出て起動しない。
これではtorqueでqsubできないのでめっちゃボトルネックができてしまう。

いろいろ試してみた。

$ brew remove cufflinks

で一旦アンインストールし、ヘッドノードで

$ brew install cufflinks

とインストールし直し→解決せず。
もう一度アンインストールし、計算ノードからインストール→これもだめ。
アンインストールしてから

$ brew cleanup

で不要なリンクファイルなどを一掃してからインストールし直し→解決。

今度からこまったときはbrew cleanupね。

homebrewにエラー

いつの頃からか

$ brew update
fatal: unable to access 'https://github.com/brewsci/homebrew-bio/': error setting certificate verify locations:
  CAfile: /home/linuxbrew/.linuxbrew/etc/openssl/cert.pem
  CApath: /home/linuxbrew/.linuxbrew/etc/openssl/certs
fatal: unable to access 'https://github.com/Linuxbrew/homebrew-core/': error setting certificate verify locations:
  CAfile: /home/linuxbrew/.linuxbrew/etc/openssl/cert.pem
  CApath: /home/linuxbrew/.linuxbrew/etc/openssl/certs
fatal: unable to access 'https://github.com/Linuxbrew/brew/': error setting certificate verify locations:
  CAfile: /home/linuxbrew/.linuxbrew/etc/openssl/cert.pem
  CApath: /home/linuxbrew/.linuxbrew/etc/openssl/certs
fatal: unable to access 'https://github.com/brewsci/homebrew-science/': error setting certificate verify locations:
  CAfile: /home/linuxbrew/.linuxbrew/etc/openssl/cert.pem
  CApath: /home/linuxbrew/.linuxbrew/etc/openssl/certs
fatal: unable to access 'https://github.com/Linuxbrew/homebrew-extra/': error setting certificate verify locations:
  CAfile: /home/linuxbrew/.linuxbrew/etc/openssl/cert.pem
  CApath: /home/linuxbrew/.linuxbrew/etc/openssl/certs
fatal: unable to access 'https://github.com/Linuxbrew/homebrew-xorg/': error setting certificate verify locations:
  CAfile: /home/linuxbrew/.linuxbrew/etc/openssl/cert.pem
  CApath: /home/linuxbrew/.linuxbrew/etc/openssl/certs
Error: Fetching /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/brewsci/homebrew-bio failed!
Fetching /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core failed!
Fetching /home/linuxbrew/.linuxbrew/Homebrew failed!
Fetching /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/brewsci/homebrew-science failed!
Fetching /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/linuxbrew/homebrew-extra failed!
Fetching /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/linuxbrew/homebrew-xorg failed!

というようなエラーが出るようになった。brewで入れたアプリの挙動も若干おかしいような感じもあった。

続きを読む

redmineのインストールでつまづく

redmineをインストールしようとして
Redmineが依存するgemパッケージをインストールのため
# bundle install --without development test --path vendor/bundle
としようとすると、途中で
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
というエラーが出て、最終的に

An error occurred while installing rmagick (2.16.0), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.16.0' --source 'https://rubygems.org/'` succeeds
before bundling.
というエラーで止まってしまう。
この原因はrmagick(2.16.0)がimagemagick (version7)に対応していないためで、imagemagickをversion6にダウンしなければならない模様。

rmagickのインストールにハマった - Qiita
ここで対処法が書かれているがMacのHomebrewでの話。
Linuxbrewだと
$ cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/
の部分を
$ cd /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/
と読み替えないとならない。

とまあ、うまくインストールできず今の所頓挫中・・・

Torqueのerror/outputをリアルタイムにチェックする

Torqueでジョブを投げると、errorとoutputが処理がすべて終わった後に書き出される。
しかし、何時間もかかる処理が果たしてちゃんと走っているのか心配になるので、できれば普通にスクリプトを走らせるときのように画面にstdoutを出しておきたいこともある。
そんなときは

#!/bin/sh

#PBS -k oe

と入れておくといい。
そうするとhome directoryに
スクリプト名.oジョブID
スクリプト名.eジョブID
と2つファイルが生成され、随時追記されていくので、tail -f やless +Fでモニタしてやる。

3世代5CPU対決

RX1330M3 E3-1230 v6 3.5GHz 4C8T 224.0GFLOPS

18/11/06 13:06:26
[M::bwa_idx_load_from_disk] read 0 ALT contigs
[M::process] read 1815774 sequences (80000053 bp)...
[M::process] read 1833396 sequences (80000011 bp)...
[M::mem_process_seqs] Processed 1815774 reads in 69.270 CPU sec, 10.917 real sec
[M::process] read 1827330 sequences (80000067 bp)...
[M::mem_process_seqs] Processed 1833396 reads in 72.403 CPU sec, 11.981 real sec
[M::process] read 1837492 sequences (80000005 bp)...
[M::mem_process_seqs] Processed 1827330 reads in 72.093 CPU sec, 11.749 real sec
[M::process] read 419113 sequences (18201018 bp)...
[M::mem_process_seqs] Processed 1837492 reads in 70.634 CPU sec, 11.775 real sec
[M::mem_process_seqs] Processed 419113 reads in 16.366 CPU sec, 3.573 real sec
[main] Version: 0.7.17-r1188
[main] CMD: bwa mem -t8 Trinity-GG MNt_1_trim.fastq.gz
[main] Real time: 54.819 sec; CPU: 303.178 sec
18/11/06 13:07:21

55 sec

RX300S7 E5-2667 2.9GHz 6C12T*2 139.2GFLOPS/cpu

18/11/06 13:04:24
[M::bwa_idx_load_from_disk] read 0 ALT contigs
[M::process] read 5476498 sequences (240000039 bp)...
[M::mem_process_seqs] Processed 5476498 reads in 283.738 CPU sec, 42.144 real sec
[M::process] read 2256607 sequences (98201115 bp)...
[M::mem_process_seqs] Processed 2256607 reads in 119.757 CPU sec, 12.516 real sec
[main] Version: 0.7.17-r1188
[main] CMD: bwa mem -t24 Trinity-GG MNt_1_trim.fastq.gz
[main] Real time: 72.568 sec; CPU: 415.462 sec
18/11/06 13:05:37

73 sec

RX300S7 E5-2643 3.3GHz 4C8T*2 105.6GFLOPS/cpu

18/11/06 12:54:28
[M::bwa_idx_load_from_disk] read 0 ALT contigs
[M::process] read 3649170 sequences (160000064 bp)...
[M::mem_process_seqs] Processed 3649170 reads in 185.107 CPU sec, 37.522 real sec
[M::process] read 3664822 sequences (160000072 bp)...
[M::process] read 419113 sequences (18201018 bp)...
[M::mem_process_seqs] Processed 3664822 reads in 189.660 CPU sec, 28.777 real sec
[M::mem_process_seqs] Processed 419113 reads in 21.859 CPU sec, 3.837 real sec
[main] Version: 0.7.17-r1188
[main] CMD: bwa mem -t16Trinity-GG MNt_1_trim.fastq.gz
[main] Real time: 84.943 sec; CPU: 406.781 sec
18/11/06 12:55:53

85 sec

RX200S7 E5-2620 2.00GHz 6C12T*2 96.0GFLOPS/cpu

18/11/06 13:18:06
[M::bwa_idx_load_from_disk] read 0 ALT contigs
[M::process] read 5476498 sequences (240000039 bp)...
[M::mem_process_seqs] Processed 5476498 reads in 395.009 CPU sec, 58.175 real sec
[M::process] read 2256607 sequences (98201115 bp)...
[M::mem_process_seqs] Processed 2256607 reads in 165.597 CPU sec, 17.457 real sec
[main] Version: 0.7.17-r1188
[main] CMD: bwa mem -t24 Trinity-GG MNt_1_trim.fastq.gz
[main] Real time: 98.595 sec; CPU: 576.243 sec
18/11/06 13:19:45

99 sec

RX200S6 E5630 2.54GHz 4C8T*2 no-data

18/11/06 13:01:24
[M::bwa_idx_load_from_disk] read 0 ALT contigs
[M::process] read 3649170 sequences (160000064 bp)...
[M::mem_process_seqs] Processed 3649170 reads in 247.487 CPU sec, 49.641 real sec
[M::process] read 3664822 sequences (160000072 bp)...
[M::process] read 419113 sequences (18201018 bp)...
[M::mem_process_seqs] Processed 3664822 reads in 241.258 CPU sec, 36.402 real sec
[M::mem_process_seqs] Processed 419113 reads in 27.730 CPU sec, 4.817 real sec
[main] Version: 0.7.17-r1188
[main] CMD: bwa mem -t16Trinity-GG MNt_1_trim.fastq.gz
[main] Real time: 109.888 sec; CPU: 529.980 sec
18/11/06 13:03:14

110 sec



ということでスペック通り
E3-1230 v6 > E5-2667 > E5-2643 > E5-2620 > E5630
multi cpuは単純にflops*cpu数にはやっぱりならんのな。

UPSを導入ーterastationとサーバの両方を連動してシャットダウンー

停電や不慮の電源トラブルに備えてオムロンUPSを導入した。

全サーバー群の電源を確保できるような大容量のUPSは高価なため、WEBサービス用データを保持しているヘッドノードとNFSサーバとして使っているTeraStationだけでもつないでおけるようにと、750Wのものを手配した。

うちのTeraStationUPS連動して電源異常を感知すると一定時間後にシャットダウンできる機能がついている。一方、UPSの方にも同様のユーティリティソフトが付いていて、サーバのシャットダウンができるようになっているらしい。

しかし、ここで困ったことが。UPSから異常検知シグナルを送るポートはUSB1ポートしかない。
付属ソフトでは複数台のサーバを連動してシャットダウンできる。
TeraStationは複数台ネットに接続していれば連動してシャットダウンできる。
ところがサーバとTeraStationは連動できないみたい。

こりゃTeraStationの連動機能は使わずに、サーバのシャットダウンシークエンスにTeraStationのシャットダウンも組み込むしかないか?と思ったのだが、どうもTeraStationは普通に簡単なコマンド一発でシャットダウンできるようにはなっていないらしい。

どうすりゃいいのかというとwgetでwebベースのコントロールサイトにアクセスして、webからシャットダウンボタンを押したように見せかけないとならないみたい。
そのためにはBASIC認証でログインして〜と結構面倒そうだな。

http://www.argv.org/~chome/blog/noisefactory/2010/02/tera-stationremoteshutdown.html
古いTeraStationはそもそもUPS連動機能がなかったらしく、先人のスクリプトは発見した。
これをモディファイして、同じようなことができるようにしてやらないと。

RX300S7インストール覚書

RX300S7にCentOS7をインストール。
計算ノードとして。
300GB SASドライブにシステムインストール。


一般ユーザーは作成しない。
NFSでヘッドノードの/home以下、/usr/local以下をマウント
NISでヘッドノードで作成したユーザ情報を共有

NFSのホスト:rx1330m3
NISのホスト:rx1330m3.nis
NASNFS):192.168.1.10

今設定しようとしているドメイン:192.168.1.2 y0-rx200s7

# yum install ypbind rpcbind
# yum install nano
# nano /etc/hosts
# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.1     rx1330m3 rx1330m3.nis
192.168.1.2    y0-rx200s7
192.168.1.3   y1-rx200s6
192.168.1.4   y2-rx200s6
192.168.1.5   y3-rx300s7
192.168.1.6     n1-rx300s7
192.168.1.7     n2-rx300s7

# authconfig --enablenis --nisdomain=nis --nisserver=rx1330m3 --enablemkhomedir --update
# systemctl start rpcbind ypbind
# systemctl enable rpcbind ypbind

NFSのauto mountを導入

# yum -y install nfs-utils
# nano /etc/idmapd.conf 
# cat /etc/idmapd.conf
[General]
#Verbosity = 0
# The following should be set to the local NFSv4 domain name
# The default is the host's DNS domain name.
Domain = y0-rx200s7
.........

# systemctl restart rpcbind
# nano /etc/fstab
# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Aug 13 13:07:11 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root /                       xfs     defaults	0 0
UUID=********-****-****-****-************ /boot                   xfs     defaults        0 0
/dev/mapper/centos-home /home                   xfs     defaults	0 0
/dev/mapper/centos-swap swap                    swap    defaults	0 0
rx1330m3:/usr/local  /usr/local              nfs     defaults	0 0
192.168.1.10:/mnt/array1/home /mnt/nfs  nfs     defaults  0 0

# yum -y install autofs
# nano /etc/auto.master
# cat /etc/auto.master
.........
/-    /etc/auto.mount

# nano /etc/auto.mount
# cat /etc/auto.mount
/home -fstype=nfs,rw rx1330m3:/home

# systemctl start autofs
# systemctl enable autofs

torque-client設定

# yum install -y epel-release
# yum install -y torque-client torque-mom
# nano /etc/torque/server_name
# cat /etc/torque/server_name
rx1330m3

# nano /var/lib/torque/mom_priv/config

# cat /var/lib/torque/mom_priv/config
# Configuration for pbs_mom.
$pbsserver rx1330m3
$usecp *:/home /home
$usecp *:/mnt/nfs /mnt/nfs
$log_file_suffix %h

# firewall-cmd --add-port=15001/tcp --zone=public --permanent
# firewall-cmd --add-port=15002/tcp --zone=public --permanent
# firewall-cmd --add-port=15003/tcp --zone=public --permanent
# firewall-cmd --add-port=15003/udp --zone=public --permanent
# firewall-cmd --add-port=15004/tcp --zone=public --permanent
# systemctl start pbs_mom
# systemctl enable pbs_mom

あとはbrewではなくyumでそれぞれのノードにインストールしているものを入れる。

# yum -y install java
# yum -y install perl