0

I am using octave under debian. Everything is working ok.

I would like the octave-programs to finish faster. My "CPU usage monitor"-icon (LXDE) shows that, while octave is calculating, only about one third of my CPU is used.

Is there a way to configure the system to use more CPU for octave's calculations?

-- UPDATE --
Extra info: Looking at htop as my program run I have the following:

  1. the CPU has 4 cores and 7.71GiB RAM.
  2. from the beginning until before plotting, one core (apparently random selected) is used at 100% and the others at below 2%.
  3. after plotting begins, another core (apparently also random selected, sometimes the same) is used to 100% and the other ones kept below 2%.
  4. there is a little change in MEM usage (max difference ~0.1GiB).
  5. there is no change in swap.
  • What is your Octave script doing apart from the actual calculations? Is it reading or writing data from/to disk? Are you using so much memory in the calculation that it starts swapping? Are you doing any form of output while the script is running (text/graphics)? Are other processes using the rest of the CPU? Do you have multiple CPUs (i.e., what does "a third" mean)? A process will always get 100% of the CPU if it needs it and it's available, unless it needs to other things things, like disk or network I/O. – Kusalananda Sep 4 '19 at 9:17
  • it is a vers simple program: addition, substraction, multiplication, division, time measurement and plotting of planar curves. htop says... useful information. updating my quation now! – scjorge Sep 4 '19 at 9:23
  • From what you've written in your update, it looks as if it's already using 100% of one CPU. Octave is, as far as I know, not able to automatically parallelise operations across multiple CPUs. – Kusalananda Sep 4 '19 at 11:34
  • hmm... that's a shame! (: Why doesn't it use more than one core? does any process use more than one core? – scjorge Sep 4 '19 at 11:42
  • related question: unix.stackexchange.com/q/494566/150445 – scjorge Sep 4 '19 at 12:40
1

Short answer: no.
As mentioned in the comments...

Some extra info:

• Threads, Cores, and Sockets

To check the information on threads, cores, and threads of your system use lscpu.

The number of logical cores equals: “Thread(s) per core” × “Core(s) per socket” × “Socket(s)”. A socket is a physical CPU package (which occupies one socket on the motherboard); each socket hosts a number of physical cores, and each core can run one or more threads. 

A single thread can not be split between multiple cores.

• Using more than one core

A program needs to be written to have more than one thread, or there needs to be more than one program. If not then you won't use the other cores. But writing programs to use more cores is not trivial, and Octave doesn't belong to this kind. Also, not all problems can be parallelised (written to run on more than one core) and the communication between threads (overheads) is also to be considered to know if you would gain speed.

References:
How to assign one process on two CPUs Understanding output of lscpu

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.