iccsa-19-vtestbed

Virtual Testbed: Ship Motion Simulation for Personal Workstations
git clone https://git.igankevich.com/iccsa-19-vtestbed.git
Log | Files | Refs

profile.R (2763B)


      1 #!/usr/bin/Rscript
      2 
      3 profiles <- list(
      4   gpulab1 = c(
      5     'sequential',
      6     'openmp-1',
      7     'openmp-2',
      8     'openmp-3',
      9     'openmp-4',
     10     'openmp-5',
     11     'openmp-6',
     12     'openmp-7',
     13     'openmp-8',
     14     'opencl'
     15   ),
     16   capybara1 = c(
     17     'sequential',
     18     'openmp-1',
     19     'openmp-2',
     20     'openmp-3',
     21     'openmp-4',
     22     'openmp-5',
     23     'openmp-6',
     24     'openmp-7',
     25     'openmp-8',
     26     'openmp-9',
     27     'openmp-10',
     28     'openmp-11',
     29     'openmp-12',
     30     'openmp-13',
     31     'openmp-14',
     32     'openmp-15',
     33     'openmp-16',
     34     'openmp-17',
     35     'openmp-18',
     36     'openmp-19',
     37     'openmp-20',
     38     'opencl'
     39   ),
     40   storm = c(
     41     'sequential',
     42     'openmp-1',
     43     'openmp-2',
     44     'openmp-3',
     45     'openmp-4',
     46     'opencl'
     47   )
     48 )
     49 
     50 table <- data.frame(
     51   ship=rep(NA,0),
     52   node=rep(NA,0),
     53   profile=rep(NA,0),
     54   nthreads=rep(NA,0),
     55   fps1=rep(NA,0),
     56   fps2=rep(NA,0),
     57   waves=rep(NA,0),
     58   velocity=rep(NA,0),
     59   wetted=rep(NA,0),
     60   clamp=rep(NA,0),
     61   pressure=rep(NA,0),
     62   exchange=rep(NA,0),
     63   total=rep(NA,0)
     64 )
     65 
     66 cat(do.call(paste, c(as.list(colnames(table)),sep='|')), file='build/profile.csv', fill=TRUE)
     67 
     68 for (ship in c('sphere', 'micw', 'aurora')) {
     69   for (node in c('gpulab1', 'capybara1', 'storm')) {
     70     for (test in profiles[[node]]) {
     71       tokens <- strsplit(test,split='-',fixed=TRUE)[[1]]
     72       test_name <- tokens[[1]]
     73       nthreads <- 1
     74       if (length(tokens) == 2) {
     75         nthreads <- as.integer(tokens[[2]])
     76       }
     77       filename <- paste('profile-',test,'.log',sep='')
     78       path <- file.path('profile', ship, node, filename)
     79       #print(path)
     80       data <- read.table(file=path,header=FALSE,sep=' ',col.names=c('func','t'))
     81       
     82       vtb.fps <- function (tag) {
     83         samples <- data[data$func == tag,]$t
     84         samples <- tail(samples, -60*5)
     85         median(1e6 / samples)
     86       }
     87 
     88       vtb.median <- function (tag) {
     89         samples <- data[data$func == tag,]$t
     90         samples <- tail(samples, -60*5)
     91         median(samples*1e-3)
     92       }
     93 
     94       fps1 <- vtb.fps('step')
     95       fps2 <- vtb.fps('drawEvent')
     96       waves <- vtb.median('generate_waves')
     97       velocity <- vtb.median('compute_velocity_potential')
     98       wetted <- vtb.median('compute_wetted_panels')
     99       clamp <- vtb.median('clamp_grid_to_wetted_panels')
    100       pressure <- vtb.median('compute_wave_pressure')
    101       exchange <- vtb.median('exchange')
    102       total <- vtb.median('step')
    103       row <- list(
    104         ship,
    105         node,
    106         test_name,
    107         nthreads,
    108         fps1,
    109         fps2,
    110         waves,
    111         velocity,
    112         wetted,
    113         clamp,
    114         pressure,
    115         exchange,
    116         total
    117       )
    118       cat(do.call(paste, c(row,sep='|')), file='build/profile.csv', append=TRUE, fill=TRUE)
    119       table[nrow(table)+1,] <- row
    120     }
    121   }
    122 }
    123 
    124 options(width=120)
    125 table