Commit 559a37c9 authored by Vladislav Perepelkin's avatar Vladislav Perepelkin
Browse files

Merge branch 'master' into trace_playback

parents f0bd5451 75a4bd03
......@@ -42,4 +42,5 @@ private:
std::string fp_path_;
std::vector<std::string> argv_;
bool dynamic_balance_;
unsigned int worker_threads_count_=DEFAULT_WORKER_THREADS_COUNT;
};
......@@ -3,7 +3,7 @@
# TODO add ability to use some other temporary directory for building
# tests, not .luna subdirectory, and allow setup via environment var.
import sys, os, subprocess, json, re, datetime, signal
import sys, os, subprocess, json, re, datetime, signal, shutil
from common import *
_argv0=os.path.split(sys.argv[0])[1]
......@@ -47,6 +47,7 @@ OPTIONS
-b
Enable dynamic balance.
-O0
-O
Specify optimization level. -O0 optimizes compilation time at
......@@ -66,9 +67,18 @@ OPTIONS
Do not run program after compilation. Also sets no-cleanup
flag. Output is a command for program execution.
-c
Only compile the program, deleting all intermediate files.
The result is stored as ./libucodes.so by default (unlike
the --compile-only flag, which stores the result into
the build directory.
-D key
-D key=val
Add preprocessor variable (#define...)
--worker-threads-count=<count>
Set number of worker threads.
ENVIRONMENT
Environment variables affect LuNA settings, but the OPTIONs take
......@@ -128,6 +138,7 @@ def parse_args(args):
conf['TIME']=False
conf['BALANCE']=False
conf['PP_KEYS']=[]
conf['RTS_FLAGS']=[]
VERBOSE_FLAG=False
COMPILE_ONLY_FLAG=False
......@@ -139,6 +150,8 @@ def parse_args(args):
conf['BUILD_DIR']=arg.split('=', 1)[1]
elif arg.startswith('--luna-home='):
conf['LUNA_HOME']=arg.split('=', 1)[1]
elif arg.startswith('--worker-threads-count='):
conf['RTS_FLAGS'].append(arg)
elif arg.startswith('--disable-warning='):
try:
num=int(arg.split('=', 1)[1])
......@@ -173,6 +186,13 @@ def parse_args(args):
raise FatalError("no value provided for -D key");
arg=args[cur]
conf['PP_KEYS'].append(arg)
elif arg=='-c':
COMPILE_ONLY_FLAG=True
conf['SO_OUTPUT_FILE_NAME']='libucodes.so'
elif arg.startswith('--output-file='):
if 'SO_OUTPUT_FILE_NAME' in conf:
conf['SO_OUTPUT_FILE_NAME']=arg.split('=', 1)[1]
else: raise FatalError('--output-file supported only with -c before')
else:
if arg[cur].startswith('-'):
warn(1, "suspicious program name: '%s' (mistyped a key?)" \
......@@ -692,14 +712,18 @@ def main():
info('running program')
info(None)
if 'SO_OUTPUT_FILE_NAME' in conf:
shutil.copy(os.path.join(conf['BUILD_DIR'], 'libucodes.so'), conf['SO_OUTPUT_FILE_NAME'])
# =======
# run rts
# =======
rts='rts.dbg' if conf['DEBUG'] else 'rts'
cmd=[os.path.join(conf['LUNA_HOME'], 'bin', rts),
os.path.join(conf['BUILD_DIR'], 'libucodes.so')] + conf['ARGV']
cmd=[os.path.join(conf['LUNA_HOME'], 'bin', rts)] \
+ conf['RTS_FLAGS'] \
+ [os.path.join(conf['BUILD_DIR'], 'libucodes.so')] \
+ conf['ARGV']
if conf['BALANCE']:
cmd+='-b'
env=dict(os.environ)
......
......@@ -22,8 +22,24 @@ Config::Config(int argc, char **argv)
} else if (arg=="--version") {
mode_=VERSION;
break;
} else if (arg=="-b"){
} else if (arg=="-b") {
dynamic_balance_ = true;
} else if (arg.rfind("--worker-threads-count=", 0)==0) {
try
{
worker_threads_count_ = std::stoi(arg.substr(23));
if (worker_threads_count_ < 1) {
throw new std::invalid_argument("Invalid threads count: argument must be positive");
}
}
catch (const std::invalid_argument& invalid_argument_exception)
{
ABORT(invalid_argument_exception.what())
}
catch (const std::out_of_range& out_of_range_exception)
{
ABORT(out_of_range_exception.what())
}
} else {
if (mode_==UNSET) {
mode_=NORMAL;
......@@ -101,7 +117,7 @@ unsigned int Config::get_steal_proc_count() const noexcept {
unsigned int Config::get_worker_threads_count() const noexcept
{
return DEFAULT_WORKER_THREADS_COUNT;
return worker_threads_count_;
}
unsigned int Config::get_comm_request_threads_count() const noexcept
......@@ -113,3 +129,5 @@ unsigned int Config::get_comm_recv_threads_count() const noexcept
{
return DEFAULT_COMM_RECEIVE_THREADS_COUNT;
}
......@@ -80,6 +80,7 @@ int RTS::run()
}
pool_.stop();
#ifdef ADD_DEBUG_INFO
comm_->barrier();
if (!posts_.empty()) {
......@@ -99,6 +100,7 @@ int RTS::run()
}
comm_->barrier();
#endif
SHOW_EXEC_TIME
if (comm_->is_root()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment