Raとjit
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
*Raとjit[#w1556118]
Rを拡張したRaシステムとjitパッケージを使って、Rの処理を高...
RaはRのコアとは別のRaコアで動いているRである。~
おもしろそうなので、少し追跡する。~
#ref(Ra.JPG)~
RaがRを乗っ取った?~
#ref(Ra2.JPG)~
bin-raを見よ!~
*R掲示板より引用 [#v4d439f5]
Ra システム & jit (Just in time compiler) [#me1606df]
> (2008-03-08 (土) 12:30:02)~
~
パッケージ jit。少し気になる、Tierney 氏の R byte compile...
The Ra Extension to R
Ra is functionally identical to R but provides just-in-t...
compilation of loops and arithmetic expressions in loops...
makes Ra arithmetic much faster than R. Ra will also typ...
faster than standard R even when just-in-time compilatio...
An example
jit(1) # turn on just-in-time com...
for(i in 1:na) # example convolution code
for(j in 1:nb)
ab[i + j] <- ab[i + j] + a[i] * b[j]
With na and nb bigger than about 100, the loop runs abou...
faster. With na and nb equal to 10, the loop runs about ...
faster. See here for timing details.
The R code is compiled to byte code which is executed in...
an interpreter in C.
//
- 面白い取り組み方法ですね。RaってR advance って感じでし...
- [[Rコード最適化のコツと実例集]]の最初にある説明用コード...
- 早速の使用報告ありがとうございます。こうした取り組みが...
- 使ってみて、私もそう思いました。(^_^) -- [[okinawa]] &n...
*Raを利用した高速化例(WinXpSP2 Core2Duo2.4G 1GRAM) [#a26b...
「意味のあるときは常に、意味の無いときも常にベクトル化を...
(1)Loop利用(遅い場合)~
x <- runif(1000000)
test1 <- function () { # 百万個の数の指数を個別に計算
res <- numeric(1000000)
for (i in 1:1000000) res[i] <- exp(x[i])
res}
system.time(test1())
> system.time(test1())
ユーザ システム 経過
3.73 0.00 3.73
(2)ベクトル
system.time(res <- exp(x))
> system.time(res <- exp(x))
ユーザ システム 経過
0.11 0.00 0.11
(3)jit化
library(jit)
x <- runif(1000000)
test1 <- function () { # 百万個の数の指数を個別に計算
jit(1)
res <- numeric(1000000)
for (i in 1:1000000) res[i] <- exp(x[i])
res}
system.time(test1())
jit(0)
> system.time(test1())
ユーザ システム 経過
0.27 0.00 0.26
ベクトル演算まではいかないが、かなり高速化されている。
*jitの制限らしきもの [#qfbdece6]
windows()はjitできないらしい~
library(jit)
jit(1)
x<-rnorm(1:100)
plot(x)
Warning: jitting is now disabled
以下にエラー windows() : cannot use internal routine gse...
これならOK~
library(jit)
plot.new()
jit(1)
x<-rnorm(1:100)
plot(x)
jit(0)
jitしてもしなくてもplotの速度は変わらない。(あたりまえか...
*コメント欄 [#y0ed184f]
#comment(below)
- Ra&jitは基本的にfor()のLoop部分を高速化するようです。ど...
*リンク [#ye65cac8]
Ra:http://www.milbo.users.sonic.net/ra/~
[[R掲示板]]
[[okinawa]]~
アクセス数:
&counter;
人
終了行:
*Raとjit[#w1556118]
Rを拡張したRaシステムとjitパッケージを使って、Rの処理を高...
RaはRのコアとは別のRaコアで動いているRである。~
おもしろそうなので、少し追跡する。~
#ref(Ra.JPG)~
RaがRを乗っ取った?~
#ref(Ra2.JPG)~
bin-raを見よ!~
*R掲示板より引用 [#v4d439f5]
Ra システム & jit (Just in time compiler) [#me1606df]
> (2008-03-08 (土) 12:30:02)~
~
パッケージ jit。少し気になる、Tierney 氏の R byte compile...
The Ra Extension to R
Ra is functionally identical to R but provides just-in-t...
compilation of loops and arithmetic expressions in loops...
makes Ra arithmetic much faster than R. Ra will also typ...
faster than standard R even when just-in-time compilatio...
An example
jit(1) # turn on just-in-time com...
for(i in 1:na) # example convolution code
for(j in 1:nb)
ab[i + j] <- ab[i + j] + a[i] * b[j]
With na and nb bigger than about 100, the loop runs abou...
faster. With na and nb equal to 10, the loop runs about ...
faster. See here for timing details.
The R code is compiled to byte code which is executed in...
an interpreter in C.
//
- 面白い取り組み方法ですね。RaってR advance って感じでし...
- [[Rコード最適化のコツと実例集]]の最初にある説明用コード...
- 早速の使用報告ありがとうございます。こうした取り組みが...
- 使ってみて、私もそう思いました。(^_^) -- [[okinawa]] &n...
*Raを利用した高速化例(WinXpSP2 Core2Duo2.4G 1GRAM) [#a26b...
「意味のあるときは常に、意味の無いときも常にベクトル化を...
(1)Loop利用(遅い場合)~
x <- runif(1000000)
test1 <- function () { # 百万個の数の指数を個別に計算
res <- numeric(1000000)
for (i in 1:1000000) res[i] <- exp(x[i])
res}
system.time(test1())
> system.time(test1())
ユーザ システム 経過
3.73 0.00 3.73
(2)ベクトル
system.time(res <- exp(x))
> system.time(res <- exp(x))
ユーザ システム 経過
0.11 0.00 0.11
(3)jit化
library(jit)
x <- runif(1000000)
test1 <- function () { # 百万個の数の指数を個別に計算
jit(1)
res <- numeric(1000000)
for (i in 1:1000000) res[i] <- exp(x[i])
res}
system.time(test1())
jit(0)
> system.time(test1())
ユーザ システム 経過
0.27 0.00 0.26
ベクトル演算まではいかないが、かなり高速化されている。
*jitの制限らしきもの [#qfbdece6]
windows()はjitできないらしい~
library(jit)
jit(1)
x<-rnorm(1:100)
plot(x)
Warning: jitting is now disabled
以下にエラー windows() : cannot use internal routine gse...
これならOK~
library(jit)
plot.new()
jit(1)
x<-rnorm(1:100)
plot(x)
jit(0)
jitしてもしなくてもplotの速度は変わらない。(あたりまえか...
*コメント欄 [#y0ed184f]
#comment(below)
- Ra&jitは基本的にfor()のLoop部分を高速化するようです。ど...
*リンク [#ye65cac8]
Ra:http://www.milbo.users.sonic.net/ra/~
[[R掲示板]]
[[okinawa]]~
アクセス数:
&counter;
人
ページ名: