- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also is it possible for example JVM to use 2 cores on Quad core machine ?
Thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, Thanks. But i want other idle core to shut down/power off, Any idea ???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also is it possible for example JVM to use 2 cores on Quad core machine ?
Thanks.
What are you useing for a threading tool?
What operating system?
If OpenMP, you can seta restriction using environment variable
SET OMP_NUM_THREADS=10
Or at compile tile
export
OMP_NUM_THREADS=10
Or at run time
OMP_SET_NUM_THREADS()
Also, on Windows and Linux you can restrict the number of cores available to a process (applicaiton).
(you will have to look that one up)
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, Thanks. But i want other idle core to shut down/power off, Any idea ???
When thread idel it suspends.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What are you useing for a threading tool?
What operating system?
If OpenMP, you can seta restriction using environment variable
SET OMP_NUM_THREADS=10
Or at compile tile
export
OMP_NUM_THREADS=10
Or at run time
OMP_SET_NUM_THREADS()
Also, on Windows and Linux you can restrict the number of cores available to a process (applicaiton).
(you will have to look that one up)
Jim Dempsey
I want to do it for Operating system (Solaris/Linux/Windows etc) , to swtich off extra cores, so that my application typically sees less cores(Logical processors) to run its threads
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to do it for Operating system (Solaris/Linux/Windows etc) , to swtich off extra cores, so that my application typically sees less cores(Logical processors) to run its threads
The OMP_NUM_THREADS environment variable does this for OpenMP threaded programs. Other threading tools may use a different technique (i.e. read the documentation).
Most operating systems have the concept of Environment Variables (Windows/Solaris/Linux do). A process inherits the environment variables from which it is run. Typically a system has system wide environment variables and the user runs applications (processes) within a command shell (CMD on Windows) and this command shell starts with the environment variables of the environment in which it was spawned from, and subsequent to start, the command shell (copies of)environment variables can be added to, deleted, or changed.
On Windows, you can (stepse vary depending of version of Windows)perform:
Start | Control Pannel | System | Advanced | Environment Variables | User Variables | New
And in there add OMP_NUM_THREADS as variable name and 10 as value.
*** Then rember you did this *** when you next project doesn't use all 16 cores.
Alternately, you can create aBatch file (command script) toissue:
SET OMP_NUM_THREADS=10
YourProgramName.exe
Then create a shortcut to the batch file and launch your application that way. Now the limitation only applies to the application launched by way of the shortcut.
Linux has similar techniques.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The OMP_NUM_THREADS environment variable does this for OpenMP threaded programs. Other threading tools may use a different technique (i.e. read the documentation).
Most operating systems have the concept of Environment Variables (Windows/Solaris/Linux do). A process inherits the environment variables from which it is run. Typically a system has system wide environment variables and the user runs applications (processes) within a command shell (CMD on Windows) and this command shell starts with the environment variables of the environment in which it was spawned from, and subsequent to start, the command shell (copies of)environment variables can be added to, deleted, or changed.
On Windows, you can (stepse vary depending of version of Windows)perform:
Start | Control Pannel | System | Advanced | Environment Variables | User Variables | New
And in there add OMP_NUM_THREADS as variable name and 10 as value.
*** Then rember you did this *** when you next project doesn't use all 16 cores.
Alternately, you can create aBatch file (command script) toissue:
SET OMP_NUM_THREADS=10
YourProgramName.exe
Then create a shortcut to the batch file and launch your application that way. Now the limitation only applies to the application launched by way of the shortcut.
Linux has similar techniques.
Jim Dempsey
Thanks
But i want to use Java (JVM) not OpenMP to use less cores. Any idea please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks
But i want to use Java (JVM) not OpenMP to use less cores. Any idea please?
OpenMP is not an application. It is a threading model tool used to build applications.
IF (capitals to stress) your JVM is multi-threaded AND IF the multi-threaded code were compiled using OpenMP as threading tool THEN setting the OMP_NUM_THREADS=10 will fix the problem.
IF your JVM is NOT multi-threaded AND if you run a collection of JVMs AND if you want these collections of JVMs to run ONLY with a sub-set of cores THEN look at using process affinity to restrict each JVM to a subset of 10 cores on your system.
On Windows, run the TaskManager | Processes | Click on title tab "Image Name" to sort alphabetically | Right-click on 1st JVM and set the affinity mask to the cores you want. Repete for all JVMs.
OR
On Windows, in the header of the applicaiton, there exists two bit masks. These contain affinity masks (one is preferred the other is required). Some time spent with Google will get you the information you need to set this mask.
On Linux, from a command line, you can issue (our use option) that in effect says "for all processes spawned from this shell, restrict it to this xxxx affinity mask"
Windows may have a similar thing (google is your friend).
The problem you are having in getting the information you want, is you are not specifying your circumstances to the extent necessary to inform the viewers of this forum with the information they need to provide you with the answer you want.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe your JVM must have such command line parameter. Investigate the list of JVM's command line parameters.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OpenMP is not an application. It is a threading model tool used to build applications.
IF (capitals to stress) your JVM is multi-threaded AND IF the multi-threaded code were compiled using OpenMP as threading tool THEN setting the OMP_NUM_THREADS=10 will fix the problem.
IF your JVM is NOT multi-threaded AND if you run a collection of JVMs AND if you want these collections of JVMs to run ONLY with a sub-set of cores THEN look at using process affinity to restrict each JVM to a subset of 10 cores on your system.
On Windows, run the TaskManager | Processes | Click on title tab "Image Name" to sort alphabetically | Right-click on 1st JVM and set the affinity mask to the cores you want. Repete for all JVMs.
OR
On Windows, in the header of the applicaiton, there exists two bit masks. These contain affinity masks (one is preferred the other is required). Some time spent with Google will get you the information you need to set this mask.
On Linux, from a command line, you can issue (our use option) that in effect says "for all processes spawned from this shell, restrict it to this xxxx affinity mask"
Windows may have a similar thing (google is your friend).
The problem you are having in getting the information you want, is you are not specifying your circumstances to the extent necessary to inform the viewers of this forum with the information they need to provide you with the answer you want.
Jim Dempsey
Thanks dear, i got the answer in your last reply, Mow hopefully will be able to restrict core for JVM, Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also is it possible for example JVM to use 2 cores on Quad core machine ?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've recently uploaded a video showing how to change the number of cores using Windows Vista affinity settings. You can do the same for JVM and you will restrict the number of cores. However, you have to take into account L2 and L3 cache issues.
This is the link to my video http://www.youtube.com/watch?v=-Jfg3IHBNS0
It includes a book promotion. However, you can stop it before the promotion :)
Cheers,
Gastn Hillar
![](/skins/images/872293744008A34B36F8ABF94A46CC66/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page