Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MATLAB number of operations

Status
Not open for further replies.

grit_fire

Member level 5
Member level 5
Joined
Mar 13, 2011
Messages
82
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
USA
Activity points
1,966
Hi, all

Not sure if I am posting at the right place. Anyway here my question is:

I am trying to count the number of operations in a MATLAB program. Say it has 5 additions and 5 multiplications. Of course the time/hardware resource consumed by multiplication won't be the same with addition. Does anyone know how o convert number of multiplication to equivalent number of addition?

Thanks a lot!
 

Maybe you must evaliate it, not deterministically, but empirically .
Take a look on that function, wich coud help in this task :

Elapsed CPU time - MATLAB

+++

Thanks a lot!

Will that imply the connection with energy consumption? i.e. 1.5 times faster = 1.5 times less energy consumed for this operation?
 

The reason of that research is not clear to me.
Do you mean to energy, "CPU processing" in microinstructions time ?

If so, the answer could be yes ( with some restrictions ), due MPLAB is not a full-compiled language, but a language wich interprets comands.
But, performing a test with a big amount of operations, I believe that result is very close to time consummed by each operation.

+++
 
I am trying to count the number of operations in a MATLAB program. Say it has 5 additions and 5 multiplications. Of course the time/hardware resource consumed by multiplication won't be the same with addition. Does anyone know how o convert number of multiplication to equivalent number of addition?

Unlike a RISC processor, the CISC processor in your desktop running MATLAB lacks a direct correlation between a multiply and an equivalent number of addition operations. The time or the number of cycles for your desktop system's processor to care out a multiply operation depends largely on the type of multiplication.

Are the operands integer or floating point for instance?

Also, as Andre pointed out, you have the additional complexity of MATLAB not being a full-compiled language.
You may have to do as Andre suggested and time your actual MATLAB routines and base your calculations on these findings.

Ciao
 
Thank you very much!

The purpose is to basically evaluate the power efficiency of two algorithms by counting the total number of operations. I hence need to relate multiplication/division and addition/subtraction and then obtain one number to represent the number of operations for each algorithm, not to obtain numbers of multiplications and numbers of additions separately.

The reason of that research is not clear to me.
Do you mean to energy, "CPU processing" in microinstructions time ?

If so, the answer could be yes ( with some restrictions ), due MPLAB is not a full-compiled language, but a language wich interprets comands.
But, performing a test with a big amount of operations, I believe that result is very close to time consummed by each operation.

+++


---------- Post added at 16:15 ---------- Previous post was at 16:13 ----------

Unlike a RISC processor, the CISC processor in your desktop running MATLAB lacks a direct correlation between a multiply and an equivalent number of addition operations. The time or the number of cycles for your desktop system's processor to care out a multiply operation depends largely on the type of multiplication.

Are the operands integer or floating point for instance?

Also, as Andre pointed out, you have the additional complexity of MATLAB not being a full-compiled language.
You may have to do as Andre suggested and time your actual MATLAB routines and base your calculations on these findings.

Ciao

Thanks very much. I am aware of the complication involved. I was wondering if there is a conventional way to connect multiplication/division to addition. It seems that the only estimation is to compare the time elapsed on multiplication and addition.
 

I found another link discussing the use of the MATLAB Profiler:

**broken link removed**

**broken link removed**

The use of the Profiler should be able to give you clear indications of the usage of CPU resources required by various routines in your program.

I'm hope the info helps you in your endeavors.
 
I found another link discussing the use of the MATLAB Profiler:

**broken link removed**

**broken link removed**

The use of the Profiler should be able to give you clear indications of the usage of CPU resources required by various routines in your program.

I'm hope the info helps you in your endeavors.

Appreciate your help!

The Profiler seems to give me the percentages of CPU usage of different statements within the same program. I don't think that can be used to compare two programs.
 

In order to evaluate performance of each command, you should take this account at same program.
Take in mind that, once MATLAB runs at a multithread operational system, this segregation will affect analysis and probably will give not faithful result.

+++
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top