Does anybody know if SuSE 64 bit system is really 64 bit code? I can't seem to get any response from SuSE staff regarding the questions: 1: If I define int i; and real x; do I get 64 bit integer and float if compiled under 64? 2: Where does one find the definitions in the SuSE system? For example, where is the definition for the structure of XSizeHints ? Where is the definition of the function prototypes for the 64 bit functions? Maybe the 'average' programmer can ignore such issues, but I want to use FORTRAN to do the number crunching and I need to know if I should pass an integer(KIND=4) or integer(KIND=8) Regards, Colin
Colin Carter wrote:
Does anybody know if SuSE 64 bit system is really 64 bit code? I can't seem to get any response from SuSE staff regarding the questions: 1: If I define int i; and real x; do I get 64 bit integer and float if compiled under 64?
Try it and see:
#include
2: Where does one find the definitions in the SuSE system? For example, where is the definition for the structure of XSizeHints ? Where is the definition of the function prototypes for the 64 bit functions?
Typically somewhere in the /usr/include hierarchy.
Maybe the 'average' programmer can ignore such issues, but I want to use FORTRAN to do the number crunching and I need to know if I should pass an integer(KIND=4) or integer(KIND=8)
I don't suppose there's any way I could persuade you to try using C++ or C instead of FORTRAN (I gave up FORTRAN in 1988 and haven't looked back). If you're calling C functions, then I guess you just look for the declarations in an include directory and use the program above (compile it gcc name.c and run it ./a.out) to identify the actual sizes. -- JDL
John Lamb wrote:
Colin Carter wrote:
Does anybody know if SuSE 64 bit system is really 64 bit code? I can't seem to get any response from SuSE staff regarding the questions: 1: If I define int i; and real x; do I get 64 bit integer and float if compiled under 64?
Try it and see:
#include
int main() { printf( "short has size %d\n", sizeof( short ) ); printf( "int has size %d\n", sizeof( int ) ); printf( "long has size %d\n", sizeof( long ) ); printf( "long long long has size %d\n", sizeof( long long ) ); printf( "float has size %d\n", sizeof( float ) ); printf( "double has size %d\n", sizeof( double ) ); } A 32-bit system will give 2 for short, 4 for int, long and float and and 8 for long long and double. A 64-bit system ought to give different values. Remember that C also specifies bounds for some of these values; so short isn't going to have size 8 just because you've got 64-bit code.
2: Where does one find the definitions in the SuSE system? For example, where is the definition for the structure of XSizeHints ? Where is the definition of the function prototypes for the 64 bit functions?
Typically somewhere in the /usr/include hierarchy.
Maybe the 'average' programmer can ignore such issues, but I want to use FORTRAN to do the number crunching and I need to know if I should pass an integer(KIND=4) or integer(KIND=8)
I don't suppose there's any way I could persuade you to try using C++ or C instead of FORTRAN (I gave up FORTRAN in 1988 and haven't looked back). If you're calling C functions, then I guess you just look for the declarations in an include directory and use the program above (compile it gcc name.c and run it ./a.out) to identify the actual sizes.
FORTRAN is still as much as 75% faster than C/C++ with good compilers (SGI & Intel under various linuces, including SuSE), I have seen that without fail. If you are doing runs which take days to complete, the difference definitely counts.
William A. Mahaffey III wrote:
I don't suppose there's any way I could persuade you to try using C++ or C instead of FORTRAN (I gave up FORTRAN in 1988 and haven't looked back). If you're calling C functions, then I guess you just look for the declarations in an include directory and use the program above (compile it gcc name.c and run it ./a.out) to identify the actual sizes.
FORTRAN is still as much as 75% faster than C/C++ with good compilers (SGI & Intel under various linuces, including SuSE), I have seen that without fail. If you are doing runs which take days to complete, the difference definitely counts.
I guess you don't do C/C++ then. Could I interest you in java or python? -- JDL
John Lamb wrote:
William A. Mahaffey III wrote:
I don't suppose there's any way I could persuade you to try using C++ or C instead of FORTRAN (I gave up FORTRAN in 1988 and haven't looked back). If you're calling C functions, then I guess you just look for the declarations in an include directory and use the program above (compile it gcc name.c and run it ./a.out) to identify the actual sizes.
FORTRAN is still as much as 75% faster than C/C++ with good compilers (SGI & Intel under various linuces, including SuSE), I have seen that without fail. If you are doing runs which take days to complete, the difference definitely counts.
I guess you don't do C/C++ then. Could I interest you in java or python?
By the by, I do do some C & (frankly) like it. Almost all new stuff I write is, in fact, in C (no good w/ C++ yet ....), unless there are definite speed requirements, whence I go to FORTRAN.
On Saturday 28 August 2004 05:07, William A. Mahaffey III wrote:
By the by, I do do some C & (frankly) like it. Almost all new stuff I write is, in fact, in C (no good w/ C++ yet ....), unless there are definite speed requirements, whence I go to FORTRAN.
Just curious: Did you do any hard benchmarking to support that supposed
performance advantage of Fortran compared to C used in a similar way - i.e.
not doing any fancy stuff, just number crunching?
Any pointers, anybody?
CU
--
Stefan Hundhammer
Stefan Hundhammer wrote:
On Saturday 28 August 2004 05:07, William A. Mahaffey III wrote:
By the by, I do do some C & (frankly) like it. Almost all new stuff I write is, in fact, in C (no good w/ C++ yet ....), unless there are definite speed requirements, whence I go to FORTRAN.
Just curious: Did you do any hard benchmarking to support that supposed performance advantage of Fortran compared to C used in a similar way - i.e. not doing any fancy stuff, just number crunching?
Any pointers, anybody?
A reasonable starting point would be http://www.amath.washington.edu/~lf/software/CompCPP_F90SciOOP.html since it's mainly in the realms of Computational Maths/Physics/Chemistry that FORTRAN remains important. -- JDL
On Monday 30 August 2004 16:17, John Lamb wrote:
Just curious: Did you do any hard benchmarking to support that supposed performance advantage of Fortran compared to C used in a similar way - i.e. not doing any fancy stuff, just number crunching?
Any pointers, anybody?
A reasonable starting point would be http://www.amath.washington.edu/~lf/software/CompCPP_F90SciOOP.html since it's mainly in the realms of Computational Maths/Physics/Chemistry that FORTRAN remains important.
OK, thanks, that's a very informative site.
But according to the charts there, there is hardly any difference in
performance, right? Sometimes even C/C++ appears to be faster.
Or am I reading those charts wrong?
CU
--
Stefan Hundhammer
Stefan Hundhammer wrote:
OK, thanks, that's a very informative site.
But according to the charts there, there is hardly any difference in performance, right? Sometimes even C/C++ appears to be faster.
Or am I reading those charts wrong?
No, though there may be other examples where F is actually faster, depending on the usual things, how it's compiled, what number-crunching is done etc. There are still F libraries such as ATLAS that are reputedly better than the C equivalent. OTOH, since C has the asm keyword, it's always technically possible to get C code to compile as fast as F. I've found that wring the number crunching stuff in C/C++ carefully often gives assembly output that I couldn't reasonably improve, albeit the style of the C/C++ tends to resemble F a bit. In the end, there's nothing in C/C++ that says it can't compile to run at least as fast as F, esp with the right optimisations (-march=pentium4 -O3 -mfpmath=sse -msse -msse2 -malign-double works for me!), though I think that's not always the point. Otherwise I wouldn't use java and python. ;-) -- JDL
On Monday 30 August 2004 18:33, John Lamb wrote:
Stefan Hundhammer wrote:
OK, thanks, that's a very informative site.
But according to the charts there, there is hardly any difference in performance, right? Sometimes even C/C++ appears to be faster.
Or am I reading those charts wrong? An interesting paper. I would probably ignore the details of the charts however as the results date from 1996!
No, though there may be other examples where F is actually faster, depending on the usual things, how it's compiled, what number-crunching is done etc. Agreed
There are still F libraries such as ATLAS that are reputedly better than the C equivalent. This is rather odd. ATLAS is most definitely written in C. It has both F77 and C interfaces. ATLAS is fast because of it's high quality algorithms and tuning ability.
That said if you are doing ordinary numeric computation I don't think you will notice any performance differences between F77/C/C++. If you are "fancy stuff" other factors will probably be more important. Compiler availability/strength, existing code etc etc In terms of performance optimisation one of the biggest advantages Fortran has is the lack of pointers and therefore the lack off possible aliases. C/C++ compilers have to employ comlex alias optimisation analysis. Here C++ is significantly better then C. Reference types (instead of pointers), the use of 'const', and inline member functions all help the complier. Michael
In terms of performance optimisation one of the biggest advantages Fortran has is the lack of pointers and therefore the lack off possible aliases. C/C++ compilers have to employ comlex alias optimisation analysis. Here C++ is significantly better then C. Reference types (instead of pointers), the use of 'const', and inline member functions all help the complier. This is very true in context, but C++ is significantly more difficult to optimize. Reference types, const, and inline member functions certainly have an advantage, but many commercial C compilers inline many common
On Tue, 31 Aug 2004 19:09:32 +0200
Michael Stevens
Hi Jerry, On Tuesday 31 August 2004 19:55, Jerry Feldman wrote:
This is very true in context, but C++ is significantly more difficult to optimize. Reference types, const, and inline member functions certainly have an advantage, but many commercial C compilers inline many common library functions, such as strlen, strcpy, etc. I think this is true for free C compilers also!
Years ago, I used to avoid subscripts like the plague and use pointers for performance. Today, I use and teach the use of subscripts because subscripts allow better optimization than pointers. (And they improve readability). I came to realise this last year also! I was shocked.
Compiler writers tend to be much smarter than other programmers as they will constantly remind you. That was until Intel bought out KAI and then killed of their excellent optimising C++ compiler!
Michael
On Tue, 31 Aug 2004 20:24:01 +0200
Michael Stevens
That was until Intel bought out KAI and then killed of their excellent
optimising C++ compiler! Intel acquired a lot of the compiler people from Compaq Computer (formerly Digital now HP). -- Jerry Feldman
Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
Stefan Hundhammer wrote:
On Saturday 28 August 2004 05:07, William A. Mahaffey III wrote:
By the by, I do do some C & (frankly) like it. Almost all new stuff I write is, in fact, in C (no good w/ C++ yet ....), unless there are definite speed requirements, whence I go to FORTRAN.
Just curious: Did you do any hard benchmarking to support that supposed performance advantage of Fortran compared to C used in a similar way - i.e. not doing any fancy stuff, just number crunching?
Any pointers, anybody?
CU
Absolutely, have posted about that in the past. I have some code that I originally ran on Convex & Cray computers, written in the late '80's, in F77 (originally), which does simple operations (dot products, matrix-vector op'ns, etc). It was motivated by linpack, but did some other operations. I have since fancied it up (with a C main routine to allocate memory & call the various F77 & C leaf routines to do the actual work & clock things, etc.), & have run it on various SGI Octanes (2 X 195, 2 X 300, 2 X 400, 2 X 600 out at MSFC in HSV, Al. USA), SGI servers (250 MHz based Origins, 600 MHz Origins), as well as a DEC Alpha based server, and numerous PCs, from 400 MHz PII up to 2400 MHz P4's, as well as AMD Athlons from 1600 MHz to 2200 MHz. F77 is 10 - 25% faster than C under commercial compilers. Commercial C compilers are 10 - 30% faster than GCC. The speedups are usually higher the more operations you do per loop. Simple assigns or copies (memset, memcpy) as equally fast under C & F77. It is only an issue if you do large numerical simulations that really do take many hours or days to complete, then any speedup is noticable.
On Thursday 26 August 2004 12:06, Colin Carter wrote:
Does anybody know if SuSE 64 bit system is really 64 bit code?
Yes. Yes, I know it, and yes, it is 64 bit code - whatever you mean with that.
I can't seem to get any response from SuSE staff regarding the questions:
Sorry, but things don't work this way. First of all, this is a mailing list we (SuSE) offer as an additional resource for developers - for free. You can ask questions here, and if somebody knows the answer (which might or might not be the case) AND if this somebody is also willing to share that information with you, you might get an answer. But this is not a guaranteed service of any kind. It is a community that depends on how willing people are. Some SuSE people participate in this community - in their spare time, as volunteers. You should take that as a sign of personal involvement with the Open Source spirit of those people. But to come here and complain that somebody who gave you some information does not open this as a private support channel for no cost at all is downright outrageous - even more so since you got that information (again, for free) with one day delay since some people, believe it or not, are sometimes simply unavailable for such community service for some hours. Open Source communities don't work that way. Neither do commercial companies. If you wish to purchase guaranteed development support, please consult http://www.suse.com which models are available. The box product or even the server products do not come with any such service by default.
1: If I define int i; and real x; do I get 64 bit integer and float if compiled under 64?
Yes, but if you rely on that, your program will not be portable. It will always only run on 64 bit systems.
2: Where does one find the definitions in the SuSE system? For example, where is the definition for the structure of XSizeHints ?
/usr/include/X11/Xutil.h
Where is the definition of the function prototypes for the 64 bit functions?
There is no difference between 32 or 64 bits for these kinds of functions. That's the whole point of having a windowing system as a separate abstraction level.
Maybe the 'average' programmer can ignore such issues, but I want to use FORTRAN to do the number crunching and I need to know if I should pass an integer(KIND=4) or integer(KIND=8)
Anybody here with Fortran experience on Linux?
CU
--
Stefan Hundhammer
Colin Carter
Does anybody know if SuSE 64 bit system is really 64 bit code?
Of cause it is.
1: If I define int i; and real x;
What, please, is an int? C/C++ do not know the type real.
do I get 64 bit integer and float if compiled under 64? 2: Where does one find the definitions in the SuSE system?
Definition of data types are found in the ABI (Application Binary Interface) for a given platform, so the first question would be which platform you're specifically asking for. If it's AMD64, you'll find the ABI document here: http://www.x86-64.org/documentation/abi-0.91.pdf For Platforms like Linux on IPF (aka Itanium) you'd have to search elsewhere.
For example, where is the definition for the structure of XSizeHints ?
Usually in the respective header, in this case I'd search in the X11 headers below /usr/X11R6/include.
Where is the definition of the function prototypes for the 64 bit functions?
In header files. Philipp
On Thu, 02 Sep 2004 05:23:38 +0200
Philipp Thomas
Colin Carter
[26 Aug 2004 10:06:23 GMT]: Does anybody know if SuSE 64 bit system is really 64 bit code?
Of cause it is.
1: If I define int i; and real x;
What, please, is an int? C/C++ do not know the type real.
do I get 64 bit integer and float if compiled under 64? ints on 64 bits systems are generally 32 bits. Longs are 64 bit on a 64 bit system, and pointers are 64 bits. Just use this small programm to tell you. #include
int main() { printf("Sizeof(int) = %ld\n", sizeof(int)); printf("Sizeof(long) = %ld\n", sizeof(long)); printf("Sizeof(float) = %ld\n", sizeof(float)); printf("Sizeof(double) = %ld\n", sizeof(double)); printf("Sizeof(char *) = %ld\n", sizeof(char *)); return 0; }
Note that I do not have a 64 bit SuSE system at the moment, but I had an
older Linux on Alpha.
Note that there is no primitive type "real" in C or C++. In general
doubles are 64 bits on both 32 and 64 bit systems.
Note that the sizeof operator returns a size_t that is implementation
defined, and may be a long, hence you should use %ld because size_t is
often a long.
--
Jerry Feldman
participants (7)
-
Colin Carter
-
Jerry Feldman
-
John Lamb
-
Michael Stevens
-
Philipp Thomas
-
Stefan Hundhammer
-
William A. Mahaffey III