Artenv
artenv は Artemis の version と解析環境を管理するためのツールです.
pyenv や rbenv のように, コマンド一つで Artemis 環境と解析ディレクトリを切り替えられます.
v2 では native installation に加えて Apptainer container image も Artemis version として扱えるようになりました. Apptainer image を使うと, ROOT, yaml-cpp, Artemis を利用先の計算機ごとに用意する手間を減らせます. 解析環境をほかの計算機や共同研究者とそろえやすくなる点も利点です.
Concepts
artenv では, Artemis の実行環境と解析ディレクトリを分けて管理します.
- version: Artemis の実行環境. native installation または Apptainer image.
- environment: 実験・解析ごとの作業環境. 使用する version, working directory, git repository, artlogin の設定などを持つ.
- template: 新しい解析ディレクトリを作るためのひな形. 外部 git repository から取得して使う.
まず artenv version install や artenv version register で Artemis version を登録し,
次に artenv register で解析 environment を登録します.
登録後は次のように切り替えられます.
artenv shell h424
artenv default h424
artenv shell <env> は現在の shell だけ を切り替えます.
artenv default <env> は新しく開く shell で使うデフォルト environment を設定します.
Requirements
bashgityqv4 with TOML support- Apptainer version を使う場合は
apptainer
shell integration は bash と zsh で使えます.
Installation
git clone で artenv 本体を配置します.
git clone https://github.com/yano404/artenv.git ~/.artenv
.bashrc や .zshrc に次を追加します.
export ARTENV_ROOT="$HOME/.artenv"
export PATH="$ARTENV_ROOT/bin:$PATH"
eval "$(artenv init -)"
shell を再起動します.
exec $SHELL
Shell Completion
artenv は bash と zsh の補完を提供しています.
bash の場合は .bashrc などで補完スクリプトを読み込みます.
source "${ARTENV_ROOT}/completions/artenv.bash"
zsh の場合は fpath に補完ディレクトリを追加し, compinit を初期化します.
fpath=("${ARTENV_ROOT}/completions" $fpath)
autoload -Uz compinit
compinit
Quick Start
1. Artemis version を用意する
Apptainer を使える環境では, container image を pull して version として登録するのが簡単です.
artenv version install latest
tag を指定すると, URI, version name, SIF 保存先の入力は省略されます.
この例では artemis_apptainer-latest という version が登録され,
image は $ARTENV_ROOT/images/artemis_apptainer-latest.sif に保存されます.
利用可能な tag は次で確認できます.
artenv version install --list
対話的に Apptainer image を登録することもできます.
$ artenv version install --apptainer
Enter the pull URI [oras://ghcr.io/yano404/artemis_apptainer:latest]>
Enter the version name> artemis-latest
Enter the path to save SIF [/home/yano/.artenv/images/artemis-latest.sif]>
Configuration:
URI oras://ghcr.io/yano404/artemis_apptainer:latest
VERSION artemis-latest
SIF /home/yano/.artenv/images/artemis-latest.sif
OK? (y/N)> y
すでに .sif image を持っている場合は, それを version として登録できます.
$ artenv version register artemis-apptainer
Select version type
1) native
2) apptainer
#? 2
Enter the path to Apptainer image (.sif)> /path/to/artemis.sif
artemis-apptainer was registered
native installation を使う場合は, Artemis, ROOT, yaml-cpp の path を登録します.
$ artenv version register artemis-native
Select version type
1) native
2) apptainer
#? 1
Enter the path to artemis> /path/to/artemis
Enter the path to root> /path/to/root
Enter the path to yaml-cpp> /path/to/yaml-cpp
artemis-native was registered
source から Artemis を build して登録したい場合は --native を使います.
$ artenv version install --native
Enter the path to root> /home/yano/local/root/v6.32.04
Enter the path to yaml-cpp> /home/yano/local/yaml-cpp/v0.8.0
Enter the path to the source of artemis> /home/yano/src/artemis/develop
Enter the path to build directory> /home/yano/build/artemis/artdev
Enter the install prefix> /home/yano/local/artemis/artdev
Configuration:
ROOTSYS /home/yano/local/root/v6.32.04
YAML_CPP_LIB /home/yano/local/yaml-cpp/v0.8.0/lib
YAML_CPP_CMAKE /home/yano/local/yaml-cpp/v0.8.0/lib/cmake
ARTEMIS_SOURCE /home/yano/src/artemis/develop
BUILD_DIR /home/yano/build/artemis/artdev
INSTALL_PREFIX /home/yano/local/artemis/artdev
OK? (y/N)> y
Will you register this version to artenv? (y/N)> y
Enter the version name> artemis-native
artemis-native was registered