Skip to content

Commit

Permalink
Merge branch 'main' into automated-full-benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
petervdonovan committed Jul 19, 2022
2 parents 4d9f2bf + 8477420 commit 3b2266c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
run: |
mkdir -p reactor-cpp/build
cd reactor-cpp/build
cmake -DCMAKE_INSTALL_PREFIX=../install ../../lf/org.lflang/src/lib/cpp/reactor-cpp
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo -DREACTOR_CPP_VALIDATE=ON -DREACTOR_CPP_TRACE=OFF -DREACTOR_CPP_LOG_LEVEL=2 ../../lf/org.lflang/src/lib/cpp/reactor-cpp
make install
echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/reactor-cpp/install/lib" >> $GITHUB_ENV
if: ${{ inputs.target == 'Cpp' }}
Expand Down
15 changes: 7 additions & 8 deletions C/Savina/src/BenchmarkRunner.lf
Original file line number Diff line number Diff line change
Expand Up @@ -61,29 +61,28 @@ reactor BenchmarkRunner(num_iterations:int(12)) {
reaction(startup) -> nextIteration {=
// Initialize an array of interval_t
self->measuredTimes = (interval_t *) calloc(self->num_iterations, sizeof(interval_t));
schedule(nextIteration, 0);
lf_schedule(nextIteration, 0);
=}


reaction(nextIteration) -> start, done {=
if (self->count < self->num_iterations) {
self->startTime = get_physical_time();
SET(start, true);
self->startTime = lf_time_physical();
lf_set(start, true);
} else {
schedule(done, 0);
lf_schedule(done, 0);
}
=}

reaction(finish) -> nextIteration {=
interval_t end_time = get_physical_time();
interval_t end_time = lf_time_physical();
interval_t duration = end_time - self->startTime;
self->measuredTimes[self->count] = duration;
self->count += 1;

printf("Iteration %d - %.3f ms\n", self->count, toMS(duration));

schedule(nextIteration, 0);

lf_schedule(nextIteration, 0);
=}

reaction(done) {=
Expand All @@ -94,7 +93,7 @@ reactor BenchmarkRunner(num_iterations:int(12)) {
printf("Best Time:\t %.3f msec\n", measuredMSTimes[0]);
printf("Worst Time:\t %.3f msec\n", measuredMSTimes[self->num_iterations - 1]);
printf("Median Time:\t %.3f msec\n", median(measuredMSTimes, self->num_iterations));
request_stop();
lf_request_stop();
=}

preamble {=
Expand Down
6 changes: 6 additions & 0 deletions runner/conf/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ lf_path: "${oc.env:LF_PATH}"
bench_path: "${oc.env:LF_BENCHMARKS_PATH}"
continue_on_error: False
test_mode: False

# keep the chdir behaviour of hydra<1.2.0
hydra:
job:
chdir: True

defaults:
- size: slow
- benchmark: ???
Expand Down
2 changes: 1 addition & 1 deletion runner/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hydra-core>=1.1.0,<1.2.0
hydra-core>=1.2.0
cogapp
matplotlib
pandas
5 changes: 3 additions & 2 deletions runner/run_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ def execute_command(command, timeout=None, stacktrace=False):
line = q.get(timeout=timeout)
while line:
line = q.get(timeout=timeout)
output.append(line)
cmd_log.info(line.rstrip())
if line and not line.isspace():
output.append(line)
cmd_log.info(line.rstrip())
code = process.wait(timeout=timeout)
except (Empty, subprocess.TimeoutExpired):
cmd_log.error(f"{cmd_str} timed out.")
Expand Down

0 comments on commit 3b2266c

Please sign in to comment.