Suche senden
Hochladen
統計解析言語Rにおける大規模データ管理のためのboost.interprocessの活用
•
8 gefällt mir
•
4,484 views
S
Shintaro Fukushima
Folgen
Technologie
Diashow-Anzeige
Melden
Teilen
Diashow-Anzeige
Melden
Teilen
1 von 49
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
Why dont you_create_new_spark_jl
Why dont you_create_new_spark_jl
Shintaro Fukushima
mmapパッケージを使ってお手軽オブジェクト管理
mmapパッケージを使ってお手軽オブジェクト管理
Shintaro Fukushima
Rユーザのためのspark入門
Rユーザのためのspark入門
Shintaro Fukushima
R-hpc-1 TokyoR#11
R-hpc-1 TokyoR#11
Shintaro Fukushima
機械学習を用いた予測モデル構築・評価
機械学習を用いた予測モデル構築・評価
Shintaro Fukushima
Rの高速化
Rの高速化
弘毅 露崎
Rあんなときこんなとき(tokyo r#12)
Rあんなときこんなとき(tokyo r#12)
Shintaro Fukushima
Rのデータ構造とメモリ管理
Rのデータ構造とメモリ管理
Takeshi Arabiki
Empfohlen
Why dont you_create_new_spark_jl
Why dont you_create_new_spark_jl
Shintaro Fukushima
mmapパッケージを使ってお手軽オブジェクト管理
mmapパッケージを使ってお手軽オブジェクト管理
Shintaro Fukushima
Rユーザのためのspark入門
Rユーザのためのspark入門
Shintaro Fukushima
R-hpc-1 TokyoR#11
R-hpc-1 TokyoR#11
Shintaro Fukushima
機械学習を用いた予測モデル構築・評価
機械学習を用いた予測モデル構築・評価
Shintaro Fukushima
Rの高速化
Rの高速化
弘毅 露崎
Rあんなときこんなとき(tokyo r#12)
Rあんなときこんなとき(tokyo r#12)
Shintaro Fukushima
Rのデータ構造とメモリ管理
Rのデータ構造とメモリ管理
Takeshi Arabiki
Rにおける大規模データ解析(第10回TokyoWebMining)
Rにおける大規模データ解析(第10回TokyoWebMining)
Shintaro Fukushima
RのffとbigmemoryとRevoScaleRとを比較してみた
RのffとbigmemoryとRevoScaleRとを比較してみた
Kazuya Wada
R高速化
R高速化
Monta Yashi
データサイエンスワールドからC++を眺めてみる
データサイエンスワールドからC++を眺めてみる
Shintaro Fukushima
RのffでGLMしてみたけど...
RのffでGLMしてみたけど...
Kazuya Wada
Feature Selection with R / in JP
Feature Selection with R / in JP
Sercan Ahi
「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」
「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」
Nagi Teramo
最近のRのランダムフォレストパッケージ -ranger/Rborist-
最近のRのランダムフォレストパッケージ -ranger/Rborist-
Shintaro Fukushima
巨大な表を高速に扱うData.table について
巨大な表を高速に扱うData.table について
Haruka Ozaki
2013.07.15 はじパタlt scikit-learnで始める機械学習
2013.07.15 はじパタlt scikit-learnで始める機械学習
Motoya Wakiyama
20150329 tokyo r47
20150329 tokyo r47
Takashi Kitano
多次元配列の効率的利用法の検討
多次元配列の効率的利用法の検討
Yu Sato
Deep Learningと他の分類器をRで比べてみよう in Japan.R 2014
Deep Learningと他の分類器をRで比べてみよう in Japan.R 2014
Takashi J OZAKI
[データマイニング+WEB勉強会][R勉強会] はじめてでもわかる 統計解析・データマイニング R言語入門
[データマイニング+WEB勉強会][R勉強会] はじめてでもわかる 統計解析・データマイニング R言語入門
Koichi Hamada
PythonでテキストをJSONにした話(PyCon mini sapporo 2015)
PythonでテキストをJSONにした話(PyCon mini sapporo 2015)
Satoshi Yamada
PostgreSQL SQLチューニング入門 実践編(pgcon14j)
PostgreSQL SQLチューニング入門 実践編(pgcon14j)
Satoshi Yamada
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~
Miki Shimogai
20090107 Postgre Sqlチューニング(Sql編)
20090107 Postgre Sqlチューニング(Sql編)
Hiromu Shioya
R3.0.0 is relased
R3.0.0 is relased
Shintaro Fukushima
Rで学ぶデータマイニングI 第8章〜第13章
Rで学ぶデータマイニングI 第8章〜第13章
Prunus 1350
Boost tour 1_44_0
Boost tour 1_44_0
Akira Takahashi
Boost tour 1_40_0
Boost tour 1_40_0
Akira Takahashi
Weitere ähnliche Inhalte
Was ist angesagt?
Rにおける大規模データ解析(第10回TokyoWebMining)
Rにおける大規模データ解析(第10回TokyoWebMining)
Shintaro Fukushima
RのffとbigmemoryとRevoScaleRとを比較してみた
RのffとbigmemoryとRevoScaleRとを比較してみた
Kazuya Wada
R高速化
R高速化
Monta Yashi
データサイエンスワールドからC++を眺めてみる
データサイエンスワールドからC++を眺めてみる
Shintaro Fukushima
RのffでGLMしてみたけど...
RのffでGLMしてみたけど...
Kazuya Wada
Feature Selection with R / in JP
Feature Selection with R / in JP
Sercan Ahi
「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」
「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」
Nagi Teramo
最近のRのランダムフォレストパッケージ -ranger/Rborist-
最近のRのランダムフォレストパッケージ -ranger/Rborist-
Shintaro Fukushima
巨大な表を高速に扱うData.table について
巨大な表を高速に扱うData.table について
Haruka Ozaki
2013.07.15 はじパタlt scikit-learnで始める機械学習
2013.07.15 はじパタlt scikit-learnで始める機械学習
Motoya Wakiyama
20150329 tokyo r47
20150329 tokyo r47
Takashi Kitano
多次元配列の効率的利用法の検討
多次元配列の効率的利用法の検討
Yu Sato
Deep Learningと他の分類器をRで比べてみよう in Japan.R 2014
Deep Learningと他の分類器をRで比べてみよう in Japan.R 2014
Takashi J OZAKI
[データマイニング+WEB勉強会][R勉強会] はじめてでもわかる 統計解析・データマイニング R言語入門
[データマイニング+WEB勉強会][R勉強会] はじめてでもわかる 統計解析・データマイニング R言語入門
Koichi Hamada
PythonでテキストをJSONにした話(PyCon mini sapporo 2015)
PythonでテキストをJSONにした話(PyCon mini sapporo 2015)
Satoshi Yamada
PostgreSQL SQLチューニング入門 実践編(pgcon14j)
PostgreSQL SQLチューニング入門 実践編(pgcon14j)
Satoshi Yamada
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~
Miki Shimogai
20090107 Postgre Sqlチューニング(Sql編)
20090107 Postgre Sqlチューニング(Sql編)
Hiromu Shioya
R3.0.0 is relased
R3.0.0 is relased
Shintaro Fukushima
Rで学ぶデータマイニングI 第8章〜第13章
Rで学ぶデータマイニングI 第8章〜第13章
Prunus 1350
Was ist angesagt?
(20)
Rにおける大規模データ解析(第10回TokyoWebMining)
Rにおける大規模データ解析(第10回TokyoWebMining)
RのffとbigmemoryとRevoScaleRとを比較してみた
RのffとbigmemoryとRevoScaleRとを比較してみた
R高速化
R高速化
データサイエンスワールドからC++を眺めてみる
データサイエンスワールドからC++を眺めてみる
RのffでGLMしてみたけど...
RのffでGLMしてみたけど...
Feature Selection with R / in JP
Feature Selection with R / in JP
「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」
「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」
最近のRのランダムフォレストパッケージ -ranger/Rborist-
最近のRのランダムフォレストパッケージ -ranger/Rborist-
巨大な表を高速に扱うData.table について
巨大な表を高速に扱うData.table について
2013.07.15 はじパタlt scikit-learnで始める機械学習
2013.07.15 はじパタlt scikit-learnで始める機械学習
20150329 tokyo r47
20150329 tokyo r47
多次元配列の効率的利用法の検討
多次元配列の効率的利用法の検討
Deep Learningと他の分類器をRで比べてみよう in Japan.R 2014
Deep Learningと他の分類器をRで比べてみよう in Japan.R 2014
[データマイニング+WEB勉強会][R勉強会] はじめてでもわかる 統計解析・データマイニング R言語入門
[データマイニング+WEB勉強会][R勉強会] はじめてでもわかる 統計解析・データマイニング R言語入門
PythonでテキストをJSONにした話(PyCon mini sapporo 2015)
PythonでテキストをJSONにした話(PyCon mini sapporo 2015)
PostgreSQL SQLチューニング入門 実践編(pgcon14j)
PostgreSQL SQLチューニング入門 実践編(pgcon14j)
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~
20090107 Postgre Sqlチューニング(Sql編)
20090107 Postgre Sqlチューニング(Sql編)
R3.0.0 is relased
R3.0.0 is relased
Rで学ぶデータマイニングI 第8章〜第13章
Rで学ぶデータマイニングI 第8章〜第13章
Ähnlich wie 統計解析言語Rにおける大規模データ管理のためのboost.interprocessの活用
Boost tour 1_44_0
Boost tour 1_44_0
Akira Takahashi
Boost tour 1_40_0
Boost tour 1_40_0
Akira Takahashi
C base design methodology with s dx and xilinx ml
C base design methodology with s dx and xilinx ml
ssuser3a4b8c
Azure Machine Learning Services 概要 - 2019年3月版
Azure Machine Learning Services 概要 - 2019年3月版
Daiyu Hatakeyama
boost tour 1.48.0 all
boost tour 1.48.0 all
Akira Takahashi
Boost Tour 1.50.0 All
Boost Tour 1.50.0 All
Akira Takahashi
PF部2011年12月勉強会.androidsola
PF部2011年12月勉強会.androidsola
android sola
ラズパイでデバイスドライバを作ってみた。
ラズパイでデバイスドライバを作ってみた。
Kazuki Onishi
プログラムを高速化する話Ⅱ 〜GPGPU編〜
プログラムを高速化する話Ⅱ 〜GPGPU編〜
京大 マイコンクラブ
Pub/Sub model, msm, and asio
Pub/Sub model, msm, and asio
Takatoshi Kondo
APASEC 2013 - ROP/JIT を使わずに DEP/ASLR を回避する手法を見てみた。
APASEC 2013 - ROP/JIT を使わずに DEP/ASLR を回避する手法を見てみた。
Satoshi Mimura
PostgreSQL - C言語によるユーザ定義関数の作り方
PostgreSQL - C言語によるユーザ定義関数の作り方
Satoshi Nagayasu
データベース11 - データベースとプログラム
データベース11 - データベースとプログラム
Kenta Oku
プロセスとコンテキストスイッチ
プロセスとコンテキストスイッチ
Kazuki Onishi
Prosym2012
Prosym2012
MITSUNARI Shigeo
Learning Template Library Design using Boost.Geomtry
Learning Template Library Design using Boost.Geomtry
Akira Takahashi
Python で munin plugin を書いてみる
Python で munin plugin を書いてみる
ftnk
Boost.B-tree introduction
Boost.B-tree introduction
Takayuki Goto
8 並列計算に向けた pcセッティング
8 並列計算に向けた pcセッティング
Takeshi Takaishi
NGS解析を始めた時にぶつかりがちな小さい壁あれこれ
NGS解析を始めた時にぶつかりがちな小さい壁あれこれ
DNA Data Bank of Japan center
Ähnlich wie 統計解析言語Rにおける大規模データ管理のためのboost.interprocessの活用
(20)
Boost tour 1_44_0
Boost tour 1_44_0
Boost tour 1_40_0
Boost tour 1_40_0
C base design methodology with s dx and xilinx ml
C base design methodology with s dx and xilinx ml
Azure Machine Learning Services 概要 - 2019年3月版
Azure Machine Learning Services 概要 - 2019年3月版
boost tour 1.48.0 all
boost tour 1.48.0 all
Boost Tour 1.50.0 All
Boost Tour 1.50.0 All
PF部2011年12月勉強会.androidsola
PF部2011年12月勉強会.androidsola
ラズパイでデバイスドライバを作ってみた。
ラズパイでデバイスドライバを作ってみた。
プログラムを高速化する話Ⅱ 〜GPGPU編〜
プログラムを高速化する話Ⅱ 〜GPGPU編〜
Pub/Sub model, msm, and asio
Pub/Sub model, msm, and asio
APASEC 2013 - ROP/JIT を使わずに DEP/ASLR を回避する手法を見てみた。
APASEC 2013 - ROP/JIT を使わずに DEP/ASLR を回避する手法を見てみた。
PostgreSQL - C言語によるユーザ定義関数の作り方
PostgreSQL - C言語によるユーザ定義関数の作り方
データベース11 - データベースとプログラム
データベース11 - データベースとプログラム
プロセスとコンテキストスイッチ
プロセスとコンテキストスイッチ
Prosym2012
Prosym2012
Learning Template Library Design using Boost.Geomtry
Learning Template Library Design using Boost.Geomtry
Python で munin plugin を書いてみる
Python で munin plugin を書いてみる
Boost.B-tree introduction
Boost.B-tree introduction
8 並列計算に向けた pcセッティング
8 並列計算に向けた pcセッティング
NGS解析を始めた時にぶつかりがちな小さい壁あれこれ
NGS解析を始めた時にぶつかりがちな小さい壁あれこれ
Mehr von Shintaro Fukushima
20230216_Python機械学習プログラミング.pdf
20230216_Python機械学習プログラミング.pdf
Shintaro Fukushima
機械学習品質管理・保証の動向と取り組み
機械学習品質管理・保証の動向と取り組み
Shintaro Fukushima
Materials Informatics and Python
Materials Informatics and Python
Shintaro Fukushima
BPstudy sklearn 20180925
BPstudy sklearn 20180925
Shintaro Fukushima
Juliaによる予測モデル構築・評価
Juliaによる予測モデル構築・評価
Shintaro Fukushima
Juliaで並列計算
Juliaで並列計算
Shintaro Fukushima
data.tableパッケージで大規模データをサクッと処理する
data.tableパッケージで大規模データをサクッと処理する
Shintaro Fukushima
アクションマイニングを用いた最適なアクションの導出
アクションマイニングを用いた最適なアクションの導出
Shintaro Fukushima
外れ値
外れ値
Shintaro Fukushima
Rでreproducible research
Rでreproducible research
Shintaro Fukushima
不均衡データのクラス分類
不均衡データのクラス分類
Shintaro Fukushima
Numpy scipyで独立成分分析
Numpy scipyで独立成分分析
Shintaro Fukushima
Rで学ぶロバスト推定
Rで学ぶロバスト推定
Shintaro Fukushima
Tokyo.R(#07)
Tokyo.R(#07)
Shintaro Fukushima
Mehr von Shintaro Fukushima
(14)
20230216_Python機械学習プログラミング.pdf
20230216_Python機械学習プログラミング.pdf
機械学習品質管理・保証の動向と取り組み
機械学習品質管理・保証の動向と取り組み
Materials Informatics and Python
Materials Informatics and Python
BPstudy sklearn 20180925
BPstudy sklearn 20180925
Juliaによる予測モデル構築・評価
Juliaによる予測モデル構築・評価
Juliaで並列計算
Juliaで並列計算
data.tableパッケージで大規模データをサクッと処理する
data.tableパッケージで大規模データをサクッと処理する
アクションマイニングを用いた最適なアクションの導出
アクションマイニングを用いた最適なアクションの導出
外れ値
外れ値
Rでreproducible research
Rでreproducible research
不均衡データのクラス分類
不均衡データのクラス分類
Numpy scipyで独立成分分析
Numpy scipyで独立成分分析
Rで学ぶロバスト推定
Rで学ぶロバスト推定
Tokyo.R(#07)
Tokyo.R(#07)
Kürzlich hochgeladen
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
Toru Tamaki
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Hiroshi Tomioka
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
CRI Japan, Inc.
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
sn679259
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
Toru Tamaki
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
WSO2
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
atsushi061452
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
CRI Japan, Inc.
Kürzlich hochgeladen
(11)
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
統計解析言語Rにおける大規模データ管理のためのboost.interprocessの活用
1.
統計解析言語Rにおける 大規模データ管理のための Boost.Interporcessの活用
2011年12月3日 Boost#7 @sfchaos
2.
自己紹介 TwitterID: @sfchaos
職業:データ分析屋 RやC++等を使って金融,医療,産業などの データ分析 Boostは金融をやっていた頃,行列保持・計算 等でublasを少し使用
3.
アジェンダ 1.Why R? 2. What's
R? 3.Boost.Interprocessを活用したRの大規 模データ管理 4. その他C++/BoostとRの接点 5. まとめ
4.
1. Why R?
近年,機械学習,自然言語処理,データマ イニングなどがブームになりつつある “I keep saying that the sexy job in the next 10 years will be statisticians,” said Hal Varian, chief economist at Google. “And I’m not kidding.”
5.
Rは分析屋が手元で探索的にデータ分析
できるお手軽ツール 本発表の趣旨は,RにおけるBoostの活用 事例の紹介
6.
2. What's R?
統計計算とグラフィックスのための言語・環 境 多様な統計手法(線形・非線形モデル、古 典的統計検定、時系列解析、判別分析、 クラスタリング、その他)とグラフィックスを 提供 近年,大いに注目を集めている 各地での勉強会(Tokyo.R, Tsukuba.R, Osaka.R, Hiroshima.R)
7.
2.1 Rの長所(の一例) オブジェクトに対する高い操作性 >
# 初項1,末項10,公差1の等差数列 > x <- 1:10 > # xの値を表示する >x [1] 1 2 3 4 5 6 7 8 9 10 > # 偶数の項だけを取り出す > x[x%%2==0] [1] 2 4 6 8 10
8.
強力なグラフィクス機能
Averag e Yearly Sun sp o ts 1750 1800 1850 1900 1950 150 spots 100 50 0 150 spots 100 50 0 1750 1800 1850 1900 1950 Year
9.
最新の手法を用意した豊富なパッケージ群
10.
2.2 Rの短所 マルチコア/CPUの環境でも基本的に
1CPU
11.
マルチコア/CPUの環境でも基本的に
1CPU 基本的にオンメモリでデータを保持,計算 を実行
12.
マルチコア/CPUの環境でも基本的に
1CPU 基本的にオンメモリでデータを保持,計算 を実行 32ビット整数を用いているので,64ビット OSでもベクトル,行列,配列などのオブジェ クトの要素数の上限が231-1
13.
マルチコア/CPUの環境でも基本的に
1CPU 基本的にオンメモリでデータを保持,計算 を実行 32ビット整数を用いているので,64ビット OSでもベクトル,行列,配列などのオブジェ クトの要素数の上限が231-1 基本的にオブジェクトは値渡しするため,メ モリを大量に消費
14.
マルチCPUの環境でも基本的に1CPU 基本的にオンメモリでデータを保持,計算
を実行 大規模なデータに対して 32ビット整数を用いているので,64ビット 処理速度を上げるためには工夫が必要 OSでもベクトル,行列,配列などのオブジェ →高性能計算(High Performance Computing) クトの要素数の上限が231-1 基本的にオブジェクトは値渡しするため,メ モリを大量に消費
15.
アジェンダ 1.Why R? 2. What's
R? 3. Boost.Interprocessを活用した大規模 データ管理 4. その他Boost/C++とRの接点 5. まとめ
16.
3.1 オンメモリの制約条件を超えるために Rの標準機能だけではRAMの制約がある
この課題を解決するために提供されている パッケージがいくつかある bigmemoryパッケージは Boost.Interprocessを使用して共有メモリ, メモリマップドファイルを用いたデータ管理 を実現
17.
3.2 Boost.Interprocessの概要
プロセス間通信や同期の仕組みを簡略化 したライブラリ 共有メモリ メモリマップファイル セマフォ,ミューテックス,条件変数,共有メモリやメ モリマップファイル上のアップグレード可能なミュー テックス型 名前付したこれらの同期オブジェクト型.Unixや Windowsのsem_openやCreateSemaphore APIに似 たもの. ファイルロック 相対的な位置 メッセージキュー 等々 http://ohkuma.la.coocan.jp/tech/boost/Interproc ess.html
18.
今回は,Rの話に関係のある共有メモリ,メ
モリマップドファイルのみを簡単に調査
19.
3.3.1 共有メモリ 使用するヘッダファイル
boost/interprocess/shared_memory_object.h pp
20.
共有メモリセグメントの作成 using boost::interprocess; //
共有メモリセグメントのオープン・作成 shared_memory_object shm_obj(open_or_create, "shared_memory", read_write); // 共有メモリのサイズの設定(要read_writeモード) shm_obj.truncate(10000);
21.
共有メモリセグメントのマッピング using namespace
boost; mapped_region(shm, read_write);
22.
共有メモリの破棄 using namespace
boost::interprocess; shared_memory_object::remove( "shared_memory");
23.
3.3.2 メモリマップドファイル 使用するヘッダファイル boost/interprocess/file_mapping.hpp
24.
ファイルマッピングの作成 using boost::interprocess; file_mapping
m_file("/usr/home/file", read_write) メモリ内へのファイルの中身のマッピング using boost::interprocess; mapped_region region(m_file, read_write);
25.
3.4 bigmemoryを構成するクラス
BigMatrix 巨大行列の 抽象クラス LocalBigMatrix SharedBigMatrix ローカルで 共有用巨大行列の データを保持する 抽象クラス 巨大行列クラス SharedMemoryBigMatrix FileBackedBigMatrix 共有メモリを用いた メモリマップドファイルを 巨大行列クラス 用いた巨大行列クラス
26.
3.4.1 共有用巨大行列の抽象クラス class SharedBigMatrix
: public BigMatrix { public: SharedBigMatrix() : BigMatrix() {_shared=true;} virtual ~SharedBigMatrix() {} std::string uuid() const {return _uuid;} std::string shared_name() const {return _sharedName;} protected: virtual bool destroy()=0; bool create_uuid(); uuidの作成 bool uuid(const std::string &uuid) {_uuid=uuid; return true;} std::string _uuid; std::string _sharedName; MappedRegionPtrs _dataRegionPtrs; }; typedef boost::interprocess::mapped_region MappedRegion; typedef boost::shared_ptr<MappedRegion> MappedRegionPtr; typedef vector<MappedRegionPtr> MappedRegionPtrs;
27.
bool SharedBigMatrix::create_uuid() {
try{ stringstream ss; boost::uuids::basic_random_generator<boost::mt19937> gen; boost::uuids::uuid u = gen(); ss << u; _uuid = ss.str(); return true; } catch(std::exception &e) { printf("%sn", e.what()); printf("%s line %dn", __FILE__, __LINE__); return false; } }
28.
3.4.2 共有メモリを用いた巨大行列クラス class SharedMemoryBigMatrix
: public SharedBigMatrix { public: SharedMemoryBigMatrix():SharedBigMatrix(){}; virtual ~SharedMemoryBigMatrix(){destroy();}; virtual bool create( const index_type numRow, const index_type numCol, ①巨大行列の生成 const int matrixType, const bool sepCols); virtual bool connect( const std::string &uuid, const index_type numRow, ②巨大行列への接続 const index_type numCol, const int matrixType, const bool sepCols); ③巨大行列の破棄 protected: virtual bool destroy(); SharedCounter _counter; };
29.
① 巨大行列の生成 bool SharedMemoryBigMatrix::create(
const index_type numRow, const index_type numCol, const int matrixType, const bool sepCols ) { using namespace boost::interprocess; #ifndef INTERLOCKED_EXCHANGE_HACK named_mutex mutex(open_or_create, (_sharedName+"_counter_mutex").c_str()); mutex.lock(); #endif _counter.init( _sharedName+"_counter"①-1 カウンタの初期化 ); #ifndef INTERLOCKED_EXCHANGE_HACK mutex.unlock(); #endif switch(_matType) { // 行列の型に応じた共有用巨大行列の生成 case 1: _pdata = CreateSharedMatrix<char>(_sharedName, _dataRegionPtrs, _nrow, _ncol); break; ①-2 共有用巨大行列の生成エンジン ・・・ } return true; }
30.
①-1 カウンタの初期化 bool SharedCounter::init(
const std::string &resourceName ) { _resourceName = resourceName; try { // 初めて接続する場合 boost::interprocess::shared_memory_object shm( boost::interprocess::create_only, _resourceName.c_str(), boost::interprocess::read_write); shm.truncate( sizeof(index_type) ); _pRegion = new boost::interprocess::mapped_region(shm, boost::interprocess::read_write); _pVal = reinterpret_cast<index_type*>(_pRegion- >get_address()); *_pVal = 1; } catch(std::exception &ex) { // 既に存在するカウンタに接続する場合 ・・・ ++(*_pVal); } return true; }
31.
①-2 共有用巨大行列の生成エンジン template<typename T> void*
CreateSharedMatrix( const std::string &sharedName, MappedRegionPtrs &dataRegionPtrs, const index_type nrow, const index_type ncol) { 共有メモリセグメントの作成 shared_memory_object shm(create_only, sharedName.c_str(), read_write); 共有メモリのサイズの設定 shm.truncate( nrow*ncol*sizeof(T) ); (行列のサイズ分) dataRegionPtrs.push_back( MappedRegionPtr(new MappedRegion(shm, read_write))); return dataRegionPtrs[0]->get_address(); }
32.
② 巨大行列への接続 bool SharedMemoryBigMatrix::connect(
const std::string &uuid, const index_type numRow, const index_type numCol, const int matrixType, const bool sepCols ) { using namespace boost::interprocess; #ifndef INTERLOCKED_EXCHANGE_HACK // Attach to the associated mutex and counter; named_mutex mutex(open_or_create, (_sharedName+"_counter_mutex").c_str()); mutex.lock(); #endif ②-1 カウンタの初期化 _counter.init( _sharedName+"_counter" ); #ifndef INTERLOCKED_EXCHANGE_HACK (①ー1で扱ったため省略 mutex.unlock(); ) #endif switch(_matType) { case 1: _pdata = ConnectSharedMatrix<char>(_sharedName, _dataRegionPtrs, _counter); break; ・・・ } }
33.
②-2 共有用巨大行列への接続エンジン void* ConnectSharedMatrix(
const std::string &sharedName, MappedRegionPtrs &dataRegionPtrs, SharedCounter &counter) { using namespace boost::interprocess; 共有メモリセグメントのオープン shared_memory_object shm(open_only, sharedName.c_str(), read_write); マップド領域への追加 dataRegionPtrs.push_back( MappedRegionPtr(new MappedRegion(shm, read_write))); return reinterpret_cast<void*>(dataRegionPtrs[0]->get_address()); }
34.
③ 巨大行列の破棄 bool SharedMemoryBigMatrix::destroy()
{ using namespace boost::interprocess; #ifndef INTERLOCKED_EXCHANGE_HACK named_mutex mutex(open_or_create, (_sharedName+"_counter_mutex").c_str()); mutex.lock(); #endif bool destroyThis = (1==_counter.get()) ? true : false; _dataRegionPtrs.resize(0); if (destroyThis) { shared_memory_object::remove(_uuid.c_str()); } #ifndef INTERLOCKED_EXCHANGE_HACK mutex.unlock(); if (destroyThis) { named_mutex::remove((_sharedName+"_counter_mutex").c_str()); } #endif return true; }
35.
3.4.3 メモリマップドファイルを用いた巨大行列クラス class FileBackedBigMatrix
: public SharedBigMatrix { public: FileBackedBigMatrix():SharedBigMatrix(){} virtual ~FileBackedBigMatrix(){destroy();} virtual bool create( const std::string &fileName, const std::string &filePath,const index_type numRow, const index_type numCol, const int matrixType, const bool sepCols); virtual bool connect( const std::string &fileName, const std::string &filePath, const index_type numRow, const index_type numCol, const int matrixType, const bool sepCols); std::string file_name() const {return _fileName;} bool flush(); protected: virtual bool destroy(); std::string _fileName; };
36.
① 巨大行列の生成 bool FileBackedBigMatrix::create(
const std::string &fileName, const std::string &filePath, const index_type numRow, const index_type numCol, const int matrixType, const bool sepCols) { // 行列の型に応じたメモリマップドファイルの生成 switch(_matType) { case 1: メモリマップドファイル生成エンジン _pdata = CreateFileBackedMatrix<char>(_fileName, filePath, _dataRegionPtrs, _nrow, _ncol); break; case 2: _pdata = CreateFileBackedMatrix<short>(_fileName, filePath, _dataRegionPtrs, _nrow, _ncol); break; ・・・ } return true; }
37.
template<typename T> void* ConnectFileBackedMatrix(
const std::string &fileName, const std::string &filePath, MappedRegionPtrs &dataRegionPtrs) { ファイルマッピングの作成 file_mapping mFile((filePath+"/"+fileName).c_str(), read_write); dataRegionPtrs.push_back( メモリ内へのファイルの中身のマッピング MappedRegionPtr(new MappedRegion(mFile, read_write))); return reinterpret_cast<void*>(dataRegionPtrs[0]- >get_address()); }
38.
② 巨大行列への接続 bool FileBackedBigMatrix::connect(
const std::string &fileName, const std::string &filePath, const index_type numRow, const index_type numCol, const int matrixType, const bool sepCols) { // 行列の型に応じたメモリマップドファイルへの接続 switch(_matType) { case 1: _pdata = ConnectFileBackedMatrix<char>(_fileName, filePath, _dataRegionPtrs); break; case 2: _pdata = ConnectFileBackedMatrix<short>(_fileName, filePath, _dataRegionPtrs); break; ・・・ } return true; }
39.
③ 巨大行列の破棄 bool FileBackedBigMatrix::destroy() {
_dataRegionPtrs.resize(0); shared_memory_object::remove(_fileName.c_str()); return true; }
40.
3.3 Rの課題の解決度合い
Rの課題 解決度合い マルチCPU(コア)の環境でも ○ 基本的に1CPU(コア) 共有メモリやメモリマップドファイルを 用いて並列/並行計算が可能に ○ 基本的にオンメモリでデータ を保持,計算を実行 RAMをはるかに超えるデータの 扱いが可能に ベクトル,行列,配列などの ○ 要素数の上限が231-1 要素数の上限は252まで拡張 基本的にオブジェクトの参照 渡しができず値渡しを行うた ◎ め,コピーがあちこちで発生 しメモリを消費する 参照渡しでオブジェクトを渡せる
41.
3.4 具体例 使用するデータ
Data Expo 2009 アメリカの旅客機のフライトデータ (1987年~2008年) http://stat-computing.org/dataexpo/2009/the-data.html 約12GB(約1億2,300万レコード,29 フィールド)
42.
3.4.1 メモリマップドファイルの作成・接続 > library(bigmemory) >
# メモリマップドファイルの作成(Intel core i7で約21分) > airline <- read.big.matrix("AirlineAllData.csv", header=TRUE, sep=",", backingifle="AirlineAllData.bin", descriptorfile="AirlineAllData.desc") > # 既に作成されたメモリマップドファイルに接続(0.002 秒) > airline <- attach.big.matrix("AirlineAllData.desc")
43.
3.4.2 データの集計 >
library(bigtabulate) > > # 各列の要約(最小値、最大値、平均値、NAの数) > summary(airline) > > # 年ごと月ごとのフライト数 > bigtable(airline, c("Year", "Month")) > > # 曜日ごとの到着時間の遅れの統計量 > # (最小値、最大値、平均値、標準偏差、NAの数) > bigtsummary(airline, "DayOfWeek", cols="ArrDelay", na.rm=T)
44.
3.4.3 旅客機の製造月の推定 > library(bigtabulate) > >
# 旅客機コードごとのレコード番号 > planeindices <- bigsplit(x, 'TailNum') > > # 2コアを使って並列に実行する > library(doMC) > registerDoMC(cores=2) > > # 製造月の推定(約14秒) > planeStart <- + foreach(i=planeindices, .combine=c) %dopar% { + return(birthmonth(x[i, c('Year','Month'), + drop=FALSE])) +}
45.
データの保持,集計程度はできるようには
なったが,まだまだ機能が不十分 機能を拡張するためには,単一の型しか扱 えない行列ではダメ 列ごとに型が異なることを許容するデータ フレームを開発する必要がある Boost.VariantやBoost.MPL等を用いて開 発できないか検討中
46.
Rcppパッケージを用いたRとC++のインタ
フェースの簡潔な記述(Boost.Pythonを参 考) Boost.Graphライブラリを呼び出すRBGL パッケージ Boost.Date_Timeライブラリを呼び出す RcppBDTパッケージ 等々
47.
アジェンダ 1.Why R? 2. What's
R? 3.Boost.Interprocessを活用したRの大規 模データ管理 4. その他C++/BoostとRの接点 5. まとめ
48.
アジェンダ 1.Why R? 2. What's
R? 3.Boost.Interprocessを活用したRの大規 模データ管理 4. その他C++/BoostとRの接点 5. まとめ
49.
Rの機能を拡張するために,いろいろなとこ
ろでBoostが使われています データ分析屋が快適に分析を行うためにも ,Boostコミュニティの益々のご発展を願っ ています!
Jetzt herunterladen