Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IssacLabの実行環境の起動方法 #3

Open
yasuohayashibara opened this issue Jun 16, 2024 · 3 comments
Open

IssacLabの実行環境の起動方法 #3

yasuohayashibara opened this issue Jun 16, 2024 · 3 comments

Comments

@yasuohayashibara
Copy link
Member

yasuohayashibara commented Jun 16, 2024

IssacLabの実行環境の起動方法

以下にしたがってdockerの環境を用意する.
https://isaac-sim.github.io/IsaacLab/source/deployment/docker.html#

dockerのフォルダで

コンテナ開始
./container.sh start

コンテナに入る
./container.sh enter base

@yasuohayashibara yasuohayashibara changed the title IssacLabno IssacLabの実行環境の起動方法 Jun 16, 2024
@aiba0921
Copy link

aiba0921 commented Jul 22, 2024

Dockerのインストールから学習の実行までの手順

※実行までに発生したエラーなど追記予定
公式のドキュメントに準拠

実行環境

  • OS:Ubuntu20.04 LTS
  • GPU:NVIDIA GeForce RTX 4070 Ti
  • GPU driver version:535.183.01

Dockerのインストール

  1. ドキュメントにあるURLからDockerのウェブサイトに移動しUbuntuを選択
  2. Docker desktopのインストール方法が記載されているがUbuntuは対応していないためapt形式でインストールすると記載されたページに移動
  3. Install using the repository aptの手順に従いDocker Engineをインストールする
  • ドキュメントではこの後Docker composeをインストールするとあるがDocker Engineと同時にインストールされている
  1. ドキュメントから Dockerのインストール後の手順のページに移動しdocker run等のコマンドを使用する際にsudoを入れずに実行できるようにする

NVIDIA Container Toolkitのインストール

  1. apt形式でインストールする手順で進める
  • Docker上でGPUを使おうとした場合に NVIDIA Container Runtimeが無いというエラーが発生した場合には 同じページの「Configuring Docker」の手順で NVIDIA Container Runtimeを使えるようにする
  1. Running a Sample Workloadのページを参考に以下を入力
docker run --rm --gpus all nvidia/cuda:12.2.0-runtime-ubuntu20.04 nvidia-smi

Container Toolkitが正常にインストールされていればnvidia-smiを入力した時と同様の出力が帰ってくる。cudaとubuntuのバージョンは各々の環境に合わせる。

  • 発生したエラーとその対処
    先程のコマンドを入力した際に以下のようなエラーが出ることがある
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'
nvidia-container-cli: initialization error: load library failed: libnvidia-ml.so.1: cannot open shared object file: no such file or directory: unknown.

原因はContainer Toolkitをインストールした際に自動的にDockerがインストールされてしまいDockerが2つ存在するような状態になってしまうことらしい。対処法としては以下を入力しDockerを一旦削除してからもう一度Dockerを入れ直すことで解決した

sudo apt remove docker*
sudo apt remove docker docker-engine docker.io containerd runc docker-desktop docker-compose-plugin
sudo snap remove docker
sudo apt clean autoclean && sudo apt autoremove --yes
Failed to initialize NVML: Unknown Error

こちらのページを参考に以下を入力

sudo vim /etc/nvidia-container-runtime/config.toml

config.toml内のno-cgroups = trueとなっている部分をno-cgroups = falseに変更し、以下を入力してnvidia-smiと同様の出力がされるか確認する

sudo systemctl restart docker
docker run --rm --gpus all nvidia/cuda:12.2.0-runtime-ubuntu20.04 nvidia-smi

NGC CLI をインストール

  • こちらのページからインストールする
  • この手順を踏まないとngc config setを入力してもそんなもの存在しないというエラーが出る

Docker上でIsaac Simを使用できるようにする

  1. 8.3. Generating NGC API Keysに従いAPI Keyを生成した後に以下コマンドを実行
ngc config set
docker login nvcr.io
Username: $oauthtoken
Password: <Your NGC API Key>
  • 発生したエラーと対処方法
    docker login nvcr.ioでログインしようとした際に
Error saving credentials: error storing credentials - err: exit status 1, out: `error storing credentials - err: exit status 1, out: `pass not initialized: exit status 1: Error: password store is empty. Try "pass init".``

というエラーが出た場合は

service docker stop
rm ~/.docker/config.json
service docker start

を入力すると再度ユーザー名とパスワードが求められ、ログインできるようになる
2. こちらのページの手順に従い Docker上でIsaac Simを使用できるようにする

Isaac Labの実行

https://github.com/isaac-sim/IsaacLab.git
を実行しIsaac Labのリポジトリをpullする

  1. Isaac Labのディレクトリ内に移動し以下を実行しコンテナを開始し中に入る
./docker/container.sh start
./docker/container.sh enter base

サンプルの実行

例:H1の歩行の学習

  1. 学習の開始
./isaaclab.sh -p source/standalone/workflows/rsl_rl/train.py --task Isaac-Velocity-Flat-H1-v0 --headless

2.学習済みモデルの確認

./isaaclab.sh -p source/standalone/workflows/rsl_rl/play.py --task Isaac-Velocity-Flat-H1-v0 --num_envs 32 --load_run 2024-07-09_16-38-08 --checkpoint model_999.pt
  • 「2024-07-09_16-38-08」の部分は学習を開始した時間によって異なる

@HarukiOgawa1
Copy link

HarukiOgawa1 commented Nov 19, 2024

ML3で環境構築

主な流れは#3 (comment) と同じである.
server係と利用者が行う範囲を分けて説明する.

server係(既にインストールされているはず)

  • NVIDIA ドライバー
  • CUDA Toolkit
  • Docker
  • NVIDIA Container Toolkit

利用者

  • Omniverse Isaac Sim コンテナの構築
  1. nvidia-smiでGPU driver versionの確認
  2. NGC API Key の生成(3. のパスワードになるため)
  3. Isaac Sim コンテナをgit pullする前に、コマンドラインを使用して NGC にログインする
    以下,例
harukiogawa@harukiogawa-XPS-8960:~$ docker login nvcr.io
Username: $oauthtoken
Password: 
WARNING! Your password will be stored unencrypted in /home/harukiogawa/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credential-stores

Login Succeeded
  1. Pull the Isaac Sim container
docker pull nvcr.io/nvidia/isaac-sim:4.2.0
  1. Run the Isaac Sim container with an interactive Bash session:
harukiogawa@harukiogawa-XPS-8960:~$ docker run --name isaac-sim --entrypoint bash -it --runtime=nvidia --gpus all -e "ACCEPT_EULA=Y" --rm --network=host \
     -e "PRIVACY_CONSENT=Y" \
     -v ~/docker/isaac-sim/cache/kit:/isaac-sim/kit/cache:rw \
     -v ~/docker/isaac-sim/cache/ov:/root/.cache/ov:rw \
     -v ~/docker/isaac-sim/cache/pip:/root/.cache/pip:rw \
     -v ~/docker/isaac-sim/cache/glcache:/root/.cache/nvidia/GLCache:rw \
     -v ~/docker/isaac-sim/cache/computecache:/root/.nv/ComputeCache:rw \
     -v ~/docker/isaac-sim/logs:/root/.nvidia-omniverse/logs:rw \
     -v ~/docker/isaac-sim/data:/root/.local/share/ov/data:rw \
     -v ~/docker/isaac-sim/documents:/root/Documents:rw \
     nvcr.io/nvidia/isaac-sim:4.2.0
  1. Isaac Labをclone
git clone https://github.com/isaac-sim/IsaacLab.git
  1. 後は同じ

@HarukiOgawa1
Copy link

Isaac LabのDocker コンテナ内に保存されているデータをホストマシンにコピーする方法

python3 docker/container.py copy

以下,例

harukiogawa@harukiogawa-XPS-8960:~/IsaacLab/docker$ python3 container.py copy
[INFO] Using container profile: base
[INFO] Copying artifacts from the 'isaac-lab-base' container...

	 -/workspace/isaaclab/logs -> /home/harukiogawa/IsaacLab/docker/artifacts/logs
	 -/workspace/isaaclab/docs/_build -> /home/harukiogawa/IsaacLab/docker/artifacts/docs
	 -/workspace/isaaclab/data_storage -> /home/harukiogawa/IsaacLab/docker/artifacts/data_storage
Successfully copied 5.32GB to /home/harukiogawa/IsaacLab/docker/artifacts/logs
Successfully copied 1.54kB to /home/harukiogawa/IsaacLab/docker/artifacts/docs
Successfully copied 1.54kB to /home/harukiogawa/IsaacLab/docker/artifacts/data_storage

[INFO] Finished copying the artifacts from the container.

harukiogawa@harukiogawa-XPS-8960:~/IsaacLab/docker/artifacts$ l
data_storage/  docs/  logs/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants