Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » EGX Parallel Execution(Is there a way to execute multiple different EGX rules in parallel?)
EGX Parallel Execution [message #1855923] Thu, 10 November 2022 00:39 Go to next message
Sam Harris is currently offline Sam HarrisFriend
Messages: 2
Registered: September 2022
Junior Member
I have an EGX module that has 958 rules. 74 of the rules use the transform parameter to execute over multiple model elements and the remaining 884 rules just execute once each. I am using the EGL Ant task to run this module. I have added the @parallel annotation to all of the rules, however, it appears to only be executing the same rule on different elements in parallel but each rule is still run sequentially. Due to the large number of single use rules, the total module execution is quite slow. Is there any way to parallelise the execution of the single use rules so that multiple rules are run at the same time (hopefully speeding up the total execution time)?

[Updated on: Thu, 10 November 2022 00:39]

Report message to a moderator

Re: EGX Parallel Execution [message #1855949 is a reply to message #1855923] Thu, 10 November 2022 22:45 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Sam,

When I run the following example:

parallel.egx
---
@parallel
rule R1 {
	template: "template.egl"
	parameters : Map{"message" = "R1"}
}

@parallel
rule R2 {
	template: "template.egl"
	parameters : Map{"message" = "R2"}
}

@parallel
rule R3
	transform v : String in: Sequence{"A", "B"} {
	
	template: "template.egl"
	parameters : Map{"message" = "R3" + v}
}


template.egl
---
[%
("Starting " + message).println();
var thread = Native("java.lang.Thread").sleep(1000);
("Finished " + message).println();
%]


build.xml
---
<project default="main"> 
	<target name="main">
		<epsilon.egl src="parallel.egx" />
	</target>
</project>


it produces the following output which suggests that all rules run in parallel.

Starting R3A
Starting R1
Starting R3B
Starting R2
(brief pause)
Finished R3B
Finished R2
Finished R3A
Finished R1


Are you experiencing a different behaviour?

Thanks,
Dimitris

[Updated on: Thu, 10 November 2022 22:45]

Report message to a moderator

Re: EGX Parallel Execution [message #1855954 is a reply to message #1855949] Fri, 11 November 2022 09:35 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi again,

My bad. To make these rules run in parallel too, you'll need to use the EgxModuleParallelGenerationRuleAtoms execution engine as follows.

<project default="main"> 
	<target name="main">
		<epsilon.egl src="parallel.egx" moduleimplementation="org.eclipse.epsilon.egl.concurrent.EgxModuleParallelGenerationRuleAtoms"/>
	</target>
</project>


If you use this engine, you don't need to include @parallel annotations as all rule instances will be run in parallel by default.

Thanks,
Dimitris
Previous Topic:Iteration over columns in Excel
Next Topic:Unregistering or locally registering a metamodel
Goto Forum:
  


Current Time: Sat Apr 27 08:09:03 GMT 2024

Powered by FUDForum. Page generated in 0.03492 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top