Skip to content

Commit

Permalink
add orderer and executor
Browse files Browse the repository at this point in the history
  • Loading branch information
newmen committed Feb 9, 2017
1 parent 5f9921c commit 61d5e01
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
4 changes: 2 additions & 2 deletions engine/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
NAME := libengine

ARKSFLAGS := -DNDEBUG -O2
ARKSFLAGS := -DNDEBUG -O2 #-DMC_PRINT
#ARKSFLAGS :=
STANDART := -std=c++11

GCC_PATH := /usr
CXX := $(GCC_PATH)/bin/g++
CFLAGS := $(STANDART) $(ARKSFLAGS) -Wall -I$(GCC_PATH)/include -I/usr/local/include -pthread
CFLAGS := $(STANDART) $(ARKSFLAGS) -I$(GCC_PATH)/include -I/usr/local/include -pthread

SRC_DIR := cpp
OBJS_DIR := obj
Expand Down
2 changes: 1 addition & 1 deletion engine/cpp/engine.pro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ QMAKE_LIBDIR += /usr/local/lib

QMAKE_CXXFLAGS_RELEASE += -DNDEBUG
#QMAKE_CXXFLAGS += -D_GLIBCXX_DEBUG_PEDANTIC
#QMAKE_CXXFLAGS += -DPRINT
#QMAKE_CXXFLAGS += -DMC_PRINT
#QMAKE_CXXFLAGS += -DSERIALIZE
QMAKE_CXXFLAGS += -std=c++11
#QMAKE_CXXFLAGS += -I../hand-generations/src
Expand Down
14 changes: 14 additions & 0 deletions executor.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
PREFIX = 'ex'

current_dir = `pwd`.chomp

[
['engine/hand-generations', 'hand', 'simple-diamond'],
['results/eg1', 'auto', 'simulate'],
].each do |exec_dir, suffix, bin|
Dir.chdir("#{current_dir}/#{exec_dir}")
(1..4).each do |i|
name = "#{PREFIX}#{i}-#{suffix}"
`./#{bin} #{name} > #{name}.log &`
end
end
40 changes: 40 additions & 0 deletions orderer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
current_dir = `pwd`.chomp

PLOTS_DIR = 'plots'
TOTAL_DIR = 'results/total'

[
['engine/hand-generations', 'hand', 'engine/calculations', '../../..'],
['results/eg1', 'auto', 'results/calculations', '../../../../engine'],
].each do |raw_path, suffix, result_path, pre_gp_path|
(1..4).each do |i|
Dir.chdir("#{current_dir}/#{raw_path}")
prefix = "eh#{i}"

unless Dir["#{prefix}*"].empty?
bad_log_file = "eg#{i}-#{suffix}.log"
new_log_file = "#{prefix}-#{suffix}.log"
`[[ -f #{bad_log_file} ]] && mv #{bad_log_file} #{new_log_file}`

tmp_dir = "temp_e#{i}"
`mkdir -p #{tmp_dir}/#{PLOTS_DIR}`
`[[ -f #{new_log_file} ]] && mv eh#{i}* #{tmp_dir}/`
`[[ -d #{tmp_dir} ]] && mv #{tmp_dir}/*.sls #{tmp_dir}/#{PLOTS_DIR}`
`[[ -d #{tmp_dir} ]] && mv #{tmp_dir} #{prefix}`
end

calc_dir = "#{current_dir}/#{result_path}"
`[[ -d #{prefix} ]] && mv #{prefix} #{calc_dir}`

Dir.chdir("#{calc_dir}/#{prefix}/#{PLOTS_DIR}")
if Dir['*.png'].empty?
sls_file = `ls *.sls`.chomp
`ruby #{pre_gp_path}/slices_graphics_renderer.rb #{sls_file}`
end

Dir.chdir('..')
total_dir = "#{current_dir}/#{TOTAL_DIR}/#{suffix}"
`mkdir -p #{total_dir}`
`cp -R #{PLOTS_DIR} #{total_dir}/#{prefix}-#{PLOTS_DIR}`
end
end

0 comments on commit 61d5e01

Please sign in to comment.