Question for the Code Cutters

Message boards : Number crunching : Question for the Code Cutters
Message board moderation

To post messages, you must log in.

AuthorMessage
Terror Australis
Volunteer tester

Send message
Joined: 14 Feb 04
Posts: 1817
Credit: 262,693,308
RAC: 44
Australia
Message 770627 - Posted: 20 Jun 2008, 1:51:30 UTC

What is involved in "optimizing" an app ?

I continue to be amazed at the difference between AK-V8 and the stock app. It got me thinking, How many ways are there to tell a computer to add 2+2 and why are some ways more efficient than others ?

Brodo
ID: 770627 · Report as offensive
Profile Mr. Majestic
Volunteer tester
Avatar

Send message
Joined: 26 Nov 07
Posts: 4752
Credit: 258,845
RAC: 0
United States
Message 770637 - Posted: 20 Jun 2008, 2:13:05 UTC

try this It has it for Windows and Linux on this page. Hope that helps!

ID: 770637 · Report as offensive
Profile JDWhale
Volunteer tester
Avatar

Send message
Joined: 6 Apr 99
Posts: 921
Credit: 21,935,817
RAC: 3
United States
Message 770864 - Posted: 20 Jun 2008, 16:36:52 UTC - in response to Message 770627.  

What is involved in "optimizing" an app ?

I continue to be amazed at the difference between AK-V8 and the stock app. It got me thinking, How many ways are there to tell a computer to add 2+2 and why are some ways more efficient than others ?

Brodo


It's the use of SIMD (Single Instruction Multiple Data) instructions performing 4 additions or multiplications in the same time it takes a single addition or multiplication. It's harder to code, but can make programs much faster by using more of the CPU capabilities.

HTH,
JDWhale
ID: 770864 · Report as offensive
PhonAcq

Send message
Joined: 14 Apr 01
Posts: 1656
Credit: 30,658,217
RAC: 1
United States
Message 770882 - Posted: 20 Jun 2008, 17:36:03 UTC - in response to Message 770637.  

try this It has it for Windows and Linux on this page. Hope that helps!


That link is unfortunately useless; i.e. it is hardly a step-by-step set of instructions and is 2 years old. Does anybody have an updated roadmap for compiling our own client?
ID: 770882 · Report as offensive
1mp0£173
Volunteer tester

Send message
Joined: 3 Apr 99
Posts: 8423
Credit: 356,897
RAC: 0
United States
Message 770885 - Posted: 20 Jun 2008, 17:41:59 UTC - in response to Message 770627.  

What is involved in "optimizing" an app ?

I continue to be amazed at the difference between AK-V8 and the stock app. It got me thinking, How many ways are there to tell a computer to add 2+2 and why are some ways more efficient than others ?

Brodo

This thread got into the flavor of optimizing code.

There are a couple of things that are commonly done:

The most common optimizations take the existing code, without changes, and tries to find the optimal set of compiler switches for a given CPU. You can change the execution speed by telling the code generator in the compiler about the specific CPU instruction set.

Less common is taking routines that use a lot of time and re-coding them in more efficient ways.

Another less common change is recognizing how a CPU feature like branch prediction works, and adjusting all of the branches so they tend to follow the favored method.

The least common (and most brilliant) is looking at the code, and recognizing that some time consuming function (like trig. functions) can be "cached" in a table, and the table lookup takes less time than recalculating.
ID: 770885 · Report as offensive
Terror Australis
Volunteer tester

Send message
Joined: 14 Feb 04
Posts: 1817
Credit: 262,693,308
RAC: 44
Australia
Message 771142 - Posted: 21 Jun 2008, 5:25:29 UTC - in response to Message 770885.  


This thread got into the flavor of optimizing code.


Well, I understood the first post :-)

I'm still not sure whether those blokes were for real or just typing random symbols to impress the masses (but I'm impressed anyway), I love it when people who know their stuff start sparring, it's like watching Roger Fedora and Rafael Nadal having a "social" game of tennis :-)

Brodo

P.S.
Anyone want to discuss the finer points on how a change of Eg2 effects the zd and ib of a 4VL100000 operating in class C2, when Fc=2525000Hz Fm=315Hz and mi=0.47 ("Blah" :-P )

ID: 771142 · Report as offensive
Profile jason_gee
Volunteer developer
Volunteer tester
Avatar

Send message
Joined: 24 Nov 06
Posts: 7489
Credit: 91,093,184
RAC: 0
Australia
Message 771153 - Posted: 21 Jun 2008, 5:45:03 UTC - in response to Message 770882.  
Last modified: 21 Jun 2008, 5:58:32 UTC

try this It has it for Windows and Linux on this page. Hope that helps!


That link is unfortunately useless; i.e. it is hardly a step-by-step set of instructions and is 2 years old. Does anybody have an updated roadmap for compiling our own client?


Actually, for the windows one at least, As far as building & compiler optimising goes , that process is near identical to the one I used for all the AK_V8 releases, with obvious adjustments and addition of further steps due to newer tools and techniques. Using those steps with a little help and the Ported Windows AK_V8 code should obtain, if not the very fastest app, at least a reasonably functional one. I learned how to build apps using that guide, and starting with an older build, to 'get a feel' for it, is what I would recommend, [as more advanced builds like AK tend to migrate from standard looking code to hieroglyphics ;D]

Of course that's just the compiler tweaking part of optimisation, the hard optimisation work typically occurs at both the algorithmic and microarchitectural levels. That was Alex's work, with contribution from all previous notes and experience at Lunatic's to obtain the knowledge to build it, and get it going & validated.

Jason
"Living by the wisdom of computer science doesn't sound so bad after all. And unlike most advice, it's backed up by proofs." -- Algorithms to live by: The computer science of human decisions.
ID: 771153 · Report as offensive
kittyman Crowdfunding Project Donor*Special Project $75 donorSpecial Project $250 donor
Volunteer tester
Avatar

Send message
Joined: 9 Jul 00
Posts: 51468
Credit: 1,018,363,574
RAC: 1,004
United States
Message 771154 - Posted: 21 Jun 2008, 5:46:55 UTC - in response to Message 771142.  
Last modified: 21 Jun 2008, 5:48:31 UTC


This thread got into the flavor of optimizing code.


Well, I understood the first post :-)

I'm still not sure whether those blokes were for real or just typing random symbols to impress the masses (but I'm impressed anyway), I love it when people who know their stuff start sparring, it's like watching Roger Fedora and Rafael Nadal having a "social" game of tennis :-)

Brodo

P.S.
Anyone want to discuss the finer points on how a change of Eg2 effects the zd and ib of a 4VL100000 operating in class C2, when Fc=2525000Hz Fm=315Hz and mi=0.47 ("Blah" :-P )


If you really wanna get into it.........
Please talk to Jason and the other optimizers over at Lunatics........ and if you need a pass into the pre-release section for coders, I am sure I can arrange that, if you are for true......
They will have ya for lunch, I think.........they are WAAAYYYY over this lil' kitty cruncher's head........
If not, I apologize and push you even harder.......LOL.
"Freedom is just Chaos, with better lighting." Alan Dean Foster

ID: 771154 · Report as offensive
Terror Australis
Volunteer tester

Send message
Joined: 14 Feb 04
Posts: 1817
Credit: 262,693,308
RAC: 44
Australia
Message 771186 - Posted: 21 Jun 2008, 6:28:11 UTC - in response to Message 771154.  



[/quote]They will have ya for lunch, I think............LOL.[/quote]


Lunch ? I wouldn't even be a biscuit during their coffee break :-)

Brodo


ID: 771186 · Report as offensive
kittyman Crowdfunding Project Donor*Special Project $75 donorSpecial Project $250 donor
Volunteer tester
Avatar

Send message
Joined: 9 Jul 00
Posts: 51468
Credit: 1,018,363,574
RAC: 1,004
United States
Message 771195 - Posted: 21 Jun 2008, 6:48:16 UTC - in response to Message 771186.  
Last modified: 21 Jun 2008, 6:49:53 UTC



They will have ya for lunch, I think............LOL.



Lunch ? I wouldn't even be a biscuit during their coffee break :-)

Brodo



LOL........I'll be a kitty biscuit too...........their lunch is my toaste..........
Coders Rule.........
"Freedom is just Chaos, with better lighting." Alan Dean Foster

ID: 771195 · Report as offensive
1mp0£173
Volunteer tester

Send message
Joined: 3 Apr 99
Posts: 8423
Credit: 356,897
RAC: 0
United States
Message 771370 - Posted: 21 Jun 2008, 15:34:52 UTC - in response to Message 771142.  


This thread got into the flavor of optimizing code.


Well, I understood the first post :-)

I'm still not sure whether those blokes were for real or just typing random symbols to impress the masses (but I'm impressed anyway), I love it when people who know their stuff start sparring, it's like watching Roger Fedora and Rafael Nadal having a "social" game of tennis :-)

Brodo

P.S.
Anyone want to discuss the finer points on how a change of Eg2 effects the zd and ib of a 4VL100000 operating in class C2, when Fc=2525000Hz Fm=315Hz and mi=0.47 ("Blah" :-P )


I can't speak for ML1, but I think he has a good grasp of things.

I've been writing code for nearly four decades, and I'm pretty good at taking an algorithm and moving code around to get something reasonably fast. I've never practiced optimization at the level JDWhale, Jason, and many others do.

... but I know what it is, and the examples in the thread are both artificial, and incredibly entry-level.

I took your original question from this thread to be "what is the general techniques used, and why does it make things faster" while most of the other posters seem to have gone toward "here are the tools so that you can try your hand..."

The best optimizations take a deep understanding of the algorithm (so you know what parts you can shuffle around without changing the result) and a deep understanding of the CPU internals (so you can imagine ways to feed the CPU in the most optimal ways).

... and then it takes lots of experimentation, testing, and validation.

-- Ned
ID: 771370 · Report as offensive
kittyman Crowdfunding Project Donor*Special Project $75 donorSpecial Project $250 donor
Volunteer tester
Avatar

Send message
Joined: 9 Jul 00
Posts: 51468
Credit: 1,018,363,574
RAC: 1,004
United States
Message 771376 - Posted: 21 Jun 2008, 15:44:59 UTC - in response to Message 771370.  


This thread got into the flavor of optimizing code.


Well, I understood the first post :-)

I'm still not sure whether those blokes were for real or just typing random symbols to impress the masses (but I'm impressed anyway), I love it when people who know their stuff start sparring, it's like watching Roger Fedora and Rafael Nadal having a "social" game of tennis :-)

Brodo

P.S.
Anyone want to discuss the finer points on how a change of Eg2 effects the zd and ib of a 4VL100000 operating in class C2, when Fc=2525000Hz Fm=315Hz and mi=0.47 ("Blah" :-P )


I can't speak for ML1, but I think he has a good grasp of things.

I've been writing code for nearly four decades, and I'm pretty good at taking an algorithm and moving code around to get something reasonably fast. I've never practiced optimization at the level JDWhale, Jason, and many others do.

... but I know what it is, and the examples in the thread are both artificial, and incredibly entry-level.

I took your original question from this thread to be "what is the general techniques used, and why does it make things faster" while most of the other posters seem to have gone toward "here are the tools so that you can try your hand..."

The best optimizations take a deep understanding of the algorithm (so you know what parts you can shuffle around without changing the result) and a deep understanding of the CPU internals (so you can imagine ways to feed the CPU in the most optimal ways).

... and then it takes lots of experimentation, testing, and validation.

-- Ned

The expert on the math here would be Joe Segur.....
He has his fingers in all the algorithms......

This is very technical stuff......waaaaaaaaaaaay more than I can put my hands around.....
You not only have to be doing the math right, you have to be doing the right math.......
And then code it to run as fast as possible........not easy stuff.......
Give much respect to those who can make it work at all!!!
"Freedom is just Chaos, with better lighting." Alan Dean Foster

ID: 771376 · Report as offensive
1mp0£173
Volunteer tester

Send message
Joined: 3 Apr 99
Posts: 8423
Credit: 356,897
RAC: 0
United States
Message 771596 - Posted: 21 Jun 2008, 20:55:35 UTC - in response to Message 771376.  

The expert on the math here would be Joe Segur.....
He has his fingers in all the algorithms......

This is very technical stuff......waaaaaaaaaaaay more than I can put my hands around.....
You not only have to be doing the math right, you have to be doing the right math.......
And then code it to run as fast as possible........not easy stuff.......
Give much respect to those who can make it work at all!!!

There are lots of different kinds of algorithms, they aren't all math.

I do a fair amount with sorting and searching, and less with things like Fast Fourier Transforms. If you wanted to be able to find a data item in a list of 100,000 I can discuss search strategies that will take 25 comparisons or less.

So, I can appreciate their work, and I can talk about what they're doing in a general way, and you are absolutely correct -- this is not just hard work, but requires a certain amount of actual genius.
ID: 771596 · Report as offensive
kittyman Crowdfunding Project Donor*Special Project $75 donorSpecial Project $250 donor
Volunteer tester
Avatar

Send message
Joined: 9 Jul 00
Posts: 51468
Credit: 1,018,363,574
RAC: 1,004
United States
Message 771643 - Posted: 21 Jun 2008, 22:01:10 UTC - in response to Message 771596.  

The expert on the math here would be Joe Segur.....
He has his fingers in all the algorithms......

This is very technical stuff......waaaaaaaaaaaay more than I can put my hands around.....
You not only have to be doing the math right, you have to be doing the right math.......
And then code it to run as fast as possible........not easy stuff.......
Give much respect to those who can make it work at all!!!

There are lots of different kinds of algorithms, they aren't all math.

I do a fair amount with sorting and searching, and less with things like Fast Fourier Transforms. If you wanted to be able to find a data item in a list of 100,000 I can discuss search strategies that will take 25 comparisons or less.

So, I can appreciate their work, and I can talk about what they're doing in a general way, and you are absolutely correct -- this is not just hard work, but requires a certain amount of actual genius.

I'll grant ya that........
They would all rate the 'genius' tag in my book!!!

"Freedom is just Chaos, with better lighting." Alan Dean Foster

ID: 771643 · Report as offensive

Message boards : Number crunching : Question for the Code Cutters


 
©2024 University of California
 
SETI@home and Astropulse are funded by grants from the National Science Foundation, NASA, and donations from SETI@home volunteers. AstroPulse is funded in part by the NSF through grant AST-0307956.