[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CPU time, Octave vs MATLAB
From: |
Kai Torben Ohlhus |
Subject: |
Re: CPU time, Octave vs MATLAB |
Date: |
Tue, 10 Mar 2020 23:08:44 +0900 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 3/10/20 9:39 PM, Rory Conolly wrote:
> I have a program that describes biological mechanisms of cancer. Running
> the code in MATLAB takes 112 minutes. The almost identical code in
> Octave takes about 10 hr, so about 5 times slower. Is this an expected
> difference between Octave and MATLAB or more likely due to something in
> my code? Code is hundreds of lines over several files.
>
> - Rory
>
Dear Rory,
Unless you present (a meaningful portion of) your code, it is fortune
telling and blind guessing what could be wrong. Most likely your code
is not properly vectorized [1] and uses lots of nested loops, e.g.
for k = 1:P
for i = 1:M
for j = 1:N
A(i,j) = A(i,j) + B(i,j);
endfor
endfor
endfor
You can make use of profiling [2] to find the bottlenecks.
HTH,
Kai
[1] https://octave.org/doc/v5.2.0/Basic-Vectorization.html
[2] https://octave.org/doc/v5.2.0/Profiling.html
- CPU time, Octave vs MATLAB, Rory Conolly, 2020/03/10
- Re: CPU time, Octave vs MATLAB,
Kai Torben Ohlhus <=
- Re: CPU time, Octave vs MATLAB, Rory Conolly, 2020/03/10
- Re: CPU time, Octave vs MATLAB, Ian McCallion, 2020/03/10
- Re: CPU time, Octave vs MATLAB, Ardid, Salva, 2020/03/10
- RE: CPU time, Octave vs MATLAB, Henk Borsje, 2020/03/10
- Re: CPU time, Octave vs MATLAB, Kai Torben Ohlhus, 2020/03/10
- Re: CPU time, Octave vs MATLAB, Nicholas Jankowski, 2020/03/10