Skip to content

Commit

Permalink
Merge pull request #61 from AneesHl/main
Browse files Browse the repository at this point in the history
Fixed errors (on aarm64 Macs) and deprecated syntax in C/CPP/TS targets
  • Loading branch information
cmnrd authored Feb 20, 2024
2 parents 66e1c3c + 8d0e96e commit 79413ee
Show file tree
Hide file tree
Showing 47 changed files with 761 additions and 750 deletions.
4 changes: 2 additions & 2 deletions C/Savina/src/BenchmarkRunner.lf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ preamble {=
#include <stdio.h>
=}

reactor BenchmarkRunner(num_iterations:int(12)) {
reactor BenchmarkRunner(num_iterations:size_t=12) {

/** Signal to start execution. Set this input from a startup reaction in the main reactor. */
input inStart:bool;
Expand All @@ -54,7 +54,7 @@ reactor BenchmarkRunner(num_iterations:int(12)) {
logical action done:bool;

/** Number of iterations already executed. */
state count:unsigned(0);
state count:unsigned=0;

/** Start time for runtime measurement. */
state startTime:instant_t;
Expand Down
16 changes: 8 additions & 8 deletions C/Savina/src/concurrency/Banking.lf
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@
target C {
/* [[[cog
if (threading=="True"):
cog.outl("threading: true,")
cog.outl("single-threaded: false,")
cog.outl(f"workers: {workers},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threading: false,")
cog.outl("single-threaded: true,")
]]] */
threading: false,
single-threaded: true,
/// [[[end]]]
files: ["../include/PseudoRandom.h",
"../include/benchmark_runner.h",
Expand All @@ -85,7 +85,7 @@ preamble {=
=}


reactor Teller(numAccounts:int(1000), numBankings:int(50000)) {
reactor Teller(numAccounts:size_t=1000, numBankings:size_t=50000) {

preamble {=
long seed = 123456;
Expand Down Expand Up @@ -156,9 +156,9 @@ reactor Teller(numAccounts:int(1000), numBankings:int(50000)) {
=}
}

reactor Account(bank_index:size_t(0), numAccounts:size_t(1000), numTransactions:size_t(50000)) {
reactor Account(bank_index:size_t=0, numAccounts:size_t=1000, numTransactions:size_t=50000) {

state balance: double(0);
state balance: double=0;
input inCredit: credit_message_t;

input[numAccounts] inDebit: double;
Expand Down Expand Up @@ -191,9 +191,9 @@ reactor Account(bank_index:size_t(0), numAccounts:size_t(1000), numTransactions:
}

/* [[[cog
cog.outl(f'main reactor (numIterations:int({numIterations}), numTransactions:int({numTransactions}), numAccounts:int({numAccounts}))')
cog.outl(f'main reactor (numIterations:size_t={numIterations}, numTransactions:size_t={numTransactions}, numAccounts:size_t={numAccounts})')
]]] */
main reactor (numIterations:int(12), numTransactions:int(50000), numAccounts:int(1000))
main reactor (numIterations:size_t=12, numTransactions:size_t=50000, numAccounts:size_t=1000)
/// [[[end]]]
{
teller = new Teller(numAccounts=numAccounts, numBankings=numTransactions);
Expand Down
57 changes: 28 additions & 29 deletions C/Savina/src/concurrency/BoundedBuffer.lf
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,22 @@
* @author Matt Chorlian
*/

target C {
target C {
/* [[[cog
if (threading=="True"):
cog.outl("threading: true,")
cog.outl("single-threaded: false,")
cog.outl(f"workers: {workers},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threading: false,")
cog.outl("single-threaded: true,")
]]] */
threading: false,
single-threaded: true,
/// [[[end]]]
files: ["/lib/c/reactor-c/util/deque.h",
"/lib/c/reactor-c/util/deque.c",
"../include/benchmark_runner.h",
"../include/PseudoRandom.h"],
cmake-include: ["../include/deque.cmake"],
flags: "-lm",
cmake-include: ["../include/deque.cmake"],
logging: "warn",
fast: true
};
Expand All @@ -53,7 +52,7 @@ preamble {=
=}


reactor ManagerReactor(bufferSize: size_t(50), numProducers: size_t(40), numConsumers: size_t(40)) {
reactor ManagerReactor(bufferSize: size_t=50, numProducers: size_t=40, numConsumers: size_t=40) {

preamble {=
double processItem(double curTerm, size_t cost) {
Expand All @@ -79,11 +78,11 @@ reactor ManagerReactor(bufferSize: size_t(50), numProducers: size_t(40), numCons
input start: bool;
output finished: bool;

state adjustedBuffersize: size_t(0);
state adjustedBuffersize: size_t=0;
state pendingData: deque_t;
state numTerminatedProducers: size_t(0);
state numTerminatedProducers: size_t=0;
state producerTerminated: {=bool[]=};
state producer_id: size_t(0);
state producer_id: size_t=0;

input[numProducers] producerData: double;
input[numProducers] producerFinished: bool;
Expand Down Expand Up @@ -157,10 +156,10 @@ reactor ManagerReactor(bufferSize: size_t(50), numProducers: size_t(40), numCons

}

reactor ProducerReactor(bank_index: size_t(0), numItemsToProduce: size_t(1000), prodCost: size_t(25)) {
reactor ProducerReactor(bank_index: size_t=0, numItemsToProduce: size_t=1000, prodCost: size_t=25) {

state prodItem: double(0.0);
state itemsProduced: size_t(0);
state prodItem: double=0.0;
state itemsProduced: size_t=0;

input produce: bool;
output data: double
Expand All @@ -186,9 +185,9 @@ reactor ProducerReactor(bank_index: size_t(0), numItemsToProduce: size_t(1000),
=}
}

reactor ConsumerReactor(bank_index: size_t(0), consCost: size_t(25)) {
reactor ConsumerReactor(bank_index: size_t=0, consCost: size_t=25) {

state consItem: double(0.0);
state consItem: double=0.0;

input reset_state: bool;

Expand Down Expand Up @@ -216,22 +215,22 @@ reactor ConsumerReactor(bank_index: size_t(0), consCost: size_t(25)) {

/* [[[cog
cog.outl('main reactor (')
cog.outl(f' numIterations: size_t({numIterations}),')
cog.outl(f' bufferSize: size_t({bufferSize}),')
cog.outl(f' prodCost: size_t({prodCost}),')
cog.outl(f' consCost: size_t({consCost}),')
cog.outl(f' numItemsPerProducer: size_t({numItemsPerProducer}),')
cog.outl(f' numConsumers: size_t({numConsumers}),')
cog.outl(f' numProducers: size_t({numProducers})')
cog.outl(f' numIterations: size_t={numIterations},')
cog.outl(f' bufferSize: size_t={bufferSize},')
cog.outl(f' prodCost: size_t={prodCost},')
cog.outl(f' consCost: size_t={consCost},')
cog.outl(f' numItemsPerProducer: size_t={numItemsPerProducer},')
cog.outl(f' numConsumers: size_t={numConsumers},')
cog.outl(f' numProducers: size_t={numProducers}')
]]] */
main reactor (
numIterations: size_t(12),
bufferSize: size_t(50),
prodCost: size_t(25),
consCost: size_t(25),
numItemsPerProducer: size_t(1000),
numConsumers: size_t(40),
numProducers: size_t(40)
numIterations: size_t=12,
bufferSize: size_t=50,
prodCost: size_t=25,
consCost: size_t=25,
numItemsPerProducer: size_t=1000,
numConsumers: size_t=40,
numProducers: size_t=40
// [[[end]]]
) {

Expand Down
14 changes: 7 additions & 7 deletions C/Savina/src/concurrency/CigaretteSmoker.lf
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@
target C {
/* [[[cog
if (threading=="True"):
cog.outl("threading: true,")
cog.outl("single-threaded: false,")
cog.outl(f"workers: {workers},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threading: false,")
cog.outl("single-threaded: true,")
]]] */
threading: false,
single-threaded: true,
/// [[[end]]]
files: ["../include/PseudoRandom.h", "../include/benchmark_runner.h"],
fast: true
Expand All @@ -80,9 +80,9 @@ preamble {=
#include "PseudoRandom.h"
=}

reactor ArbiterReactor(numRounds:size_t(1000), numSmokers:size_t(200)) {
reactor ArbiterReactor(numRounds:size_t=1000, numSmokers:size_t=200) {

state roundsSoFar: size_t(0);
state roundsSoFar: size_t=0;
state random: PseudoRandom*;

input inStart:bool;
Expand Down Expand Up @@ -160,9 +160,9 @@ reactor SmokerReactor {


/* [[[cog
cog.outl(f'main reactor (numIterations:size_t({numIterations}), numRounds:size_t({numRounds}), numSmokers:size_t({numSmokers}))')
cog.outl(f'main reactor (numIterations:size_t={numIterations}, numRounds:size_t={numRounds}, numSmokers:size_t={numSmokers})')
]]] */
main reactor (numIterations:size_t(12), numRounds:size_t(1000), numSmokers:size_t(200))
main reactor (numIterations:size_t=12, numRounds:size_t=1000, numSmokers:size_t=200)
/// [[[end]]]

{
Expand Down
20 changes: 10 additions & 10 deletions C/Savina/src/concurrency/Dictionary.lf
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
target CCpp {
/* [[[cog
if (threading=="True"):
cog.outl("threading: true,")
cog.outl("single-threaded: false,")
cog.outl(f"workers: {workers},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threading: false,")
cog.outl("single-threaded: true,")
]]] */
threading: false,
single-threaded: true,
/// [[[end]]]
build-type : RelWithDebInfo,
logging: "warn",
Expand All @@ -60,9 +60,9 @@ preamble {=
};
=}

reactor Manager(numWorkers: size_t(20)) {
reactor Manager(numWorkers: size_t=20) {

state numWorkersTerminated: size_t(0);
state numWorkersTerminated: size_t=0;

input start: bool;
output finished: bool;
Expand Down Expand Up @@ -90,7 +90,7 @@ reactor Manager(numWorkers: size_t(20)) {
=}
}

reactor DictionaryImpl(numWorkers: size_t(20)) {
reactor DictionaryImpl(numWorkers: size_t=20) {


state dataMap: std::map<int,int>;
Expand Down Expand Up @@ -150,9 +150,9 @@ reactor DictionaryImpl(numWorkers: size_t(20)) {
=}
}

reactor Worker(bank_index: size_t(0), numMessagesPerWorker: size_t(10000), writePercentage: int(10)) {
reactor Worker(bank_index: size_t=0, numMessagesPerWorker: size_t=10000, writePercentage: size_t=10) {

state messageCount: size_t(0);
state messageCount: size_t=0;
state random: std::minstd_rand;

input doWork: bool;
Expand Down Expand Up @@ -191,9 +191,9 @@ reactor Worker(bank_index: size_t(0), numMessagesPerWorker: size_t(10000), write


/* [[[cog
cog.outl(f'main reactor (numIterations:size_t({numIterations}), numMessagesPerWorker: size_t({numMessagesPerWorker}), writePercentage: int({writePercentage}), numWorkers: size_t({numWorkers}))')
cog.outl(f'main reactor (numIterations:size_t={numIterations}, numMessagesPerWorker: size_t={numMessagesPerWorker}, writePercentage: size_t={writePercentage}, numWorkers: size_t={numWorkers})')
]]] */
main reactor (numIterations:size_t(12), numMessagesPerWorker: size_t(10000), writePercentage: int(10), numWorkers: size_t(20))
main reactor (numIterations:size_t=12, numMessagesPerWorker: size_t=10000, writePercentage: size_t=10, numWorkers: size_t=20)
// [[[end]]]
{

Expand Down
18 changes: 9 additions & 9 deletions C/Savina/src/concurrency/LogisticMap.lf
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
target C {
/* [[[cog
if (threading=="True"):
cog.outl("threading: true,")
cog.outl("single-threaded: false,")
cog.outl(f"workers: {workers},")
cog.outl(f"scheduler: {scheduler},")
else:
cog.outl("threading: false,")
cog.outl("single-threaded: true,")
]]] */
threading: false,
single-threaded: true,
/// [[[end]]]
fast: true
}

import BenchmarkRunner from "../BenchmarkRunner.lf";

reactor RateComputer(bank_index: size_t(0), startRate: double(3.46), rateIncrement: double(0.0025)) {
reactor RateComputer(bank_index: size_t=0, startRate: double=3.46, rateIncrement: double=0.0025) {

state rate: double;

Expand All @@ -42,7 +42,7 @@ reactor RateComputer(bank_index: size_t(0), startRate: double(3.46), rateIncreme
=}
}

reactor SeriesWorker(bank_index: size_t(0), termIncrement: double(0.0025), startRate: double(3.46), rateIncrement: double(0.0025)) {
reactor SeriesWorker(bank_index: size_t=0, termIncrement: double=0.0025, startRate: double=3.46, rateIncrement: double=0.0025) {

state curTerm: double;

Expand Down Expand Up @@ -72,9 +72,9 @@ reactor SeriesWorker(bank_index: size_t(0), termIncrement: double(0.0025), start
}


reactor Manager(numSeries: size_t(10), numTerms: size_t(25000)) {
reactor Manager(numSeries: size_t=10, numTerms: size_t=25000) {

state currentIteration: size_t(0);
state currentIteration: size_t=0;

input start: bool;
output finished: bool;
Expand Down Expand Up @@ -112,9 +112,9 @@ reactor Manager(numSeries: size_t(10), numTerms: size_t(25000)) {
}

/* [[[cog
cog.outl(f"main reactor (numIterations: size_t({numIterations}), numTerms: size_t({numTerms}), startRate: double({startRate}), numSeries: size_t({numSeries})) {{")
cog.outl(f"main reactor (numIterations: size_t={numIterations}, numTerms: size_t={numTerms}, startRate: double={startRate}, numSeries: size_t={numSeries}) {{")
]]] */
main reactor (numIterations: size_t(12), numTerms: size_t(25000), startRate: double(3.46), numSeries: size_t(10)) {
main reactor (numIterations: size_t=12, numTerms: size_t=25000, startRate: double=3.46, numSeries: size_t=10) {
/// [[[end]]]

manager = new Manager(numSeries=numSeries, numTerms=numTerms);
Expand Down
Loading

0 comments on commit 79413ee

Please sign in to comment.