1
1
# ## Fetch results from all computers ###
2
2
# #########################################
3
3
4
- rm(list = ls())
5
4
library(compiler )
6
5
7
- basefold <- ' ~/dragonfly/sra-foundations/modelling/bh-dd-k50/'
8
- setwd(basefold )
9
-
10
- source(' parallel-pars.r' )
6
+ source(' ../pars_parallel.r' )
11
7
# # source('functions.r')
12
8
loadcmp(' functions_cmp.r' )
13
9
14
- load(datafile )
10
+ load(sprintf(' ../%s' , datafile ))
11
+ data <- eval(parse(text = dataname ))
12
+ if (dataname != ' data' ) {rm(dataname ); gc()}
15
13
16
14
load(' cores_alloc.rdata' )
17
15
othercomps <- unique(cores_alloc $ comp [! (cores_alloc $ comp %in% thiscomp )])
18
16
19
17
c = othercomps [1 ]
20
18
for (c in othercomps )
21
19
{
22
- fold <- sprintf(' %s-%s' , outputfold , c )
20
+ fold <- sprintf(' ../ %s-%s' , outputfold , c )
23
21
dir.create(fold , showWarnings = F )
24
22
# # Mount results from other computers
25
23
if (! length(dir(fold )))
@@ -35,26 +33,26 @@ folds <- c(outputfold, sprintf('%s-%s', outputfold, othercomps))
35
33
for (d in folds ) # d='results-taiko' # d='results'
36
34
{
37
35
cat(' \n Merging files in' , d , ' ...\n ' )
38
- setwd(sprintf(' %s%s ' , basefold , d ))
36
+ setwd(sprintf(' %s/%s/%s/%s ' , basefold , projectname , runfold , d ))
39
37
40
- inter <- dir(pattern = ' .*pars1-steps .*..rdata' )
41
- fin <- dir(patter = ' .*pars-steps .*..rdata' )
38
+ inter <- dir(pattern = ' .*incomplete .*..rdata' )
39
+ fin <- dir(patter = ' .*finished .*..rdata' )
42
40
43
41
for (f in inter ) # f=inter[1]
44
42
{
45
43
load(f )
46
- resi <- rbind2(resi , pars1 )
44
+ resi <- rbind2(resi , data1 )
47
45
}
48
46
49
47
for (f in fin ) # f=fin[2]
50
48
{
51
49
load(f )
52
- resf <- rbind2(resf , pars )
50
+ resf <- rbind2(resf , data )
53
51
}
54
52
}
55
53
56
54
57
- setwd(basefold )
55
+ setwd(sprintf( ' %s/%s/%s ' , basefold , projectname , runfold ) )
58
56
59
57
# # Unmount other computers
60
58
for (c in othercomps ) # c='frank'
@@ -64,21 +62,20 @@ for (c in othercomps) # c='frank'
64
62
unlink(fold , recursive = T )
65
63
}
66
64
67
- allresdir <- sprintf(' %sall-results' , basefold )
68
- dir.create(allresdir , showWarnings = F )
65
+ dir.create(allresfold , showWarnings = F )
69
66
setwd(allresdir )
70
67
71
68
72
69
# # Merge intermediate and final results
73
- resi2 <- resi [! (resi $ row %in% resf $ row ),] # remove finished rows from intermediate results
70
+ resi2 <- resi [! (resi [[ rowidcol ]] %in% resf [[ rowidcol ]] ),] # remove finished rows from intermediate results
74
71
res <- rbind(resi2 , resf )
75
72
76
- res <- res [order(res $ row ),]
73
+ res <- res [order(res [[ rowidcol ]] ),]
77
74
78
75
79
76
80
77
# # Check missing rows and summarise
81
- missingrows <- dem $ row [ ! ( dem $ row %in% res $ row )]
78
+ missingrows <- data [[ rowidcol ]][ ! ( data [[ rowidcol ]] %in% res [[ rowidcol ]] )]
82
79
if (length(missingrows ))
83
80
{
84
81
mr <- as.numeric(missingrows )
@@ -90,17 +87,11 @@ if (length(missingrows))
90
87
}
91
88
92
89
cat(sprintf(' \n %i rows done (%i duplicates) after merging intermediates and final results.
93
- Details:' , nrow(res ), sum(duplicated(res $ row ))),' \n ' )
94
- print(table(res $ species ))
95
-
96
- if (' pbr0' %in% names(res ))
97
- cat(sprintf(' \n %i PBR values (%0.1f%%) already calculated.\n ' , sum(! is.na(res $ pbr0 )),
98
- 100 * sum(! is.na(res $ pbr0 ))/ nrow(res ))) else
99
- cat(' \n No PBR values already calculated.\n ' )
90
+ Details:' , nrow(res ), sum(duplicated(res [[rowidcol ]]))),' \n ' )
100
91
101
92
102
93
# ## Save appended results
103
- res <- res [order(res $ row ),]
94
+ res <- res [order(res [[ rowidcol ]] ),]
104
95
105
96
setwd(allresdir )
106
97
save(res , file = ' results_res.rdata' )
0 commit comments