Control over the number of working threads

40 views
Skip to first unread message

Samuel Croset

unread,
Oct 11, 2012, 11:59:38 AM10/11/12
to elk-reasone...@googlegroups.com
Hi group,

Could someone post a code snippet on how to configure the number of threads used by Elk?
I know it involves the 'ReasonerConfiguration' and 'NUM_OF_WORKING_THREADS' but I don't manage to put them together.

Thanks!

Samuel

Yevgeny Kazakov

unread,
Oct 11, 2012, 1:00:53 PM10/11/12
to elk-reasone...@googlegroups.com
Hi Samuel,

I think you need to do something like the following:

OWLOntologyManager man = OWLManager.createOWLOntologyManager();
// Create an ELK reasoner configuration
final ElkReasonerConfiguration elkConfig = new ElkReasonerConfiguration();
// Set the number of workers to 4 or any other number
elkConfig.getElkConfiguration().setParameter(ReasonerConfiguration.NUM_OF_WORKING_THREADS,
"4");
// Load your ontology.
OWLOntology ont = man.loadOntologyFromOntologyDocument(new
File("c:/ontologies/ontology.owl"));
// Create an ELK reasoner using the configuration
OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
OWLReasoner reasoner = reasonerFactory.createReasoner(ont, elkConfig);

Let me know if it works or not.

Be warned, however, that this method is not stable and may change in the future.
I think, you can also set the number of workers using a .properties
file. Pavel should know more how to do that exactly.

Yevgeny

Samuel Croset

unread,
Oct 12, 2012, 9:34:32 AM10/12/12
to elk-reasone...@googlegroups.com, yevgeny...@uni-ulm.de
Hi Yevgeny,

The code works, thanks!

I have similar performances (speedup) as described in the technical report (my setting is similar to the 'laptop' setting) when using the OWL version of the Gene Ontology (termdb).

Attached the results if anyone interested.

Cheers,

Samuel
perf-workers.png

Yevgeny Kazakov

unread,
Oct 12, 2012, 11:40:35 AM10/12/12
to Samuel Croset, elk-reasone...@googlegroups.com
Hi Samuel,

Great that the code works for you!
Regarding your chart, what is the difference between Brain and
ELK-OWL-API? I thought that Brain is just a wrapper of ELK through
OWL-API?

Yevgeny

On Fri, Oct 12, 2012 at 3:34 PM, Samuel Croset <samuel...@gmail.com> wrote:
> Hi Yevgeny,

Samuel Croset

unread,
Oct 12, 2012, 12:17:59 PM10/12/12
to elk-reasone...@googlegroups.com
Hi Yevgeny,

Yes, Brain is just a wrapper, but I wanted to be sure that there is no difference in performance between the Brain methods versus the normal way (was just check-up/test for me).

Samuel

Pavel Klinov

unread,
Oct 14, 2012, 11:23:24 AM10/14/12
to elk-reasone...@googlegroups.com
On Thu, Oct 11, 2012 at 7:00 PM, Yevgeny Kazakov
<yevgeny...@uni-ulm.de> wrote:
> Hi Samuel,
>
> I think, you can also set the number of workers using a .properties
> file. Pavel should know more how to do that exactly.

Yes, ELK supports static configuration.

If you use ELK as a library, then placing a property file named
"elk.properties" in the root of your classpath should do the job.
Here's the option:

elk.reasoner.number_of_workers=

See the example in elk-reasoner/src/main/resources/elk.properties
(with comments).

We'll probably provide a CLI option to point to the property file when
using ELK from the command line (i.e. akin to -Dlog4j.configuration
for log4j). The problem in 0.3.2 is that the jar file
(elk-standalone.jar) already contains a sample elk.properties file
which you need to override to load your configuration.

Hope this helps,

Pavel
Reply all
Reply to author
Forward
0 new messages