kuroの覚え書き

96の個人的覚え書き

Rのベンチマーク

#パッケージのインストール
install.packages("devtools")
devtools::install_github("csgillespie/benchmarkme")

注:色々とエラーが出て、それを一つずつ潰していく必要がある。
あまりに色々やったのでなにがクリティカルだったのかわからん。
Ubuntuの情報が豊富で、なんとかなったが、Alma Linux8.7とMacではそもそもインストールがまだ成功していない。
なのでこのマシンの速度が速いのかなんなのか比較できていない。

#パッケージの読み込み
library("benchmarkme")

> res<-benchmark_std()
# Programming benchmarks (5 tests):
	3,500,000 Fibonacci numbers calculation (vector calc): 0.231 (sec).
	Grand common divisors of 1,000,000 pairs (recursion): 0.485 (sec).
	Creation of a 3,500 x 3,500 Hilbert matrix (matrix calc): 0.37 (sec).
	Creation of a 3,000 x 3,000 Toeplitz matrix (loops): 1.17 (sec).
	Escoufier's method on a 60 x 60 matrix (mixed): 0.699 (sec).
# Matrix calculation benchmarks (5 tests):
	Creation, transp., deformation of a 5,000 x 5,000 matrix: 0.595 (sec).
	2,500 x 2,500 normal distributed random matrix^1,000: 0.18 (sec).
	Sorting of 7,000,000 random values: 0.536 (sec).
	2,500 x 2,500 cross-product matrix (b = a' * a): 1.05 (sec).
	Linear regr. over a 5,000 x 500 matrix (c = a \ b'): 0.11 (sec).
# Matrix function benchmarks (5 tests):
	Cholesky decomposition of a 3,000 x 3,000 matrix: 0.638 (sec).
	Determinant of a 2,500 x 2,500 random matrix: 0.761 (sec).
	Eigenvalues of a 640 x 640 random matrix: 0.369 (sec).
	FFT over 2,500,000 random values: 0.294 (sec).
	Inverse of a 1,600 x 1,600 random matrix: 0.635 (sec).

> plot(res)
You are ranked 43 out of 749 machines.
Press return to get next plot 
You are ranked 33 out of 747 machines.
Press return to get next plot 
You are ranked 48 out of 747 machines.

> get_cpu()
$vendor_id
[1] "GenuineIntel"

$model_name
[1] "Intel(R) Xeon(R) CPU E3-1281 v3 @ 3.70GHz"

$no_of_cores
[1] 8

> get_r_version()
$platform
[1] "x86_64-pc-linux-gnu"

$arch
[1] "x86_64"

$os
[1] "linux-gnu"

$system
[1] "x86_64, linux-gnu"

$status
[1] ""

$major
[1] "4"

$minor
[1] "3.1"

$year
[1] "2023"

$month
[1] "06"

$day
[1] "16"

$`svn rev`
[1] "84548"

$language
[1] "R"

$version.string
[1] "R version 4.3.1 (2023-06-16)"

$nickname
[1] "Beagle Scouts"


Alma Linux8.7でもできた。

> res <- benchmark_std()
# Programming benchmarks (5 tests):
	3,500,000 Fibonacci numbers calculation (vector calc): 0.39 (sec).
	Grand common divisors of 1,000,000 pairs (recursion): 0.416 (sec).
	Creation of a 3,500 x 3,500 Hilbert matrix (matrix calc): 0.226 (sec).
	Creation of a 3,000 x 3,000 Toeplitz matrix (loops): 1.05 (sec).
	Escoufier's method on a 60 x 60 matrix (mixed): 0.805 (sec).
# Matrix calculation benchmarks (5 tests):
	Creation, transp., deformation of a 5,000 x 5,000 matrix: 0.389 (sec).
	2,500 x 2,500 normal distributed random matrix^1,000: 0.35 (sec).
	Sorting of 7,000,000 random values: 0.758 (sec).
	2,500 x 2,500 cross-product matrix (b = a' * a): 0.0517 (sec).
	Linear regr. over a 5,000 x 500 matrix (c = a \ b'): 0.201 (sec).
# Matrix function benchmarks (5 tests):
	Cholesky decomposition of a 3,000 x 3,000 matrix: 1.09 (sec).
	Determinant of a 2,500 x 2,500 random matrix: 0.729 (sec).
	Eigenvalues of a 640 x 640 random matrix: 15.7 (sec).
	FFT over 2,500,000 random values: 0.102 (sec).
	Inverse of a 1,600 x 1,600 random matrix: 1.26 (sec).
> plot(res)
You are ranked 18 out of 93 machines.
Press return to get next plot 
You are ranked 24 out of 93 machines.
Press return to get next plot 
You are ranked 93 out of 93 machines.
> get_cpu()
$vendor_id
[1] "AuthenticAMD"

$model_name
[1] "AMD EPYC 7413 24-Core Processor"

$no_of_cores
[1] 48


Rは基本シングルコアで動作するから、24コアだけどクロックの遅いAMD EPYCより4コアでクロックの速いHaswellのXeonのほうが、ある部分では優っているかもしれない。