Just quickly - IMO this isn't really a Pascal Q so much as a program design Q (assuming there are no bizzare issues in threading with GPC!). You'll want your threads to have little data exchange or dependence on one another, or they'll either bottleneck over the data bus (MP programs can be come data bus bound rather than CPU bound, in principle at least; some folks claim this is an issue on the dual G5's) or end up waiting on completion of another thread (blocked) in order to proceed. Its possible what you describe is blocking a big way. You'll have to think about how your code is designed to understand its behaviour and to make good use of both CPUs. Just sticking in threads won't automatically give you a say a 1.5X speed gain.
Since you're doing array work, I presume you've looked into making the code use the vector processor instructions on the G4/G5? That could you give you bigger gains than the threading. If you're not already on it, look on the scitech mailing list at Apple for further ideas/discussions. Look out for Ian Ollman's posts in particular.
Have fun,
Grant
At 9:16 PM +0200 29/3/04, Boris Herman wrote:
Hi list,
I have compiled a single-threaded (and quite non MP aware) pascal program that does a lot of numerical computations. One calculation takes about 5 days on my 1.25 GHz DDR G4 (single cpu) and I need about 200 computations to do. Well, when I run the program on my G4 it takes up all CPU time (cca 93%-95%). I thought of speeding the whole thing by running it on a dual processor machine so I got someone to run it on a dual 2 GHz G5. So here comes the problem. If only one instance is run on a dual G5 the Activity monitor shows 50% CPU load (which is understandable) but the graph alternates between 100% load on 1st CPU and 100% load on 2nd CPU. I thought that is an anomaly of Activity Monitor. However, when two instances are run, the time required to execute each task doubles even though the Activity monitor shows both cpus at 100% load.
My program doesn't really do anything much - it performs gazillions of computations in arrays that all together consume less than 20 Mb of memory.
Am I doing anything wrong or shouldn't I expect better performance on a dual cpu unit?
Highest regards, Boris