The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How Many Computers Do You Have At Home? Neo What's on Your Mind? 64 2 Weeks Ago 09:37 AM
Pop up dialog box on remote computers deaconf19 Shell Programming and Scripting 34 11-09-2007 01:16 AM
Script to get IP addresses of LAN computers sladuuch Shell Programming and Scripting 1 10-04-2005 12:10 PM
two computers one internet dragos IP Networking 8 07-25-2005 07:56 AM
two computers - one modem Pennywize UNIX for Dummies Questions & Answers 3 11-27-2002 01:37 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-19-2007
Registered User
 

Join Date: Nov 2006
Posts: 8
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Using other computers for processing

Hello

I've wrote a C++ program which does some mathematical calculations, but the problem is that it takes way too long on any computer to finish.

Is there anyway to make more than 1 computer do the processing so it can process faster?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-19-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Yes.

Option a. Run it on a faster computer.

After that the options get a bit harder....

Can you split the problem up so that different computers can solve different parts of the problem independently?

Can you split it up so that parts can be done in parallel?

Have you got a really crap algorithm that may be mathmatically correct but is really inefficient?

Can you solve the problem at different resolutions/accuracies so you apply varying amounts of horse power to different parts of the problem?

If you are curious, one of the recent proofs of minimum moves to solve the rubik's cube used the last of the options....
Reply With Quote
  #3 (permalink)  
Old 12-22-2007
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 916
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Quote:
Originally Posted by porter View Post
Y
Have you got a really crap algorithm that may be mathmatically correct but is really inefficient?
It won't hurt to check that with the "bible of programming", old and new testament, so to say ;-)) :

- Donald Knuth, The Art of Computer Programming
Depending on your problem there is Vol.1 (Numerical Algorithms), Vol.2 (Seminumerical Algorithms) and Vol.3 (Sorting and Searching)

- Robert Sedgewick, Algorithms in C
Covering only C but for purely mathematical problems this should be the same more or less.

Here is another way: switch to a language more suited for achieving calculation power than C - use FORTRAN! I don't think that the mathlib of FORTRAN 77 has ever been beaten for speed.

bakunin
Reply With Quote
  #4 (permalink)  
Old 12-23-2007
Registered User
 

Join Date: Dec 2007
Location: Virginia, USA.
Posts: 202
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Does this help?
Frequently Asked Questions
Reply With Quote
  #5 (permalink)  
Old 12-23-2007
drl's Avatar
drl drl is offline
Registered User
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 430
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Hi.

My favorite quote in this area is:
Quote:
... premature optimization is the root of all evil." (Knuth, Donald. Structured Programming with go to Statements, ACM Journal Computing Surveys, Vol 6, No. 4, Dec. 1974. p.268.)
-- wikipedia article, see below
I have been fortunate enough to work on Big iron for much of my professional life:
  • Control Data (CDC): 160, 1604, 6600 and follow-ons; 203, 205, ETA-10
  • Cray Research (CRI): CRAY- 1, CRAY-2, CRAY X-MP
  • IBM: 3090 (AIX)
  • Thinking Machines (TMC): CM-2 (& 200), CM-5
You may have done your homework on performance issues, but if not, I suggest you look at -- a quick-and-dirty-off-the-top-of-my-head-list:An older book that you might be able to find used is:
Quote:
Title: High Performance Computing
Subtitle: RISC Architectures, Optimization & Benchmarks
Author: Charles Severance, Kevin Dowd
Edition: 2
Date: July 2, 1998
Publisher: O'Reilly
ISBN: 156592312X
Pages: 460
Categories: high performance, optimization, programming, software design
Comments: 5 stars (4 reviews, Amazon, 2007.12)
Comments: ( I have 1st edition, 1993 )
Most of the suggestions listed above by posters are appropriate at some time in the optimization process. I have a few principles that I advise folks to think about:
-1: Does this program / process / code absolutely, positively need to be faster?

0) Make it run right before you make it faster

1) Spend most of your personal time finding the best algorithm. There is a story in Programming Pearls, J Bentley, about the comparison between an algorithm implemented in compiled Fortran on a Cray-1 versus a better algorithm in interpreted Basic on a Radio Shack TRS-80. As you might guess, the Cray-1 crushed the TRS-80 -- at least at a small problem size. As the size went up, the TRS-80 eventually overcame the mighty Cray-1, and for the largest size listed, the Cray would have taken 95 years, the TRS-80 5.4 hours.

Another story about algorithms has to do with advances in hardware. There are many algorithms that have been discarded because they were too slow -- at least on scalar machines. When parallel processing became a reality, some of those really inefficient algorithms turned out to be spectacularly useful on parallel boxes. The CM-2 (200) above had 32,000 processors, but they were bit-slice computers. Most people used the mode where they ganged them by 32s to get a 1,000 processor box -- quite respectable for that time in computing history. If you used the right algorithm applied to right problem, that machine really cranked out results. (That was a "half-gallon" machine, the "one gallon" had 64K processors.)

2) Profile / instrument your code; obtain measurements to see where it is spending its time, then spend your precious time in those areas. A few years back, I did the opposite of what I had usually done. A client asked me to take a code that previously ran on a Cray and port it to run on a PC. It was far too complex a code to consider an algorithm change (although I suggested that their domain experts look at that). I profiled it and saw that it spent a lot of time doing IO. The best approach at that point was to allocate as much memory as feasible to a RAMdisk. That affected the models that I was using by decreasing the real time by 30% (we might have expected more, but this was all done with filesystem drivers, so that code did not need to be modified). If there was more to be done, a RAID-0 across several disks would have been next.

If you have some money, perhaps all you need is more memory, or a box that has two or more CPUs, an account at a computing service bureau, etc. However, I suggest that you take a step back and consider all your options and possibilities, to avoid the premature optimization trap.

Best wishes ... cheers, drl
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 10:50 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102