Submit Search
Upload
「今日から使い切る」ための GNU Parallelによる並列処理入門
•
23 likes
•
21,979 views
K
Koji Matsuda
Follow
東北大学 乾・岡崎研究室で 2016/01/25 に行われた研究会でショートトークを行った際に使用した GNU Parallel のイントロダクションです。
Read less
Read more
Software
Report
Share
Report
Share
1 of 14
Download now
Download to read offline
Recommended
モデル高速化百選
モデル高速化百選
Yusuke Uchida
合成変量とアンサンブル:回帰森と加法モデルの要点
合成変量とアンサンブル:回帰森と加法モデルの要点
Ichigaku Takigawa
最近のKaggleに学ぶテーブルデータの特徴量エンジニアリング
最近のKaggleに学ぶテーブルデータの特徴量エンジニアリング
mlm_kansai
Transformerを多層にする際の勾配消失問題と解決法について
Transformerを多層にする際の勾配消失問題と解決法について
Sho Takase
勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)
勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)
RyuichiKanoh
【DL輪読会】Toolformer: Language Models Can Teach Themselves to Use Tools
【DL輪読会】Toolformer: Language Models Can Teach Themselves to Use Tools
Deep Learning JP
深層学習の数理
深層学習の数理
Taiji Suzuki
【メタサーベイ】基盤モデル / Foundation Models
【メタサーベイ】基盤モデル / Foundation Models
cvpaper. challenge
Recommended
モデル高速化百選
モデル高速化百選
Yusuke Uchida
合成変量とアンサンブル:回帰森と加法モデルの要点
合成変量とアンサンブル:回帰森と加法モデルの要点
Ichigaku Takigawa
最近のKaggleに学ぶテーブルデータの特徴量エンジニアリング
最近のKaggleに学ぶテーブルデータの特徴量エンジニアリング
mlm_kansai
Transformerを多層にする際の勾配消失問題と解決法について
Transformerを多層にする際の勾配消失問題と解決法について
Sho Takase
勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)
勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)
RyuichiKanoh
【DL輪読会】Toolformer: Language Models Can Teach Themselves to Use Tools
【DL輪読会】Toolformer: Language Models Can Teach Themselves to Use Tools
Deep Learning JP
深層学習の数理
深層学習の数理
Taiji Suzuki
【メタサーベイ】基盤モデル / Foundation Models
【メタサーベイ】基盤モデル / Foundation Models
cvpaper. challenge
モデルアーキテクチャ観点からの高速化2019
モデルアーキテクチャ観点からの高速化2019
Yusuke Uchida
最適化超入門
最適化超入門
Takami Sato
【DL輪読会】Scaling Laws for Neural Language Models
【DL輪読会】Scaling Laws for Neural Language Models
Deep Learning JP
優れた研究論文の書き方―7つの提案
優れた研究論文の書き方―7つの提案
Masanori Kado
Deeplearning輪読会
Deeplearning輪読会
正志 坪坂
Tensor コアを使った PyTorch の高速化
Tensor コアを使った PyTorch の高速化
Yusuke Fujimoto
機械学習を民主化する取り組み
機械学習を民主化する取り組み
Yoshitaka Ushiku
Active Learning 入門
Active Learning 入門
Shuyo Nakatani
GiNZAで始める日本語依存構造解析 〜CaboCha, UDPipe, Stanford NLPとの比較〜
GiNZAで始める日本語依存構造解析 〜CaboCha, UDPipe, Stanford NLPとの比較〜
Megagon Labs
[DL輪読会]Attention Is All You Need
[DL輪読会]Attention Is All You Need
Deep Learning JP
Machine learning CI/CD with OSS
Machine learning CI/CD with OSS
yusuke shibui
強化学習の基礎と深層強化学習(東京大学 松尾研究室 深層強化学習サマースクール講義資料)
強化学習の基礎と深層強化学習(東京大学 松尾研究室 深層強化学習サマースクール講義資料)
Shota Imai
【DL輪読会】言語以外でのTransformerのまとめ (ViT, Perceiver, Frozen Pretrained Transformer etc)
【DL輪読会】言語以外でのTransformerのまとめ (ViT, Perceiver, Frozen Pretrained Transformer etc)
Deep Learning JP
最適輸送の解き方
最適輸送の解き方
joisino
研究効率化Tips Ver.2
研究効率化Tips Ver.2
cvpaper. challenge
全力解説!Transformer
全力解説!Transformer
Arithmer Inc.
[DL輪読会]Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasets
[DL輪読会]Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasets
Deep Learning JP
【DL輪読会】ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders
【DL輪読会】ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders
Deep Learning JP
【論文読み会】Deep Clustering for Unsupervised Learning of Visual Features
【論文読み会】Deep Clustering for Unsupervised Learning of Visual Features
ARISE analytics
Curriculum Learning (関東CV勉強会)
Curriculum Learning (関東CV勉強会)
Yoshitaka Ushiku
スタート形態素解析
スタート形態素解析
tod esking
Sintesis informativa 03 de marzo 2017
Sintesis informativa 03 de marzo 2017
megaradioexpress
More Related Content
What's hot
モデルアーキテクチャ観点からの高速化2019
モデルアーキテクチャ観点からの高速化2019
Yusuke Uchida
最適化超入門
最適化超入門
Takami Sato
【DL輪読会】Scaling Laws for Neural Language Models
【DL輪読会】Scaling Laws for Neural Language Models
Deep Learning JP
優れた研究論文の書き方―7つの提案
優れた研究論文の書き方―7つの提案
Masanori Kado
Deeplearning輪読会
Deeplearning輪読会
正志 坪坂
Tensor コアを使った PyTorch の高速化
Tensor コアを使った PyTorch の高速化
Yusuke Fujimoto
機械学習を民主化する取り組み
機械学習を民主化する取り組み
Yoshitaka Ushiku
Active Learning 入門
Active Learning 入門
Shuyo Nakatani
GiNZAで始める日本語依存構造解析 〜CaboCha, UDPipe, Stanford NLPとの比較〜
GiNZAで始める日本語依存構造解析 〜CaboCha, UDPipe, Stanford NLPとの比較〜
Megagon Labs
[DL輪読会]Attention Is All You Need
[DL輪読会]Attention Is All You Need
Deep Learning JP
Machine learning CI/CD with OSS
Machine learning CI/CD with OSS
yusuke shibui
強化学習の基礎と深層強化学習(東京大学 松尾研究室 深層強化学習サマースクール講義資料)
強化学習の基礎と深層強化学習(東京大学 松尾研究室 深層強化学習サマースクール講義資料)
Shota Imai
【DL輪読会】言語以外でのTransformerのまとめ (ViT, Perceiver, Frozen Pretrained Transformer etc)
【DL輪読会】言語以外でのTransformerのまとめ (ViT, Perceiver, Frozen Pretrained Transformer etc)
Deep Learning JP
最適輸送の解き方
最適輸送の解き方
joisino
研究効率化Tips Ver.2
研究効率化Tips Ver.2
cvpaper. challenge
全力解説!Transformer
全力解説!Transformer
Arithmer Inc.
[DL輪読会]Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasets
[DL輪読会]Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasets
Deep Learning JP
【DL輪読会】ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders
【DL輪読会】ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders
Deep Learning JP
【論文読み会】Deep Clustering for Unsupervised Learning of Visual Features
【論文読み会】Deep Clustering for Unsupervised Learning of Visual Features
ARISE analytics
Curriculum Learning (関東CV勉強会)
Curriculum Learning (関東CV勉強会)
Yoshitaka Ushiku
What's hot
(20)
モデルアーキテクチャ観点からの高速化2019
モデルアーキテクチャ観点からの高速化2019
最適化超入門
最適化超入門
【DL輪読会】Scaling Laws for Neural Language Models
【DL輪読会】Scaling Laws for Neural Language Models
優れた研究論文の書き方―7つの提案
優れた研究論文の書き方―7つの提案
Deeplearning輪読会
Deeplearning輪読会
Tensor コアを使った PyTorch の高速化
Tensor コアを使った PyTorch の高速化
機械学習を民主化する取り組み
機械学習を民主化する取り組み
Active Learning 入門
Active Learning 入門
GiNZAで始める日本語依存構造解析 〜CaboCha, UDPipe, Stanford NLPとの比較〜
GiNZAで始める日本語依存構造解析 〜CaboCha, UDPipe, Stanford NLPとの比較〜
[DL輪読会]Attention Is All You Need
[DL輪読会]Attention Is All You Need
Machine learning CI/CD with OSS
Machine learning CI/CD with OSS
強化学習の基礎と深層強化学習(東京大学 松尾研究室 深層強化学習サマースクール講義資料)
強化学習の基礎と深層強化学習(東京大学 松尾研究室 深層強化学習サマースクール講義資料)
【DL輪読会】言語以外でのTransformerのまとめ (ViT, Perceiver, Frozen Pretrained Transformer etc)
【DL輪読会】言語以外でのTransformerのまとめ (ViT, Perceiver, Frozen Pretrained Transformer etc)
最適輸送の解き方
最適輸送の解き方
研究効率化Tips Ver.2
研究効率化Tips Ver.2
全力解説!Transformer
全力解説!Transformer
[DL輪読会]Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasets
[DL輪読会]Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasets
【DL輪読会】ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders
【DL輪読会】ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders
【論文読み会】Deep Clustering for Unsupervised Learning of Visual Features
【論文読み会】Deep Clustering for Unsupervised Learning of Visual Features
Curriculum Learning (関東CV勉強会)
Curriculum Learning (関東CV勉強会)
Viewers also liked
スタート形態素解析
スタート形態素解析
tod esking
Sintesis informativa 03 de marzo 2017
Sintesis informativa 03 de marzo 2017
megaradioexpress
研究生のためのC++ no.5
研究生のためのC++ no.5
Tomohiro Namba
Cecibel curimilma blog
Cecibel curimilma blog
Cecibel Curimilma
M3 Imp Unitwise
M3 Imp Unitwise
Math Arulselvan
Agenda cecibel
Agenda cecibel
Cecibel Curimilma
Practica n1 ceci
Practica n1 ceci
Cecibel Curimilma
Practica funciones (1)
Practica funciones (1)
Cecibel Curimilma
Taller Música
Taller Música
analabradorcra
Taller Informática
Taller Informática
analabradorcra
Taller Inglés
Taller Inglés
analabradorcra
Guía aval 3
Guía aval 3
analabradorcra
Quiz on computing scientists
Quiz on computing scientists
SabahtHussein
Professionalism
Professionalism
Greg Tampus
15分でざっくり分かるScala入門
15分でざっくり分かるScala入門
SatoYu1ro
Nuevas tecnologías
Nuevas tecnologías
Carolina Cardoso
知識を紡ぐための言語処理と、そのための言語資源
知識を紡ぐための言語処理と、そのための言語資源
Koji Matsuda
Spiderストレージエンジンのご紹介
Spiderストレージエンジンのご紹介
Kentoku
Viewers also liked
(18)
スタート形態素解析
スタート形態素解析
Sintesis informativa 03 de marzo 2017
Sintesis informativa 03 de marzo 2017
研究生のためのC++ no.5
研究生のためのC++ no.5
Cecibel curimilma blog
Cecibel curimilma blog
M3 Imp Unitwise
M3 Imp Unitwise
Agenda cecibel
Agenda cecibel
Practica n1 ceci
Practica n1 ceci
Practica funciones (1)
Practica funciones (1)
Taller Música
Taller Música
Taller Informática
Taller Informática
Taller Inglés
Taller Inglés
Guía aval 3
Guía aval 3
Quiz on computing scientists
Quiz on computing scientists
Professionalism
Professionalism
15分でざっくり分かるScala入門
15分でざっくり分かるScala入門
Nuevas tecnologías
Nuevas tecnologías
知識を紡ぐための言語処理と、そのための言語資源
知識を紡ぐための言語処理と、そのための言語資源
Spiderストレージエンジンのご紹介
Spiderストレージエンジンのご紹介
More from Koji Matsuda
Reading Wikipedia to Answer Open-Domain Questions (ACL2017) and more...
Reading Wikipedia to Answer Open-Domain Questions (ACL2017) and more...
Koji Matsuda
KB + Text => Great KB な論文を多読してみた
KB + Text => Great KB な論文を多読してみた
Koji Matsuda
Large-Scale Information Extraction from Textual Definitions through Deep Syn...
Large-Scale Information Extraction from Textual Definitions through Deep Syn...
Koji Matsuda
場所参照表現タグ付きコーパスの構築と評価
場所参照表現タグ付きコーパスの構築と評価
Koji Matsuda
Entity linking meets Word Sense Disambiguation: a unified approach(TACL 2014)の紹介
Entity linking meets Word Sense Disambiguation: a unified approach(TACL 2014)の紹介
Koji Matsuda
いまさら聞けない “モデル” の話 @DSIRNLP#5
いまさら聞けない “モデル” の話 @DSIRNLP#5
Koji Matsuda
Practical recommendations for gradient-based training of deep architectures
Practical recommendations for gradient-based training of deep architectures
Koji Matsuda
Align, Disambiguate and Walk : A Unified Approach forMeasuring Semantic Simil...
Align, Disambiguate and Walk : A Unified Approach forMeasuring Semantic Simil...
Koji Matsuda
Joint Modeling of a Matrix with Associated Text via Latent Binary Features
Joint Modeling of a Matrix with Associated Text via Latent Binary Features
Koji Matsuda
Vanishing Component Analysis
Vanishing Component Analysis
Koji Matsuda
A Machine Learning Framework for Programming by Example
A Machine Learning Framework for Programming by Example
Koji Matsuda
Information-Theoretic Metric Learning
Information-Theoretic Metric Learning
Koji Matsuda
Unified Expectation Maximization
Unified Expectation Maximization
Koji Matsuda
Language Models as Representations for Weakly-Supervised NLP Tasks (CoNLL2011)
Language Models as Representations for Weakly-Supervised NLP Tasks (CoNLL2011)
Koji Matsuda
研究室内PRML勉強会 11章2-4節
研究室内PRML勉強会 11章2-4節
Koji Matsuda
研究室内PRML勉強会 8章1節
研究室内PRML勉強会 8章1節
Koji Matsuda
Word Sense Induction & Disambiguaon Using Hierarchical Random Graphs (EMNLP2010)
Word Sense Induction & Disambiguaon Using Hierarchical Random Graphs (EMNLP2010)
Koji Matsuda
Approximate Scalable Bounded Space Sketch for Large Data NLP
Approximate Scalable Bounded Space Sketch for Large Data NLP
Koji Matsuda
More from Koji Matsuda
(18)
Reading Wikipedia to Answer Open-Domain Questions (ACL2017) and more...
Reading Wikipedia to Answer Open-Domain Questions (ACL2017) and more...
KB + Text => Great KB な論文を多読してみた
KB + Text => Great KB な論文を多読してみた
Large-Scale Information Extraction from Textual Definitions through Deep Syn...
Large-Scale Information Extraction from Textual Definitions through Deep Syn...
場所参照表現タグ付きコーパスの構築と評価
場所参照表現タグ付きコーパスの構築と評価
Entity linking meets Word Sense Disambiguation: a unified approach(TACL 2014)の紹介
Entity linking meets Word Sense Disambiguation: a unified approach(TACL 2014)の紹介
いまさら聞けない “モデル” の話 @DSIRNLP#5
いまさら聞けない “モデル” の話 @DSIRNLP#5
Practical recommendations for gradient-based training of deep architectures
Practical recommendations for gradient-based training of deep architectures
Align, Disambiguate and Walk : A Unified Approach forMeasuring Semantic Simil...
Align, Disambiguate and Walk : A Unified Approach forMeasuring Semantic Simil...
Joint Modeling of a Matrix with Associated Text via Latent Binary Features
Joint Modeling of a Matrix with Associated Text via Latent Binary Features
Vanishing Component Analysis
Vanishing Component Analysis
A Machine Learning Framework for Programming by Example
A Machine Learning Framework for Programming by Example
Information-Theoretic Metric Learning
Information-Theoretic Metric Learning
Unified Expectation Maximization
Unified Expectation Maximization
Language Models as Representations for Weakly-Supervised NLP Tasks (CoNLL2011)
Language Models as Representations for Weakly-Supervised NLP Tasks (CoNLL2011)
研究室内PRML勉強会 11章2-4節
研究室内PRML勉強会 11章2-4節
研究室内PRML勉強会 8章1節
研究室内PRML勉強会 8章1節
Word Sense Induction & Disambiguaon Using Hierarchical Random Graphs (EMNLP2010)
Word Sense Induction & Disambiguaon Using Hierarchical Random Graphs (EMNLP2010)
Approximate Scalable Bounded Space Sketch for Large Data NLP
Approximate Scalable Bounded Space Sketch for Large Data NLP
「今日から使い切る」ための GNU Parallelによる並列処理入門
1.
「今⽇から使い切る」 ための GNU Parallel による並列処理⼊⾨ Koji
Matsuda 1
2.
並列処理: ビッグデータ時代のリテラシー • 我々が扱うべきデータ量は爆発的に増⼤ – 例)研究室で収集しているツイート:1⽇XXXX 万ツイート(圧縮してXGB)、年間XXX億ツイート •
1CPUの性能向上は年間数⼗%、その代わり、 コア数はドンドン増えてる – 乾・岡崎研はXXXコアくらいあります 「今日から使える」「プログラミング言語非依存な」 並列処理(バカパラ)の方法を共有したい 2 既存のコードを変更しなくて良い
3.
「使い切る」ための 3 赤線:クラスタに搭載されているCPU / 青線:使われているCPU数 2∼3割くらいしか使われていない!!
4.
• 並列実⾏関係の機能が詰まったユーティリティ • 便利なソフトウェアではあるのだが、マニュアル が不親切(※ボリュームがありすぎる) 4 For
people who live life in the parallel lane. http://www.gnu.org/software/parallel/man.html http://www.gnu.org/software/parallel/parallel_tutorial.html インスピレーションを刺激 する例も多くて良いドキュ メントだとは思うのです が・・・ 研究室生活でよく直面するユースケースに限って説明
5.
バカパラの三つのパターン 1. ⼩さなファイルが超⼤量、それぞれに処理 ex. Wikipediaのすべての記事(100万記事) 2.
(1⾏1レコードの)巨⼤なファイル各⾏に処理 ex. ツイートログファイル(1ファイル数GB) 3. パラメータとその組み合わせが⼤量 ex. ディープラーニング • 層数、次元数、初期化、学習率, etc… GNU Parallel でワンストップに対応 5 参考:実際に動くチュートリアルが、 https://bitbucket.org/cl-tohoku/bakapara_tutorial にあります。 乾研の大半のサーバーには GNU Parallel はインストール済なので、すぐ試せるはず
6.
パターン1 処理すべきファイルがいっぱい • ⼤量のファイルに定型的な処理 6 001.txt 001.txt ./orig/ … 300.txt ./processed/ 001.txt 001.txt … 300.txt 何かの処理
7.
パターン1 処理すべきファイルがいっぱい • GNU Parallel
のファイル名置換を使う 7 ls orig/* | parallel –j 10 “mecab < {} > processed/{/}” 意味: orig/ ディレクトリ以下のす べてのファイルに対して並列 で mecab を実行し、 processed/ 以下に出力せよ 処理するファイル のリストを生成 {} がファイル名に 置換される ex. orig/1.txt {/} はファイル名 からディレクトリを 取り除いたもの ex. orig/1.txt => 1.txt 並列数 並列数(-j) 所要時間(s) 1 13.70 3 4.61 5 3.79 10 3.21 表:並列数に対する所要時間の変化 @tequila
8.
パターン2 ⼤きなファイルのすべての⾏に 8 original.txt (100万行) processed.txt (100万行)何かの処理
9.
パターン2 ⼤きなファイルのすべての⾏に • --pipe オプションを使う 9 cat
original.txt | parallel --pipe --L 10000 “hoge.py” > processed.txt original.txt (100万行) original.txt を 1万行づつの「塊」に分解して、それぞ れを並列に hoge.py にパイプで入力せよ。結果を processed.txtにまとめよ。 1万行 hoge.py 1万行 hoge.py 1万行 hoge.py 1万行 hoge.py processed.txt (100万行) 並列実行
10.
パターン2’ ボトルネックの部分を並列化 • --pipe の真髄:パイプラインの⼀部を並列 10 cat
a.txt | hoge.py | fuga.py | piyo.py > b.txt 遅い速い 速い cat a.txt | hoge.py | parallel –pipe –L 100 fuga.py | piyo.py > b.txt ここだけ並列化して ボトルネック解消! (余談) ボトルネックの定量化には pv (pipe-viewer) コマンドが便利
11.
パターン3 試すべきパラメータがいっぱい 11 train.txt 学習率 0.1 0.01 0.001 層数 1 2 3 ユニット 100 200 300 train.py ./log/ lr=0.1_layer=1_u=100.log lr=0.1_layer=1_u=200.log … lr=0.1_layer=3_u=300.log ./model/ lr=0.1_layer=1_u=100.model lr=0.1_layer=1_u=200.model … lr=0.1_layer=3_u=300.model すべての組 み合わせを 試したい
12.
パターン3 試すべきパラメータがいっぱい • GNU Parallel
の 組み合わせ展開( ::: )を使う 12 lr=(0 0.05 0.1 0.5 1.0 5) # 学習率! units=(100 200 300 400) # 隠れ層のユニット数! ! parallel “train.py --lr={1} --units={2} > log/{1}_{2}.txt“ ! "::: ${lr[@]} ::: ${units[@]} これまでfor文の多重ループで書いていた 処理が、たった3行に!!(しかも並列実行) Pythonの string.fmt と似た文法
13.
注意点 / Tips •
気をつけておきたいこと: – time コマンドでこまめに計測 • とくにパイプ並列の場合、早くならないこともある – IO / メモリが重い処理は控えめな並列数で – ⻑時間占有する場合は –nice オプションを – まずは --dry-run オプションをつけて実⾏ • どういうコマンドが実⾏されるか、教えてくれる • Tips – --bar : 進捗状況を表⽰、残り時間の推定 – -S オプション: マシンを跨いだ並列処理 – 並列数は –j オプションで指定、デフォルトではCPU数 13 --bar の例:63%のタスクが終了し、残りは8秒
14.
まとめ • GNU Parallel
を使うことのメリット: – J簡潔に書けて – J柔軟に実⾏できる – J既存のコードとの組み合わせが容易 • GNU Parallel を使うことのデメリット: – Lあまりにも簡単なので、計算機資源の奪い合い が・・? • 是⾮「今⽇から」使ってみてください • 他にもいい使い⽅があったらシェアしてくだ さいJ 14
Download now