Closed comaniac closed 7 years ago
The name of the function is run_precompiled
not run_precompile
. run_precompiled()
is a variant of run()
that takes an additional compile_result
input which run()
does not take.
if measurement_interface.parallel_compile is True
, then the flow for measuring a batch of desired results is:
1) Call compile
on everything in parallel and wait for everything to complete.
2) Call run_precompiled
on each sequentially.
otherwise, if measurement_interface.parallel_compile is False
, then the flow for measuring a batch of desired results is:
1) Call run
on each sequentially.
The motivation for the sequential measurement of both flows is that for performance optimization running things in parallel on a single node will spoil your measurements. The runs will interfere with the timing of each other.
There are use cases where you are tuning something not performance related (for example Mario), which use this first flow to get parallelism. These use cases would be better served by a new third mode that just called run()
in parallel.
You are welcome to submit a pull request that either clarifies the name/docs or adds this third measurement mode.
def compile(self, config_data, id):
"""
Compiles according to the configuration in config_data (obtained from
desired_result.configuration) Should use id paramater to determine output
location of executable Return value will be passed to run_precompiled
as compile_result, useful for storing error/timeout information
"""
pass
def run_precompiled(self, desired_result, input, limit, compile_result, id):
"""
Runs the given desired result on input and produce a Result() Abort
early if limit (in seconds) is reached Assumes that the executable
to be measured is already compiled in an executable corresponding to
identifier id compile_result is the return result of compile(), will be
None if compile was not called If id = None, must call run()
"""
return self.run(desired_result, input, limit)
Thanks for clarifying. I'll try to do that later on.
I'm not sure if I totally understood this or not. When I tried to enable parallel compile feature, I noticed that I need to implement "run_precompile" and "compile" functions. The purpose of "compile" function is clear but not the other one. I supposed "run_precompile" is a function that is called before the compilation for preprocessing. However, it turns out that the "run_precompile" function is invoked after the "compile" function. After tracing the driver.py, I found the following explanation:
"Optional compile_result parameter can be passed to run_precompiled as the return value of compile()"
and it did be called after the "compile" function in "process_all".
Considering the actual usage of this function, shouldn't that be named "postcompile" or "prerun" instead? Or I misunderstood something here?