Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
housengw committed Mar 1, 2022
2 parents 9bd99c4 + 33604ff commit 59c3135
Show file tree
Hide file tree
Showing 143 changed files with 11,147 additions and 8,435 deletions.
6 changes: 5 additions & 1 deletion .github/scripts/test-lfc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ bin/lfc -f --rti rti test/C/src/Minimal.lf
bin/lfc --federated --rti rti test/C/src/Minimal.lf

# -h,--help Display this information.
bin/lfc -h
bin/lfc --help

# -l, --lint Enable linting during build.
Expand All @@ -62,7 +63,7 @@ bin/lfc --output-path . test/C/src/Minimal.lf
# --runtime-version <arg> Specify the version of the runtime
# library used for compiling LF
# programs.
bin/lfc --runtime-version 26e6e641916924eae2e83bbf40cbc9b933414310 test/Cpp/src/Minimal.lf
bin/lfc --runtime-version ca216ccc3da5ecff0e8013f75e275d7acac099de test/Cpp/src/Minimal.lf

# -t,--threads Specify the default number of threads.
bin/lfc -t 2 test/C/src/Minimal.lf
Expand All @@ -72,5 +73,8 @@ bin/lfc -threads 2 test/C/src/Minimal.lf
# (Added no-compile to avoid adding dependency.)
bin/lfc --target-compiler gcc --no-compile test/C/src/Minimal.lf

# --version
bin/lfc --version

# Ensure that lfc is robust to symbolic links.
test_with_links "lfc"
11 changes: 7 additions & 4 deletions .github/workflows/benchmark-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,17 @@ jobs:
run: |
python3 benchmark/runner/run_benchmark.py -m test_mode=True iterations=1 benchmark="glob(*)" target=lf-c,lf-c-unthreaded
if: ${{ inputs.target == 'C' }}
- name: Setup C++ build environment
- name: Compile reactor-cpp once and reuse for all benchmarks
run: |
./bin/lfc test/Cpp/src/Minimal.lf
echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/test/Cpp/lib" >> $GITHUB_ENV
mkdir -p reactor-cpp/build
cd reactor-cpp/build
cmake -DCMAKE_INSTALL_PREFIX=../install ../../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' }}
- name: Test C++ benchmarks
run: |
python3 benchmark/runner/run_benchmark.py -m test_mode=True iterations=1 benchmark="glob(*)" target=lf-cpp iterations=1 target.params.extra_args="[--external-runtime-path, ${GITHUB_WORKSPACE}/test/Cpp]"
python3 benchmark/runner/run_benchmark.py -m test_mode=True iterations=1 benchmark="glob(*)" target=lf-cpp iterations=1 target.params.extra_args="[--external-runtime-path, ${GITHUB_WORKSPACE}/reactor-cpp/install]"
if: ${{ inputs.target == 'Cpp' }}
- name: Setup Rust
uses: ATiltedTree/setup-rust@v1
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/c-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
required: false
type: boolean
default: false
scheduler:
required: false
type: string

jobs:
run:
Expand Down Expand Up @@ -53,14 +56,19 @@ jobs:
- name: Build RTI docker image
uses: ./.github/actions/build-rti-docker
if: ${{ runner.os == 'Linux' }}
- name: Perform tests for C target
- name: Perform tests for C target with default scheduler
run: |
./gradlew test --tests org.lflang.tests.runtime.CTest.* --tests org.lflang.tests.lsp.LspTests.lspWithDependenciesTestC
if: ${{ !inputs.use-cpp }}
- name: Perform tests for CCpp target
if: ${{ !inputs.use-cpp && !inputs.scheduler }}
- name: Perform tests for C target with specified scheduler (no LSP tests)
run: |
echo "Specified scheduler: ${{ inputs.scheduler }}"
./gradlew test --tests org.lflang.tests.runtime.CSchedulerTest.* -Dscheduler=${{ inputs.scheduler }}
if: ${{ !inputs.use-cpp && inputs.scheduler }}
- name: Perform tests for CCpp target with default scheduler
run: |
./gradlew test --tests org.lflang.tests.runtime.CCppTest.*
if: ${{ inputs.use-cpp }}
if: ${{ inputs.use-cpp && !inputs.scheduler }}
- name: Report to CodeCov
uses: codecov/codecov-action@v2.1.0
with:
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/cpp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ jobs:
repository: lf-lang/lingua-franca
submodules: true
ref: ${{ inputs.compiler-ref }}
- name: Set cpp runtime version
run: |
echo ${{ inputs.runtime-ref }} > org.lflang/src/org/lflang/generator/cpp/cpp-runtime-version.txt
if: ${{ inputs.runtime-ref }}
- name: Check out specific ref of reactor-cpp
uses: actions/checkout@v2
with:
repository: lf-lang/reactor-cpp
path: org.lflang/src/lib/cpp/reactor-cpp
ref: ${{ inputs.runtime-ref }}
if: ${{ inputs.runtime-ref }}
- name: Run C++ tests;
run: |
./gradlew test --tests org.lflang.tests.runtime.CppTest.* --tests org.lflang.tests.lsp.LspTests.lspWithDependenciesTestCpp
Expand All @@ -42,4 +45,4 @@ jobs:
file: org.lflang.tests/build/reports/xml/jacoco
fail_ci_if_error: false
verbose: true
if: ${{ !inputs.compiler-ref }} # i.e., if this is part of the main repo's CI
if: ${{ !inputs.runtime-ref }} # i.e., if this is part of the main repo's CI
10 changes: 1 addition & 9 deletions .github/workflows/lsp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: sudo apt-get remove clang-*
if: ${{ runner.os == 'Linux' }}
- name: Uninstall packages MacOS
run: brew uninstall gcc
run: brew uninstall --ignore-dependencies gcc
if: ${{ runner.os == 'macOS' }}
- name: Uninstall packages Windows
run: |
Expand Down Expand Up @@ -47,14 +47,6 @@ jobs:
brew install protobuf
brew install protobuf-c
if: ${{ runner.os == 'macOS' }}
- name: Install dependencies Windows
uses: lukka/run-vcpkg@v4
with:
vcpkgArguments: protobuf
vcpkgGitCommitId: 6185aa76504a5025f36754324abf307cc776f3da
vcpkgDirectory: ${{ github.workspace }}/vcpkg/
vcpkgTriplet: x64-windows-static
if: ${{ runner.os == 'Windows' }}
- name: Check out lingua-franca repository
uses: actions/checkout@v2
with:
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/py-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ jobs:
brew install protobuf
brew install coreutils
if: ${{ runner.os == 'macOS' }}
- name: Install dependencies Windows
uses: lukka/run-vcpkg@v4
with:
vcpkgArguments: protobuf
vcpkgGitCommitId: 6185aa76504a5025f36754324abf307cc776f3da
vcpkgDirectory: ${{ github.workspace }}/vcpkg/
vcpkgTriplet: x64-windows-static
if: ${{ runner.os == 'Windows' }}
- name: Install Google API Python Client
run: pip3 install --upgrade google-api-python-client
- name: Check out lingua-franca repository
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "org.lflang/src/lib/py/reactor-c-py"]
path = org.lflang/src/lib/py/reactor-c-py
url = https://github.com/lf-lang/reactor-c-py.git
[submodule "org.lflang/src/lib/cpp/reactor-cpp"]
path = org.lflang/src/lib/cpp/reactor-cpp
url = https://github.com/lf-lang/reactor-cpp
2 changes: 1 addition & 1 deletion benchmark/C/Savina/src/BenchmarkRunner.lf
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ reactor BenchmarkRunner(num_iterations:int(12)) {
self->measuredTimes[self->count] = duration;
self->count += 1;

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

schedule(nextIteration, 0);

Expand Down
1 change: 1 addition & 0 deletions benchmark/C/Savina/src/concurrency/BoundedBuffer.lf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ target C {
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
Expand Down
1 change: 1 addition & 0 deletions benchmark/C/Savina/src/concurrency/CigaretteSmoker.lf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ target C {
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
Expand Down
1 change: 1 addition & 0 deletions benchmark/C/Savina/src/concurrency/Dictionary.lf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ target CCpp {
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
Expand Down
1 change: 1 addition & 0 deletions benchmark/C/Savina/src/concurrency/LogisticMap.lf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ target C {
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
Expand Down
3 changes: 2 additions & 1 deletion benchmark/C/Savina/src/concurrency/Philosophers.lf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ target C {
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
Expand Down Expand Up @@ -183,7 +184,7 @@ reactor Arbitrator(num_philosophers:int(20)) {
if (finished[i]->is_present) {
self->finished_philosophers++;
if (self->num_philosophers == self->finished_philosophers) {
printf("Arbitrator: All philosophers are seated. Number of denials to philosophers: %d\n", self->retries);
printf("Arbitrator: All philosophers are sated. Number of denials to philosophers: %d\n", self->retries);
SET(allFinished, true);
}
}
Expand Down
1 change: 1 addition & 0 deletions benchmark/C/Savina/src/concurrency/SleepingBarber.lf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ target C {
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
Expand Down
24 changes: 14 additions & 10 deletions benchmark/C/Savina/src/concurrency/SortedList.lf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ target CCpp {
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
Expand Down Expand Up @@ -122,30 +123,33 @@ reactor Worker(
self->requests_sent++;
} else {
SET(finished, true);
self->requests_sent = 0;
}
=}
}

reactor LinkedList(num_workers: int(20)) {

state data_list: SortedLinkedList<int>;
state data_list: {=SortedLinkedList<int>*=};
state responses_to_send: int[];

logical action send_responses;

input print_result: bool;
input finished: bool;
input[num_workers] requests: message_t;
output[num_workers] responses: int;

reaction(startup) {=
self->data_list = SortedLinkedList<int>();
self->data_list = new SortedLinkedList<int>();
self->responses_to_send = (int*) malloc(self->num_workers * sizeof(int));
=}

reaction(print_result) {=
reaction(finished) {=
// check result
info_print("List Size = %d", self->data_list.size());
// no need to reset local state
info_print("List Size = %d", self->data_list->size());
// reset local state
delete self->data_list;
self->data_list = new SortedLinkedList<int>();
=}

reaction(send_responses) -> responses {=
Expand All @@ -162,19 +166,19 @@ reactor LinkedList(num_workers: int(20)) {
int value = requests[i]->value.value;
switch (requests[i]->value.type) {
case CONTAINS:
self->responses_to_send[i] = self->data_list.contains(value);
self->responses_to_send[i] = self->data_list->contains(value);
LOG_PRINT(
"Worker %ld checks if %d is contained in the list",
i, value
);
break;
case WRITE:
self->data_list.add(value);
self->data_list->add(value);
self->responses_to_send[i] = value;
LOG_PRINT("Worker %ld writes %d", i, value);
break;
case SIZE:
self->responses_to_send[i] = self->data_list.size();
self->responses_to_send[i] = self->data_list->size();
LOG_PRINT("Worker %ld reads the list size", i);
break;
}
Expand Down Expand Up @@ -375,7 +379,7 @@ main reactor(numIterations:int(12), numWorkers:int(20), numMessagesPerWorker:int

(runner.start)+ -> manager.start, workers.doWork;
manager.finished -> runner.finish;
manager.finished -> sorted_list.print_result;
manager.finished -> sorted_list.finished;

workers.request -> sorted_list.requests;
sorted_list.responses -> workers.response;
Expand Down
1 change: 1 addition & 0 deletions benchmark/C/Savina/src/micro/Big.lf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ target C{
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
Expand Down
1 change: 1 addition & 0 deletions benchmark/C/Savina/src/micro/Chameneos.lf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ target C {
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
Expand Down
1 change: 1 addition & 0 deletions benchmark/C/Savina/src/micro/Counting.lf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ target C {
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
Expand Down
1 change: 1 addition & 0 deletions benchmark/C/Savina/src/micro/PingPong.lf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ target C {
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
Expand Down
1 change: 1 addition & 0 deletions benchmark/C/Savina/src/micro/ThreadRing.lf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ target C {
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
Expand Down
3 changes: 2 additions & 1 deletion benchmark/C/Savina/src/micro/Throughput.lf
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ target C {
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
threads: 2,
/// [[[end]]]
flags: "-lm",
flags: "-lm"
};

import BenchmarkRunner from "../BenchmarkRunner.lf";
Expand Down
1 change: 1 addition & 0 deletions benchmark/C/Savina/src/parallelism/Apsp.lf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ target C {
/* [[[cog
if (threaded_runtime=="True"):
cog.outl(f"threads: {threads},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threads: 0,")
]]] */
Expand Down
Loading

0 comments on commit 59c3135

Please sign in to comment.