-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restructuring of mechanism for compiling federated programs #1221
Conversation
c1fa046
to
b15c141
Compare
Grr, GitHub does not allow for the source branch of a PR to be changed, so I will have to move the title and comments used here to #1227. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking care of the TS generator!
I left a couple of comments to understand this change better.
Also, I have one more question:
I tried to Lfc-compile test/TypeScript/src/federated/HelloDistributed.lf, but I got an error like this:
******** Using 2 threads to compile the program.
lfc: error: Mixed triggers and effects from different federates. This is not permitted
--> test/TypeScript/src/federated/HelloDistributed.lf:44:5
|
43 | federated reactor HelloDistributed at localhost {
| >>>>>>>>>>>>>>
44 | reaction(startup) {=
45 | console.log("Printing something in top-level federated reactor.");
46 | =}
| <<<<<< Mixed triggers and effects from different federates. This is not permitted
47 | s = new Source(); // Reactor s is in federate Source
lfc: fatal error: Aborting due to previous error
FAILURE: Build failed with an exception.
It doesn't look related to the fed-gen changes. Are we supposed to get such errors?
org.lflang/src/org/lflang/generator/ts/TSConstructorGenerator.kt
Outdated
Show resolved
Hide resolved
You are using zero-delay logical connections between federates. This currently does not work because the causality interface ( |
I'm a bit stuck at the moment in my attempt to remove Specifically, there are multiple places in the CGenerator where running counts (that are class attributes) get incremented by Here are some examples where this pattern is used: 1 2 3 4 5 6 7. |
These counts are used to determine the sizes of statically allocated arrays, for example, the array of startup reactions that need to be invoked at startup. The issue here is that one instance of I presume that the latter subtlety will go away if you are code generating a |
Right. At least that's what I'm aiming for.
Thank you! I applied your solution in c75d02a. Luckily, there is already a version of |
org.lflang/src/org/lflang/federated/extensions/FedTargetExtension.java
Outdated
Show resolved
Hide resolved
org.lflang/src/org/lflang/federated/extensions/FedTargetExtension.java
Outdated
Show resolved
Hide resolved
org.lflang/src/org/lflang/federated/extensions/FedTargetExtension.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take another look at FIXMEs assigned to me early this week!
org.lflang/src/org/lflang/federated/generator/FedPreambleEmitter.java
Outdated
Show resolved
Hide resolved
org.lflang/src/org/lflang/generator/python/PythonGenerator.java
Outdated
Show resolved
Hide resolved
org.lflang/src/org/lflang/generator/ts/TSConstructorGenerator.kt
Outdated
Show resolved
Hide resolved
Fix docker tests in fed-gen
I just noticed that there are some more weird issues with the Docker support. It seems that docker files are now generated for all federated programs, no matter if they have docker support enabled or not. Also, even containerized federated programs produce a then useless launch script. |
This reverts commit 3f4f156.
Error code |
I notice that if I run the same federated containerized test in rapid succession, then after a few tries I inevitably run into this:
This log suggests to me that the problem is in the RTI, not with the federates. This brings me to another question: which version of the RTI is being used here? The RTI doesn't have any version numbers, so I guess nobody can answer this question, but where does the image come from? The |
OK, it looks like the docker image was published by @housengw: https://hub.docker.com/u/housengw, ten months ago. |
I put in quite a bit of effort to purge warnings, but never got to the RTI or federated code. Help would be welcome. In lf_tag_64_32.h it says:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has gotten to a point where I think it is ready to merge, modulo whatever errors might still come up in CI.
…and in TestBase because it is not effective
Changes to accommodate lf-lang/lingua-franca#1221
Edit. Refactor logic related to federated execution out of GeneratorBase, CGenerator, PythonGenerator, and TSGenerator into a new
org.lflang.federated.FedGenerator
.analyzeFederates()
out of GeneratorBase into FedGenerator (@Soroosh129)- Note: For the TS target, the code for these interfaces is already in the TSGenerator (e.g., here)
init
(suggested by @cmnrd)) for each target to take care of pre-start tag initializations:if (isFederated)
checks. Implementing the executable preamble would mostly require moving these blocks to the federated generator.Output interface instead of using theAdd internal dependency information to reactions@interface
label (@lhstrh)--clean
flag, which does not work for federated programs because they are located in a separatefed-gen
directory (@axmmisaka)bin
directory already exists:LetInferenceTests