cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Performance

Efried
1-Newbie

Performance

Hello,

I'm seeking your advice for boosting performance of my Mathcad programms. My questions are

  1. does it make sense to use dual or quad core processors with Windows 7 and mathcad 14?
  2. are there optimizing possibilities resulting from benchmarking exercises with regards to the use of indices, calling other functions or programms, vectors, conditional branches etc.
  3. What kind of blocks might be optimized by Mathcad automatically, some refuse.

I would guess that it makes sense to assign values to simple variable when handing them over to other programms.

many thanks in advance

Gerfried

9 REPLIES 9
Efried
1-Newbie
(To:Efried)

Additionally the question arises what modern "eight" core architectures might contribute. I have learned recently that AMD only uses four FPUs. May be the FPUs will be replaced entirely by GPUs. So far Intels i7 might be the better choice to boost the Mathcad calculation performance?

BTW: The absence of answers underly my fear that Mathcad is mostly used for small calculation sheets and larger projects are done using compilers or Matlab/SciLab!

RichardJ
19-Tanzanite
(To:Efried)

Multiple processors will not help.

The question wasn't answered (at least, on my part) because it's too general. Of course there are things that will make Mathcad code run faster, but there is no single place where that information exists. I don't feel much of an inclination to write a long essay (or short book?) on the subject. Vectorization was discussed here: http://communities.ptc.com/message/154931#154931 We have also discussed memory allocation in Mathcad at some length, although I can't find the thread(s). And, of course, avoid deeply nested loops, numeric derivatives, numeric integrals, solve blocks, etc. Don't evaluate numeric integrals multiple times for different limits (use odesolve instead). What's going to help the most depends a lot on the problem though.

Mathcad Prime 2.0, when it releases, has support for multiprocessing (the default is off, so you need to turn it on) and will have two versions, 32-bit and 64-bit.

Mona

Hello Richard,

many thanks for the hints. Structuring the Programm helps to save time but if the calling procedure consumes a lot of time this would be not helpful.

From software coding with compilers those were the actions to take:

- avoid calls to subroutines and handing over of structures (use pointers)

- avoid trigonometric functions, uses numeric approaches

- stay with integers, avoid floating point operations

- use static variables, if they don't change

As for trigonometric functions and integer are there examples how to implement in Mathcad best?

Some problems might be evaluated symbolically making them exlicit. Try reducing the number of variables. So for example it is not a good idea to calculate properties in solve blocks I learend, just iterate a few times. Also TOL may be reduced when solve blocks can't be avoided.

Further hints regarding use of using variables with indices in programms efficiently would be great though, Does it help to assign them to a simple variable, when using them multiple times (of course on the right side of the assignement)?

thanks

RichardJ
19-Tanzanite
(To:Efried)

- avoid calls to subroutines and handing over of structures (use pointers)

Good advice for C, but there are no pointers in Mathcad

- avoid trigonometric functions, uses numeric approaches

With a modern floating point processor I'm not sure i agree with that one.

- stay with integers, avoid floating point operations

In Mathcad everything is stored as a floating point number, and all operations are floating point. The good news is that because of the floating point processor the speed advantages of integer variables are now very minor or non-existent. There is an old thread where this is discussed, but I can't find it (I can never find old threads now; the search on these forums sucks).

- use static variables, if they don't change

This really does not apply to Mathcad. Variables in Mathcad are not variables in the sense of a conventional programming language. They are named constants, and every new assignment to an existing "variable" creates a new copy of that named constant.

Some problems might be evaluated symbolically making them exlicit.

Yes, that can help. Especially, if integrals, derivatives, or solves can be solved symbolically, and then the solution used for further numerical calculations, this can speed things up a lot.

Also TOL may be reduced when solve blocks can't be avoided.

Yes, but then you have a less accurate answer Something else that will speed up solve blocks is to get the guesses as close as possible to the solution. This can really cut down the number of iterations.

Does it help to assign them to a simple variable, when using them multiple times (of course on the right side of the assignement)?

I don't know what you mean by a "simple variable".

Richard Jackson schrieb:

- avoid calls to subroutines and handing over of structures (use pointers)

Good advice for C, but there are no pointers in Mathcad

Does it help to assign them to a simple variable, when using them multiple times (of course on the right side of the assignement)?

I don't know what you mean by a "simple variable".

It would be nice to see the price of having calls to other programms or functions in programms.

Simple variables are local non indexed variables in programms. a_=a[i]; b=f(a_)

thanks

RichardJ
19-Tanzanite
(To:Efried)

Simple variables are local non indexed variables in programms. a_=a[i]; b=f(a_)

thanks

Maybe if you use a_ a large number of times that would be faster, You would have to write a test program to really find out though.

Efried
1-Newbie
(To:Efried)

Hello Mona,

you certainly have heard of GPGPU, which helps to boost the FLOPS much easier than relying on CPU-internal FPUs by using GPUs. So may be it is useful to think about introducing an single precision option and ability to use GPUs?

Efried
1-Newbie
(To:Efried)

ok, after some research I give up waiting for wonders - may be some i5 670 or i7 2600 CPU would be sufficient for the moment. Do you have some experience regarding calculation power- there are so many CPU versions on the market. What CPUs is best supported by Mathcad and affordable (<200 USD)?

thanks a lot

Top Tags