I was running a simulation code on OpenSuSe 11.1 32 bit, and it was working well. The figure named i586.jpg shows the atomic configuration generated on this 32 bit OS. Yesterday I ran the same simulation but on my new machine that its OS was OpenSuSe 11.4 64 bit, but the result was significant different, as shown in attached figure named x86_64.jpg. Of course I prefer the atomic configuration shown in i586.jpg than that in x86_64.jpg. I have carefully checked that except for OS, the version of code and the input file are the same for these two cases. How does this phenomenon happen? Any suggestion is highly appreciated!
Well, buggy/insufficiently robust code is an obvious suggestion. You don’t say anything worthwhile about the application code or the libraries that it uses, but it is easy enough to produce situations where doing 64 bit math produces different results from 32 bit math. if you are compiling source code from, eg, c, you might find that definitions of integer sizes are different.
Of course if everything (including libraries) is well written in the first instance, this shouldn’t happen. I’ll leave it as an exercise for the interested student (in this case, that’ll be you) to work out whether that says anything that should give you pause for thought.
It is a well known problem that many programs produce different results when run on a 64 bit OS. I encountered this with crm114 (just given as an example, there are many more). It takes a lot of programming skills to make any program written in C behave the same on both architectures, when extensive math is used.
>
> It is a well known problem that many programs produce different results
> when run on a 64 bit OS. I encountered this with crm114 (just given as
> an example, there are many more). It takes a lot of programming skills
> to make any program written in C behave the same on both architectures,
> when extensive math is used.
>
In principle it is easy if it was taken into consideration from the very
beginning that not all compilers and operating systems and archtictures are
created equal (yes I know that is a bit of a over simplification), just
ensure that the data types you use are always the same size and precision
independent of the compiler defaults and the architecture.
To be more precise, that is what configure scripts are for (to check the
size and precision of data types the type of the compiler and underlying
operating system and architecture and set compiler switches accordingly).
If it is self written code it may help to compile the application as a 32
bit application on the 64bit architecture with the -m32 switch (provided one
of the GNU compilers is used) and of course before doing that the
appropriate 32bit libraries for the development pattern have to be
installed.
By the way which programming language was used (if self written code) or
what is the name of the libraries/applications used?
–
PC: oS 11.3 64 bit | Intel Core2 Quad Q8300@2.50GHz | KDE 4.6.5 | GeForce
9600 GT | 4GB Ram
Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.6.5 | nVidia
ION | 3GB Ram
The application code is called LAMMPS (LAMMPS Molecular Dynamics Simulator). And I complied it using the g++ with fftw and mpich by: make Makefile. I’d like to try your suggestion that compile it as 32-bit application, so how to embedded the option -m32? I tried the make Makefile -m32, but the compiling stopped with an error. The detail is shown below:
junjiz3k@linux-66lc:~/Downloads/lammps-1Jul11/src> make Makefile -m32
make: invalid option – ‘3’
make: invalid option – ‘2’
Usage: make [options] [target] …
The application code is called LAMMPS (LAMMPS Molecular Dynamics Simulator). And I complied it using the g++ with fftw and mpich by: make Makefile. I’d like to try your suggestion that compile it as 32-bit application, so how to embedded the option -m32? I tried the make Makefile -m32, but the compiling stopped with an error. The detail is shown below:
junjiz3k@linux-66lc:~/Downloads/lammps-1Jul11/src> make Makefile -m32
make: invalid option – ‘3’
make: invalid option – ‘2’
Usage: make [options] [target] …
Your link does not work for me the server cannot be reached so I cannot look
at the description of the software. I do not know that software, I do
numerical analysis but in a different field, so I can only tell you very
general things now.
Your sources should contain a README or INSTALL file with a description how
to pass special settings to the compiler.
Under normal circumstances there is a configure script which you call before
you call make. You can then pass parameters to the compiler via switches for
configure.
../configure --help
should tell you details.
../configure CC="-m32"
would be an example, do not simply copy and try it, it may be completely
wrong in your case, you need to consult the LAMMPS build instructions
carfully.
Is there a configure script at all or is there just a Makefile?
–
PC: oS 11.3 64 bit | Intel Core2 Quad Q8300@2.50GHz | KDE 4.6.5 | GeForce
9600 GT | 4GB Ram
Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.6.5 | nVidia
ION | 3GB Ram
Beside the almost trivial comments we made here, I would suggest that you
contact also a LAMMPS mailing list or forum (whatever they have, the server
is still not available from germany).
After a quick look at wikipedia and looking up who made the software I would
think that this is a high quality scientific software and that the Sandia
Labs and the Department of Energy who originally made it are well aware how
to make a proper scientific software which works the same on 64 vs 32 bit if
correctly built.
The problem you ran into is for sure nothing which is openSUSE specific but
very generic and they know best what special settings you need to get on a
64bit linux the same results as on a 32bit linux.
Since the software uses MPI I am almost sure that it is even made to run on
a heterogenous network of machines with different architectures, so they
know for sure what traps might exist when building it.
–
PC: oS 11.3 64 bit | Intel Core2 Quad Q8300@2.50GHz | KDE 4.6.5 | GeForce
9600 GT | 4GB Ram
Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.6.5 | nVidia
ION | 3GB Ram