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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Multithreading questions

mzeftel
1-Newbie

Multithreading questions

We are looking into the multithreading feature in Mathcad Prime 2.0 and are wondering how people are using it?

One question we have is if you ever had need to calculate sequentially rather than by using multithreading (more than one calculation can run in parallel.).

Can you supply any examples showing where running the calculations sequentially is desirable?

Thanks,

Mona

18 REPLIES 18
RichardJ
19-Tanzanite
(To:mzeftel)

Can you supply any examples showing where running the calculations sequentially is desirable?

Well, if one calculation depends on the result of another calculation then clearly they have to be run sequentially. If the two calculations are independent of each other I can't imagine why there would be any benefit to running them sequentially rather then in parallel, but I am no expert on parallel programming.

I agree with Richard's comment in general. The only other situation I can think of where one might be wary of running in parallel is if one is using the inbuilt timer to time the calculations. Unless one could ensure the final call to the time function was indeed the final call, the apparent times could be very misleading.

Alan

RichardJ
19-Tanzanite
(To:AlanStevens)

When multithreaded do the calculations have access to the same memory space, or are the two memory spaces independent? If they only have access to the same memory space then it's conceivable that each calculation might require so much memory that only one can be run at one time.

Richard,


I think it depends on the computer, but this is not my area of expertise.

Mona

MikeArmstrong
5-Regular Member
(To:mzeftel)

I can honestly say I have never needed or believe I'll need a multithreading feature.

Mike

I can honestly say I have never needed or believe I'll need a multithreading feature.

You don't have any worksheets that you would like to run faster?

MikeArmstrong
5-Regular Member
(To:RichardJ)

I can't honestly say I have. I do have a few cofferdam worksheets which have a few Integrations and solve blocks which could work a little quicker I suppose, but don't bother me too much.

Mike

I have some worksheets that take several hours to calculate

MikeArmstrong
5-Regular Member
(To:RichardJ)

Well I suppose you could find a use for it then, but as you said above it would depend on memory allocation.

Mike

BertBeirinckx
4-Participant
(To:mzeftel)

Mona, could you give an example of calculations that have benefits while using hyperthreading? I'm no expert on this but if I understood correctly Mathcad always has worked sequentially before Prime. I'm unsure on how Mathcad Prime uses hyperthreading, so if an example could be made available it would make a few things clearer (at least for me).

As a very simple example, suppose you have three calculations. Calculations one and two are independent of each other, but calculation three depends on the results of both one and two. Currently, you run one, then two (or two, then one), then three. With multithreading you run one and two in parallel, then you run three.

Thanks Richard, so far I understood hyperthreading, the question however is how Mathcad Prime is built to make use of the hyperthreading capabilities of the hardware we are using.

As far as I know, Mathcad works through its worksheet from left to right and from top to bottom. I also tend to split up my applications into GUI-sheets and the formulae which are located in worksheets that are referenced.

In these formulae I use a lot of functions and not many intermediate results, that has its consequences in terms of memory management. So I would guess that before calculating, Mathcad Prime screens and breaks down the statements in the worksheet and divides the work over different threads. The thing is whether the old way of working - which is quite straightforward in my humble opinion - still is better in terms of calculation speed or not. All functions reside in RAM, so when I call a function in the GUI worksheet, Mathcad then should recalculate the result over different threads, right?

I'm not sure whether Mathcad Prime indeed does a screening or not. Therefore I would like to know what PTC envisioned while developing Prime to use hyperthreading and how I can write worksheets that make maximum use of this hyperthreading in order to maximize performance. Does the user have such an influence?? Again, I'm just guessing here.

In other words, what does Mathcad do with hyperthreading and how can we influence/measure that in terms of performance?

Sorry. I can't answer any of those questions

Actually, I was hoping for an answer coming from PTC.

BTW: I do mean multithreading, not hyperthreading in particular...

I think my penny is starting to drop.

With multithreading I presume it becomes possible to work on one worksheet while another (or even several) worksheet(s) is (are) calculating. I have some large calculation sheets which do take a lot of time while processing, so having this possibility is a good idea in my perspective.

Is this what is being meant by multithreading? Or is it also possible to use multithreading within one worksheet?

I hope it will be possible to use it even in one worksheet. Your point about calculation order in a worksheet is a good one, but for a series of calculations that are inside a program it should be possible (in theory, anyway) for Mathcad to do some optimization. Also, suppose I have a calculation that loops through the columns of a matrix. Again, in theory, it would be possible to split the calculations across multiple processors.

I'm going to answer this thread in the general Mathcad usage, so that more people can participate. Multithreading works both in one worksheet and across multiple worksheets.

Mona

Top Tags