1994-01-20 - AI code speed up !!!!

Header Data

From: “Scott Bence” <SBENCE@imt.tstc.edu>
To: cypherpunks@toad.com
Message Hash: 3a683f332c1b834f2534a51df6e859bd14eba37d813bdfdd67702e3f8a1faa53
Message ID: <F1254C498A@imt.tstc.edu>
Reply To: N/A
UTC Datetime: 1994-01-20 15:19:15 UTC
Raw Date: Thu, 20 Jan 94 07:19:15 PST

Raw message

From: "Scott Bence" <SBENCE@imt.tstc.edu>
Date: Thu, 20 Jan 94 07:19:15 PST
To: cypherpunks@toad.com
Subject: AI code speed up !!!!
Message-ID: <F1254C498A@imt.tstc.edu>
MIME-Version: 1.0
Content-Type: text/plain


> >> Recently I received the code for a neural network. It is written in
> >> standard ANSI-C. However, running it on the Mac gives me a lot of coffee
> >> breaks ( it takes 10 min on a IIci, 3 hrs on an LC ). I was wondering if
> >> anybody out there has experience with this and knows of ways to make the
> >> code faster ( replacing ANSI routines with Mac-based routines.
> >You might want to get  a match coprocessor for the LC.  The ci has one,
> >and that's probably your problem.  (I'm not sure if the LC can take one,
> >though!)  If my memory still works after the two pints I just had, the LC
> >has a 68020 without any FPU.  You might want to upgrade to an LC III and
> >find out if it has an FPU.   I believe neural nets use floats, no?  If so
> >you will most certainly need and FPU if you want decent speed.
> The LC does lack a FPU, but you can get one on a card.  I'm not sure if
> this would help though, because it would depend if your compilier would
> generate FPU code.  I know you can with Think.  You also might need to take
> into account which compiler you are using for this kind of program, there
> seems to be a vairation in efficency between Mac Compilers.
 
I have done a lot of optimization work on Mac and PC - Fractal 
generations & ray tracing both in C.
1.) Don't use SANE unless accuracy becomes a major issue. 
2.) CHANGE ALL FLOATS TO DOUBLE!!!! Better speed & better 
    accuracy!!!!! (MOST IMPORTANT due to Motorola design!)
3.) Think & MPW both can create FPU code as well '030 code. Use em.
4.) Fall back from system 7.x to newest 6.x with no multitasking.
    Then try to structure your object code size to fit in the cache of 
    680x0.    
5.) Use register variables where needed.
6.) Don't re-code in assembler - the gain usually isn't worth it.
7.) If there is alot of screen updating - stop it until the 
    final/desired result is achieved.
8.) Don't make System Task calls inside critical loops like Apple 
    says to do, it slows down completion time, it will invalidate your 
    code in the cache (see #4).
    There is alot more stuff but this should speed you up by a 
    significant factor.
9.) Mac's are wonderfull but for number crunching '486/66 can smoke 
    the mac due to 256k cache(secondary) and 8K cache (internal 
    -Primary). Don't know your budget but the POWER PC looks sweet. I 
    don't know when the compilers will opimize for this chip but look 
    for mega mega mega increase in performance.

 
 
> > As for using toolbox calls, using Apple's SANE library might help. I
> > haven't had much experience with it, but it would probably take advatage of
> > the FPU.
 
Yup, but it's s...l...o....w.......
 
Hope this helps. Write back and let me know.

BENCE
:-)



#include <std_disclaimer.h>
----------------------------------------------------------------------
------ Scott Bence * Texas State Technical College @ Waco, Texas -----
--- Computer Networking & Systems Administration * sbence@tstc.edu --- 
----------------------------------------------------------------------
 





Thread