1
1
2
- .dbfile <- " /var/tmp/gcbd .sqlite"
2
+ .dbfile <- " ~/gcbc .sqlite"
3
3
4
4
requirements <- function () {
5
5
6
- # are we on Unix ?
7
- stopifnot(.Platform $ OS.type == " unix" )
8
-
9
- # are we on a Debian or Ubuntu system ?
10
- stopifnot(file.exists(" /etc/debian_version" ))
11
-
12
- # reference blas as minimum standard installed ?
13
- stopifnot(file.exists(" /usr/share/doc/libblas3gf/copyright" ))
14
- stopifnot(file.exists(" /usr/share/doc/liblapack3gf/copyright" ))
15
-
16
- # wajig frontend to dpkg, apt, ... ?
17
- stopifnot(file.exists(" /usr/bin/wajig" ))
18
-
19
- # "littler" scripting frontend to R
20
- stopifnot(file.exists(" /usr/bin/r" ))
21
-
22
- # is Goto available -- gotoblas2-help installs this
23
- stopifnot(file.exists(" /etc/default/gotoblas2-helper" ))
24
-
25
6
# is database available ?
26
7
if ( ! file.exists(.dbfile )) {
27
8
createDatabase(.dbfile )
@@ -30,63 +11,14 @@ requirements <- function() {
30
11
invisible (TRUE )
31
12
}
32
13
33
- installAtlas <- function () {
34
- res <- system(" sudo apt-get -y --force-yes install libatlas3gf-base" , intern = TRUE , ignore.stderr = TRUE )
35
- invisible (res )
36
- }
37
-
38
- purgeAtlas <- function () {
39
- # #-- old local build wajig purge libatlas-base-dev libatlas-dev libatlas3gf-amd64sse3 libatlas3gf-base
40
- res <- system(" sudo apt-get -y --force-yes purge libatlas3gf-base" , intern = TRUE , ignore.stderr = TRUE )
41
- invisible (res )
42
- }
43
-
44
- installMKL <- function () {
45
- res <- system(" sudo apt-get -y --force-yes install revolution-mkl r-revolution-revobase revolution-r" , intern = TRUE , ignore.stderr = TRUE )
46
- invisible (res )
47
- }
48
-
49
- purgeMKL <- function () {
50
- res <- system(" sudo apt-get -y --force-yes purge revolution-mkl r-revolution-revobase revolution-r" , intern = TRUE , ignore.stderr = TRUE )
51
- invisible (res )
52
- }
53
-
54
- installGoto <- function () {
55
- res <- system(" sudo wajig -y install /var/spool/gotoblas2-helper/archive/gotoblas2_1.13-1_amd64.deb" , intern = TRUE , ignore.stderr = TRUE )
56
- invisible (res )
57
- }
58
-
59
- purgeGoto <- function () {
60
- res <- system(" sudo apt-get -y --force-yes purge gotoblas2" , intern = TRUE , ignore.stderr = TRUE )
61
- invisible (res )
62
- }
63
-
64
- installAtlas39 <- function () {
65
- res <- system(" sudo wajig -y install /var/spool/atlas39/libatlas39_3.9.25-1_amd64.deb" , intern = TRUE , ignore.stderr = TRUE )
66
- invisible (res )
67
- }
68
-
69
- purgeAtlas39 <- function () {
70
- res <- system(" sudo apt-get -y --force-yes purge libatlas39" , intern = TRUE , ignore.stderr = TRUE )
71
- invisible (res )
72
- }
73
14
74
15
createDatabase <- function (dbfile = .dbfile ) {
75
-
76
- dbi <- dbDriver(" SQLite" )
77
- dframe <- data.frame (host = " " , datum = " " ,
78
- type = " " , nobs = NA , nrun = NA ,
79
- ref = NA , atlas = NA , atl39 = NA ,
80
- mkl = NA , gotob = NA , gpu = NA )
81
- dftypes <- list (host = " text" , datum = " text" , type = " text" ,
82
- nobs = " integer" , nrun = " integer" ,
83
- ref = " real" , atlas = " real" , atl39 = " real" ,
84
- mkl = " real" , gotob = " real" , gpu = " real" )
85
- sql <- dbBuildTableDefinition(dbi , name = " benchmark" , value = dframe ,
86
- field.types = dftypes , row.names = FALSE )
87
16
dbcon <- dbConnect(dbDriver(" SQLite" ), dbname = dbfile )
88
- res <- dbGetQuery(dbcon , sql )
89
- dbDisconnect(dbcon )
17
+ on.exit(dbDisconnect(dbcon ))
18
+ dftypes <- list (host = " text" , datum = " text" , env = " text" , type = " text" ,
19
+ nobs = " integer" , nrun = " integer" )
20
+ sql <- sqlCreateTable(dbcon , " benchmark" , fields = dftypes , row.names = FALSE )
21
+ dbExecute(dbcon , sql )
90
22
}
91
23
92
24
databaseResult <- function (data ,dbfile = .dbfile ) {
@@ -101,20 +33,16 @@ databaseResult <- function(data,dbfile=.dbfile) {
101
33
}
102
34
103
35
isPackageInstalled <- function (package ) { # Henrik Bengtsson, r-devel, 24 Aug 2010
104
- path <- system.file(package = package )
105
- (path != " " )
36
+ system.file(package = package ) != " "
106
37
}
107
38
108
- # hasMagma <- function() {
109
- # isPackageInstalled("magma")
110
- # }
111
39
112
- hasGputools <- function () {
113
- isPackageInstalled(" gputools " )
40
+ hasGpuR <- function () {
41
+ isPackageInstalled(" gpuR " )
114
42
}
115
43
116
- getBenchmarkData <- function (host ) {
117
- dbcon <- dbConnect(dbDriver(" SQLite" ), dbname = system.file( " sql " , " gcbd.sqlite " , package = " gcbd " ) )
44
+ getBenchmarkData <- function (host , dbfile = .dbfile ) {
45
+ dbcon <- dbConnect(dbDriver(" SQLite" ), dbname = .dbfile )
118
46
data <- dbGetQuery(dbcon , paste(' select * from benchmark where host="' ,
119
47
host , ' " order by nobs' , sep = " " ))
120
48
invisible (dbDisconnect(dbcon ))
0 commit comments