[Beowulf] Math Coprocessor

Robert G. Brown rgb at phy.duke.edu
Thu Feb 12 10:04:29 EST 2004

On Thu, 12 Feb 2004, sunil kumar wrote:

>  Hello everybody,
>   I am a newbie in the Linux world.I would like to
> know    
>  know to...  
>   1) program the 80x87 using C/C++/Fortran95 in linux 

Why?  As one of the relatively few humans on the planet to ever actually
write 8087 code (back when it was the ONLY way to use the coprocessor
with the various compilers available at the time) I can authoritatively
say that it isn't horribly difficult -- the x87 is sort of a RPN HPC
calculator for your PC with its own stack and internal floating point
commands -- but all the compilers available already use it when they can
and it is appropriate, and in MANY cases their code will be as or more
efficient and robust than what you could hand code.  There are doubtless
exceptions, but are they worth the considerable amount of work required
to realize them?

Are you planning to join the GCC project or something?

>       platform.
>   2) program the 80x86 using C/C++/Fortran95 in linux 
>       platform.

This is straightfoward.  But I'm not going to explain inlining of
assembler here (I can give you an example/code fragment of inlined code
if you want it, though).  Instead...

...Google is your friend.  Try e.g. "86 assembler reference gnu"

    http://www.redhat.com/docs/manuals/enterprise/ RHEL-3-Manual/pdf/rhel-as-en.pdf 

or "gnu assembler manual"

>   3) link a C function into a fortran95 program or
> vice 

or "gnu fortran manual"


(and that's just the beginning!)  Try other search strings.  Consider
buying a book or two if you're unfamiliar with assembler altogether -- I
don't think it is taught much anymore in CPS departments unless you are
a really serious major and select the right courses.  And they still
have somebody who can teach them -- one thing about upper level
languages is that they make assembler level programming so difficult by
comparison that it has become a vanishing and highly arcane art.  Well,
not really vanishing, but I'll bet that no more than 10% of all
programmers have a clue about what registers are and how to manipulate
them with assembler commands...maybe more like 1-2%.  And mostly Old
Guys at that.  And the serious, I mean really serious, programmers and

Basically, all of this is throroughly documented ag gnu.org, and much of
it is REdocumented, explained, tutorialized, and hashed over many times
many other places, all on the web.


Robert G. Brown	                       http://www.phy.duke.edu/~rgb/
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Phone: 1-919-660-2567  Fax: 919-660-2525     email:rgb at phy.duke.edu

Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf

More information about the Beowulf mailing list