LoginSignup
0
0

ABCI

Last updated at Posted at 2024-01-21

登録

  • メールから初回ログイン
  • パスワード変更
  • SSH公開鍵・秘密鍵ペアの生成
$ ssh-keygen -t rsa -b 2048 -m pem
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/tefu/.ssh/id_rsa):
/Users/tefu/.ssh/id_rsa already exists.
# 既にあった
Overwrite (y/n)? n

既にあるらしい公開鍵を確認する。

$ ls ~/.ssh/
id_rsa		id_rsa.pub	known_hosts

id_rsa … 秘密鍵
id_rsa.pub … 公開鍵
確かに既にある。
登録用に公開鍵の中身を表示。

$ cat ~/.ssh/id_rsa.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKHdTEuEXlhkM3MvyhGe1FNNWLEhgRWHkcig8ZsKegY9uQlHf0CIEXAqR50f2iYURf6qXT2eNX+SzJ3ikd0R1mWteIaCSSLpPN4xAMb4uX4TNMQSC5JYX9YkKtQkxkaYwUstnQalmWD/aKq6MGppl/4Vsq263ae28E/nCy2PAVqtlBkvqRb0DoMmjjZTAZQmyRlbss/JHUl6RoBqY9cvA1ntDNw0LPo/BwRcL4ctOlotWGK9OtlBpoCXZsmsILT+2hdHg0bw/jR033Ygfbpf/+cXy2LzIw9hDNzv9l9xyOjRhJmdJZC1jRbsc33g43rru7DuccWyy5HQNGhppuq1t3 tefu@tefuko.local

.local……?
細かいことは気にしないでおく。

  • SSH公開鍵の登録

ssh-rsa ~ t3 tefu@tefuko.localまで全てコピーして、
公開鍵の登録 → 直接入力 → 貼り付け

利用方法

  • アクセスサーバへログイン
$ ssh -i ~/.ssh/id_rsa(秘密鍵のPATH) -L 10022:es:22 -l xxx(アカウント名) as.abci.ai
The authenticity of host 'as.abci.ai (163.220.128.221)' can't be established.
ECDSA key fingerprint is SHA256:xxxxx/g.
# ↑ 初回ログイン時のみ表示
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'as.abci.ai,163.220.128.221' (ECDSA) to the list of known hosts.

Welcome to ABCI access server.
Please press any key if you disconnect this session.
# ↑ この2行が出たらログイン成功

!!!注意!!!
ログイン成功メッセージが出た状態で何らかのキーを入力すると、SSH接続が切断される

  • インタラクティブノードにログイン

別のターミナルを起動する。

$ ssh -i ~/.ssh/id_rsa(秘密鍵のPATH) -p 10022 -l xxx(アカウント名) localhost
The authenticity of host '[localhost]:10022 ([127.0.0.1]:10022)' can't be established.
ECDSA key fingerprint is SHA256:xxxxx/g.
# ↑ 初回ログイン時のみ表示
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[localhost]:10022' (ECDSA) to the list of known hosts.
--------------------------------------------------------------------------------
  ABCI Information                                           Date: Oct 20, 2020
--------------------------------------------------------------------------------

  Welcome to ABCI system

  - Operation Schedule
    11/30 (Mon)  3:00 - 11/30 (Mon)  4:00 Network maintenance
      Due to the network maintenance, network communication between ABCI and
      INTERNET will be down for at max 60 minutes.
      ABCI User Portal and access to the interactive nodes will be unavailable.
      Since ABCI internal network is available, the batch job services will not
      be affected.

    12/10 (Thu) 12:30 - 12/11 (Fri) 13:00 All of the compute nodes, including the
                                          memory-intensive nodes, are unavailable
                                          due to the ABCI Grand Challenge 2020#3.
    12/11 (Fri) 13:00 - 12/15 (Tue) 17:00 Not in Service (Planned Power Outage)


    For more information, please see
    - https://abci.ai/en/about_abci/info.html (In English)
    - https://abci.ai/ja/about_abci/info.html (In Japanese)

  - How to use
    Please see below for ABCI Users Guide:

    - https://docs.abci.ai/en/ (In English)
    - https://docs.abci.ai/ja/ (In Japanese)

  If you have any questions or need for further assistance,
  please refer to the following URL and contact us:

    - https://abci.ai/en/how_to_use/user_support.html (In English)
    - https://abci.ai/ja/how_to_use/user_support.html (In Japanese)

ログインに成功すると、ローカルから[xxx@es3 ~]$ と変わっている。

ProxyJumpの設定

$ ls ~/.ssh
id_rsa		id_rsa.pub
  • configがなければ作成する。
$ chmod 700 .ssh
$ touch ~/.ssh/config
$ ls ~/.ssh
config		id_rsa		id_rsa.pub
  • config書き換え
$ echo 'Host abci
>      Hostname es
>      User xxx(アカウント名)
>      ProxyJump %r@as.abci.ai
>      IdentityFile ~/.ssh/id_rsa(秘密鍵のPATH)
> 
> Host as.abci.ai
>      IdentityFile ~/.ssh/id_rsa' > ~/.ssh/config(秘密鍵のPATH)
# 確認
$ cat ~/.ssh/config
Host abci
     Hostname es
     User xxx
     ProxyJump %r@as.abci.ai
     IdentityFile ~/.ssh/id_rsa

Host as.abci.ai
     IdentityFile ~/.ssh/id_rsa

以降は、$ ssh abciと打つだけでログインできる。

.bash_profile 設定

ログアウトで消えない環境変数を作る。

$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

$ vi .bash_profile
# 入力モードへ
export ID_USER=xxx(アカウント名)
export ID_GROUP=gcc00000(グループID)
export EMAIL=(アドレス)
# ↑ 書き足す

# Shift + Q → :wq(セーブして入力モード終了)

$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH
export ID_USER=xxx(アカウント名)
export ID_GROUP=gcc00000(グループID)
export EMAIL=(アドレス)

Python仮想環境設定

$ module load python/3.6/3.6.5
$ python3 --version
Python 3.6.5
$ python3 -m venv work
$ source work/bin/activate
$ which python3
~/work/bin/python3
$ which pip3
~/work/bin/pip3
# ↑ pip使えるように
$ pip3 install numpy
Collecting numpy
# ↑ numpy install

VSCode上で動かす

  • Remote Development拡張機能をインストール
  • VSCodeの左下にあるRemote-SSHのアイコンをクリックし、Remote-SSH: Connect to Hostを選択
  • abciを選択
  • 何か出てきたらcontinue
  • ターミナルの表示名がアカウント名に変わっていればOK
  • Open Folderで先ほど作成したworkを開く

!!!注意!!!
ローカルでインストールしていた拡張機能は反映されないため、拡張機能による環境設定を新たに行う必要がある。
image.png

Python3コマンドが認識されなかったので、SSH接続済みVSCode上で再びモジュールをいれる。

$ module load python/3.6/3.6.5
$ python3 --version
Python 3.6.5

$ module load cuda/10.0/10.0.130.1
  • ポート設定
    VSCode下のバーに使用可能なポートがありませんと表示されている部分をクリック
    ポート番号10022を登録

左下のPythonが2系しか選べない → pyenvで解消

$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile
$ pyenv --version
pyenv 1.2.21-1-g943015e
# ↑ これ出たらOK

$ pyenv install 3.6.5
$ pyenv global 3.6.5
  1. 左下のPython2.7.5
  2. Enter interpreter path…
  3. Find…
  4. /home/acc12954dm(アカウント)/.pyenv/versions/3.6.5/bin/python3.6
  5. 左下がPython 3.6.5に切り替わっていることを確認

settings.json

"python.pythonPath": "/home/acc12954dm/.pyenv/versions/3.6.5/bin/python3.6"

# あとはlocalのsettings.jsonをコピペ

pip3

pip3をupgrade

$ pip3 install --user --upgrade pip

pip3でinstallするものの保存先を~/local下にする

$ pip3 install hogehoge --user

ジョブ実行

ジョブサービスには3種類ある。

  • On-demandサービス … 対話形式、インタラクティブジョブ
  • Spotサービス … 対話的処理の必要がないアプリケーションの実行、バッチジョブ
  • Reservedサービス … 日単位での利用、事前予約制
サービス名 資源タイプ名 経過時間制限(上限値/デフォルト)
On-demand rt_F 12:00:00/1:00:00
rt_G.large, rt_C.large, rt_M.large 12:00:00/1:00:00
rt_G.small, rt_C.small, rt_M.small 12:00:00/1:00:00
Spot rt_F 72:00:00/1:00:00
rt_G.large, rt_C.large, rt_M.large, rt_M.small 72:00:00/1:00:00
rt_G.small, rt_C.small 168:00:00/1:00:00
Reserved rt_F 無制限
rt_G.large, rt_C.large 無制限
rt_G.small, rt_C.small 無制限

とりあえずrt_G.small使えばいいと思う。GPU1つで十分なら。
違いはコア数など。よく分からない。

ジョブ実行オプション

qrsh … インタラクティブジョブの実行
qsub … バッチジョブの実行

共通主要オプション

オプション 説明
-g group ABCI利用グループをgroupで指定
-l resource_type=num 資源タイプresource_typeと、その個数numを指定。!!!指定必須!!!
-l h_rt=[HH:MM:]SS 経過時間制限値を指定。ジョブの実行時間が指定した時間を超過した場合、ジョブは強制終了される
-N name ジョブ名をnameで指定。デフォルトは、ジョブスクリプト名
-o stdout_name 標準出力名をstdout_nameで指定
-p priority SpotサービスでPOSIX優先度をpriorityで指定
-e stderr_name 標準エラー出力名をstderr_nameで指定
-j y 標準エラー出力を標準出力にマージする
-m a ジョブが実行中止された場合にメールを送信
-m b ジョブ実行開始時にメールを送信
-m e ジョブ実行終了時にメールを送信
-t n[-m[:s]] アレイジョブのタスクIDをn[-m[:s]]で指定。n:開始番号、m:終了番号、s:ステップサイズ
-hold_jid job_id 依存関係にあるジョブIDをjob_idで指定。指定された依存ジョブが終了するまでジョブは実行開始されない
-ar ar_id 予約した計算ノードを利用する際に予約ID(AR-ID)をar_idで指定

インタラクティブジョブ(On-demand)

[xxx@es3 work]$ qrsh -g gcc50582(グループ名) -l rt_G.small=1(rt_G.smallタイプを1つ) -l h_rt=01:30:00(1h30m) (必要に応じてその他オプション)
[xxx@g0136 ~]$
# ↑ @以降が変わればジョブ使用中

# ジョブ制限時間を過ぎると…
[xxx@es3 work]$
# ↑ @以降が元に戻る
# 中断されるものがなければ通知などはない(中断するものがあればさすがに通知くるかな?)

インタラクティブジョブ(Reserved)

$ qrsh -g gcc00000(グループ名) -ar 0000(予約ID) -l rt_G.small=1 -l h_rt=01:30:00
[xxx@g0136 ~]$

バッチジョブ(Spot)

$ qsub -g gcc50582(グループ名) run.sh(実行するジョブスクリプト) -l rt_G.small=1
Your job 12345 ("run.sh") has been submitted

バッチジョブ(Reserved)

$ qsub -g gcc00000(グループ名) -ar 0000(予約ID) run.sh(実行するジョブスクリプト) -l rt_G.small=1
Your job 12345 ("run.sh") has been submitted

バッチジョブの状態確認

qstat … バッチジョブの状態確認コマンド

オプション 説明
-r ジョブのリソース情報を表示
-j ジョブに関する追加情報を表示

$ qstat
job-ID   prior    name      user     state    submit/start at 
queue      jclass    slots     ja-task-ID
-------------------------------------------------------------------------------------------------------
12345   0.25586   run.sh   username    r     06/27/2018 21:14:49
gpu@g0001     -        80          -   
項目 説明
job-ID ジョブID
prior ジョブ優先度
name ジョブ名
user ジョブのオーナー
state ジョブ状態 (r: 実行中、qw: 待機中、d: 削除中、E: エラー状態)
submit/start at ジョブ投入/開始時刻
queue キュー名
jclass ジョブクラス名
slots ジョブスロット数 (ノード数 x 80)
ja-task-ID アレイジョブのタスクID

バッチジョブの削除

qdel … バッチジョブの削除コマンド

$ qstat
job-ID   prior    name     user      state    submit/start at       queue      jclass    slots   ja-task-ID
------------------------------------------------------------------------------------------------------------------------
12345   0.25586  run.sh   username     r     06/27/2018 21:14:49   gpu@g0001      -       80         -
$ qdel 12345
username has registered the job 12345 for deletion

GPUを止める

$ exit

Git

gitのバージョンが低いのは諦め。

$ git clone https://github.com/xxx/Translation.git

cloneしたのに当該ファイルが作成されない場合は、cloneしたファイル名で新規ファイルを作成すると、その下にcloneしてきたものが入っている。

git pullなどを使えるようにする。

$ git remote add origin https://github.com/xxx/Translation.git
$ git remote -v
origin  https://github.com/xxx/Translation.git (fetch)
origin  https://github.com/xxx/Translation.git (push)

VSCode左下main → チェックアウトする参照を選択 → origin/main

$ git branch -v
* main 05966d2 Transformer

!!!注意!!!
GPU使用中は git add *git add -A

Spack

よくわかってないけど、これ使うと一々module入れ直さなくて済む???

$ git clone https://github.com/spack/spack.git
$ cd ./spack
$ git checkout v0.13.3

$ cd ..
$ cd .spack
$ cd linux
$ vi packages.yaml

# ↓ 貼り付け
packages:
  cuda:
    paths:
      cuda@abci-8.0.61.2:   /apps/cuda/8.0.61.2
      cuda@abci-9.0.176.4:  /apps/cuda/9.0.176.4
      cuda@abci-9.1.85.3:   /apps/cuda/9.1.85.3
      cuda@abci-9.2.148.1:  /apps/cuda/9.2.148.1
      cuda@abci-10.0.130.1: /apps/cuda/10.0.130.1
      cuda@abci-10.1.243:   /apps/cuda/10.1.243
      cuda@abci-10.2.89:    /apps/cuda/10.2.89
    buildable: False
  openmpi:
    paths:
      openmpi@abci-2.1.6-nocuda%gcc@4.8.5: /apps/openmpi/2.1.6/gcc4.8.5
      openmpi@abci-3.1.3-nocuda%gcc@4.8.5: /apps/openmpi/3.1.3/gcc4.8.5
  mvapich2:
    paths:
      mvapich2@abci-2.3-nocuda%gcc@4.8.5:   /apps/mvapich2/2.3/gcc4.8.5
      mvapich2@abci-2.3.2-nocuda%gcc@4.8.5: /apps/mvapich2/2.3.2/gcc4.8.5
  cmake:
    paths:
      cmake@abci-3.11.4: /apps/cmake/3.11.4
  all:
    compiler: [gcc@4.8.5]

# :wq で終了

なんとなくやってみ(ようとし)たこと一覧

  • pip3 install hoge --user → localに入れられる?
  • PATHを通す(いろいろ触った)

よく使うコマンド置き場

qrsh -g gcc50582 -l rt_G.small=1 -l h_rt=01:00:00

module load python/3.6/3.6.5

参考(色々見すぎて全然書けてない)

0
0
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
0
0