JPPF, java, parallel computing, distributed computing, grid computing, parallel, distributed, cluster, grid, cloud, open source, android, .net
JPPF

The open source
grid computing
solution

 Home   About   Features   Download   Documentation   On Github   Forums 
June 03, 2023, 04:42:30 PM *
Welcome,
Please login or register.

Login with username, password and session length
Advanced search  
News: New users, please read this message. Thank you!
  Home Help Search Login Register  
Pages: [1]   Go Down

Author Topic: Multiple Tasks per Job, coordinating Thread Usage  (Read 2224 times)

neep

  • JPPF Padawan
  • *
  • Posts: 6
Multiple Tasks per Job, coordinating Thread Usage
« on: July 24, 2014, 06:31:13 PM »

Hi,

i already read that multiple Jobs cannot be processed on one single Node. (http://www.jppf.org/forums/index.php/topic,1961.0.html)
But let's say i have a Job with 2 different Tasks in it.
Normally, the Load Balancer would care about how these Tasks are distributed to all Nodes, right?
Let's say i set an Execution Policy to use only one Node.

Is it possible to control which task is processed on which core or how much cores each task can use?
So let's say i want TaskA to be processed by 2 Threads and TaskB to be processed by 3 Threads on the Node.

Sincerely,
Oliver


Logged

lolo

  • Administrator
  • JPPF Council Member
  • *****
  • Posts: 2272
    • JPPF Web site
Re: Multiple Tasks per Job, coordinating Thread Usage
« Reply #1 on: July 24, 2014, 07:03:06 PM »

Hello Oliver,

Quote
Is it possible to control which task is processed on which core or how much cores each task can use?

If you are really talking about cores, then it's not even possible in a JVM. The JVM knows about threads, but not about cores. It only knows the number of available cores because it asks nicely to the OS, but it it is not able to associate threads to cores.

The threading model for a JPPF node is that each task runs in a single processing thread, and there is no control over which thread or how many. This being said, nothing prevents a task from creating its own threads (or executor service) if needed, but it's up to you to implement that in the code of the task.

Quote
Normally, the Load Balancer would care about how these Tasks are distributed to all Nodes, right?
That is correct. The load-balancer distrbutes the tasks in a job according to the configured algortihm and parameters, to the nodes eligble for the job SLA.

I hope this clarifies,
-Laurent
Logged

neep

  • JPPF Padawan
  • *
  • Posts: 6
Re: Multiple Tasks per Job, coordinating Thread Usage
« Reply #2 on: July 25, 2014, 03:17:22 PM »

Thanks Laurent i understand.

I have one more question about execution policies:
When i have 2 Nodes running on one machine (the second as slave using provisioning), how can i set the execution policy to use only one Node (e.g. the first one)?
i tried
Quote
ExecutionPolicy policy = new Contains("ipv4.addresses", false, "xxx.xxx.xxx.xxx").and(new Contains("jppf.node.management.port", false, "12001"));


This still runs the Job on both Nodes of the machine. When i click "Show Information" in the Monitoring Tool, both Nodes have the same management port in their configuration, i guess thats the problem.
But in the Topology Tree View the second Node shows up like: xxx.xxx.xxx.xxx:12002.
Is there maybe another property available to define the port in the policy?

Starting the second Node instance manually on the machine and setting the management.port to 12002 works, but using node provisioning and still being able to access both nodes on different ports would be more comfortable.

Sincerely,
Oliver

« Last Edit: July 25, 2014, 03:35:40 PM by neep »
Logged

lolo

  • Administrator
  • JPPF Council Member
  • *****
  • Posts: 2272
    • JPPF Web site
Re: Multiple Tasks per Job, coordinating Thread Usage
« Reply #3 on: July 27, 2014, 07:24:01 PM »

Hi Oliver,

I see your problem here. Indeed, I never gave this use case much thought. There is one distinctive property that you should be able to use in an execution policy: the set of available properties for a node includes all the system properties, and in particular the property "user.dir", which is different for each master node and for each slave. For instance, with the default node distribution, you would have:
  • for a master node: user.dir = /path/to/JPPF-4.2-node
  • for the first slave node: user.dir = /path/to/JPPF-4.2-node/slave_nodes/node_0
  • for the second slave node: user.dir = /path/to/JPPF-4.2-node/slave_nodes/node_1
  • etc ...
You can also distinguish between master and slaves using the properties "jppf.node.provisioning.master" and "jppf.node.provisioning.slave".

So, for instance, an execution policy to execute only on the master node:
Code: [Select]
ExecutionPolicy policy = new Contains("ipv4.addresses", false, "xxx.xxx.xxx.xxx").and(new Equal("jppf.node.provisioning.master", true));
to execute only on the slave node n with n >= 0:
Code: [Select]
int slaveNumber = 0;
ExecutionPolicy policy = new Contains("ipv4.addresses", false, "xxx.xxx.xxx.xxx").and(new Contains("user.dir", true, "/slave_nodes/node_" + slaveNumber));

Sincerely,
-Laurent
Logged

neep

  • JPPF Padawan
  • *
  • Posts: 6
Re: Multiple Tasks per Job, coordinating Thread Usage
« Reply #4 on: July 28, 2014, 02:13:43 PM »

Thanks Laurent, thats a really good solution.
I really appreciate your help!

Sincerely,
Oliver
Logged
Pages: [1]   Go Up
 
JPPF Powered by SMF 2.0 RC5 | SMF © 2006–2011, Simple Machines LLC Get JPPF at SourceForge.net. Fast, secure and Free Open Source software downloads