Skip to main content



      Home
Home » Modeling » Epsilon » EGX Parallel Execution(Is there a way to execute multiple different EGX rules in parallel?)
EGX Parallel Execution [message #1855923] Wed, 09 November 2022 19:39 Go to next message
Eclipse UserFriend
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: Wed, 09 November 2022 19:39] by Moderator

Re: EGX Parallel Execution [message #1855949 is a reply to message #1855923] Thu, 10 November 2022 17:45 Go to previous messageGo to next message
Eclipse UserFriend
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 17:45] by Moderator

Re: EGX Parallel Execution [message #1855954 is a reply to message #1855949] Fri, 11 November 2022 04:35 Go to previous message
Eclipse UserFriend
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: Thu Jul 17 14:37:25 EDT 2025

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

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

Back to the top