Skip to content

Commit

Permalink
add libtorch (#131) (#191)
Browse files Browse the repository at this point in the history
* add libtorch (#131)

* add libtorch

* update libtorch 1.6.0 -> 1.8.1

* libtorch for CUDA 11.1

* use the same command

* libtorch 1.8.1 -> 1.6.0

* add LibTorch for CUDA 11.1

* change install order

* Deprecate 18.04 support for libtorch

Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp>

* pre-commit fixes

Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp>

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>
  • Loading branch information
2 people authored and kenji-miyake committed Nov 1, 2021
1 parent 9bd45b2 commit dbaa436
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
- { role: ros2, rosdistro: galactic, tags: ["ros2"] }
- { role: autoware, rosdistro: galactic, tags: ["autoware"] }
- { role: pacmod, rosdistro: galactic, tags: ["pacmod"] }
- { role: libtorch, tags: ["libtorch"] }
2 changes: 2 additions & 0 deletions ansible/roles/libtorch/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
cuda_version: "11.1"
28 changes: 28 additions & 0 deletions ansible/roles/libtorch/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# for Ubuntu 20.04 / CUDA 11.1
- name: LibTorch (download)
when: cuda_version == '11.1'
become: yes
command: gdown https://drive.google.com/u/0/uc?id=1eNh3F3xCQ4AMJEHtwb1dhshSyzWMjoc8 -O /tmp/libtorch.zip
- name: LibTorch (unarchive)
when: cuda_version == '11.1'
become: yes
unarchive:
src: /tmp/libtorch.zip
dest: /usr/local
- name: LibTorch (install OpenMP)
become: yes
apt:
name:
- libgomp1
update_cache: yes
- name: LibTorch (replace a library file)
become: yes
command: cp /usr/lib/x86_64-linux-gnu/libgomp.so.1 /usr/local/libtorch/lib/libgomp-75eea7e8.so.1
- name: LibTorch (add library >> bashrc)
become: no
lineinfile:
dest: ~/.bashrc
line: export LD_LIBRARY_PATH="/usr/local/libtorch/lib:$LD_LIBRARY_PATH"
state: present
# ref: https://discuss.pytorch.org/t/libtorch-code-integration-failed-with-error-version-gomp-4-5-not-found/119545
# ref: https://github.com/pytorch/pytorch/issues/643#issuecomment-294269589

0 comments on commit dbaa436

Please sign in to comment.