Wednesday December 20, 2006
No fpversion? No problem; this script will do the same
The utility fpversion, distributed with the unbundled compilers, identifies the installed CPU and FPU and estimates their clock speeds. It is located in the same directory as the compilers and is accessible directly when you set the compiler path in your search path.
Today, fpversion is available only on SPARC platforms.
During its evolution, the SPARC (this is actually true for the x86 arch as well but in different ways) implementations have seen various chips which had differing floating point characteristics. Unlike the MMX/SSE generation on the x86 architecture, it wasnt just an ISA issue (ie. whether new instructions are available or not). To assist in these situations, the fpversion utility was conceived to give users an accurate picture of their FPU version and how to write programs that are best optimized for a particular FPU.
The utility itself is now dated. Solaris 10, for example, puts ou lots more useful information about the CPU than it ever used to, and so you dont really need to a utility like this.
However, most users of fpversion still use it to get the maximal options via this invocation:
fpversion -foptions
On x86, the lack of this facility gets in the way of doing this very thing. However, in order to get something equivalent, this one liner script will do just about the same thing as that command:
cc -native -### f.c|&egrep '^###.*f.c$'|sed -e 's/^### -/-/' -e 's/f.c$//'
Note: this is a csh command. For other shells, do the equivalent, eg. you can change |& to |2>&1, etc, etc
Note2: In any case, there is an RFE/bug filed to have this facility on x86, whether as a script or otherwise.
Posted by tatkar
( Dec 20 2006, 04:23:26 PM PST )
Permalink
Comments [6]