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?
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.
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.
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.
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.
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.