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 (2183B)


      1 #!/bin/sh
      2 
      3 echo
      4 echo
      5 echo
      6 echo
      7 echo
      8 echo
      9 echo
     10 echo
     11 echo
     12 echo
     13 
     14 query() {
     15 	sqlite3 $db << EOF
     16 .mode column
     17 .headers on
     18 $*
     19 EOF
     20 }
     21 
     22 query_for_gnuplot() {
     23 	sqlite3 $db << EOF
     24 .mode column
     25 $*
     26 EOF
     27 }
     28 
     29 query_for_shell() {
     30 	sqlite3 $db "$*"
     31 }
     32 
     33 src=build/profile.csv
     34 db=build/profile.sqlite3
     35 rm -f $db
     36 
     37 query '
     38 CREATE TABLE profile(
     39   "ship" TEXT,
     40   "node" TEXT,
     41   "profile" TEXT,
     42   "nthreads" INTEGER,
     43   "fps1" FLOAT,
     44   "fps2" FLOAT,
     45   "waves" FLOAT,
     46   "velocity" FLOAT,
     47   "wetted" FLOAT,
     48   "clamp" FLOAT,
     49   "pressure" FLOAT,
     50   "exchange" FLOAT,
     51   "total" FLOAT
     52 );
     53 '
     54 sqlite3 $db << EOF
     55 .import $src profile
     56 DELETE FROM profile WHERE node='node'
     57 EOF
     58 
     59 for i in sequential openmp opencl
     60 do
     61 	echo
     62 	echo "Best time ($i)"
     63 	query "
     64 	SELECT ship,node,profile,nthreads, MIN(total), fps1
     65 	FROM profile
     66 	WHERE profile='$i'
     67 	GROUP BY ship,node,profile
     68 	"
     69 done
     70 
     71 echo
     72 echo "Best time (all)"
     73 query '
     74 SELECT ship,node, profile, nthreads, MIN(total)
     75 FROM profile
     76 GROUP BY ship,node
     77 '
     78 
     79 echo
     80 echo "Best simulation FPS (all)"
     81 query '
     82 SELECT ship,node, profile, nthreads, MAX(fps1)
     83 FROM profile
     84 GROUP BY ship,node
     85 '
     86 
     87 
     88 echo
     89 echo "Amdahl's law"
     90 for ship in $(query_for_shell 'SELECT DISTINCT ship FROM profile')
     91 do
     92 	for node in $(query_for_shell 'SELECT DISTINCT node FROM profile')
     93 	do
     94 		echo $node
     95 		query_for_gnuplot "
     96 		SELECT nthreads,total,
     97 			(SELECT total FROM profile WHERE profile='sequential' AND node='$node' AND ship='$ship')/total
     98 		FROM profile
     99 		WHERE profile='openmp' AND node='$node' AND ship='$ship'
    100 		" > build/$ship.$node.openmp.dat
    101 	done
    102 done
    103 
    104 
    105 echo
    106 echo "Histogram"
    107 for ship in $(query_for_shell 'SELECT DISTINCT ship FROM profile')
    108 do
    109 for node in $(query_for_shell 'SELECT DISTINCT node FROM profile')
    110 do
    111 query "
    112 .mode csv
    113 .separator ' '
    114 SELECT profile,waves,velocity,wetted,clamp,pressure,exchange
    115 FROM profile a
    116 WHERE node='$node' AND ship='$ship' AND total = (
    117 	SELECT MIN(total)
    118 	FROM profile b
    119 	WHERE node='$node' AND ship='$ship' AND a.profile=b.profile
    120 	GROUP BY profile
    121 )
    122 " > build/$ship.$node.histogram.dat
    123 done
    124 done
    125 
    126 query "
    127 .mode csv
    128 .separator ' '
    129 SELECT nthreads,AVG(pressure)
    130 FROM profile
    131 WHERE node = 'capybara1' AND profile = 'openmp'
    132 GROUP BY nthreads
    133 ORDER BY nthreads ASC
    134 "