compilation on IBM

Hello,

We have now compiled the LAMMPS on IBM machine without packages. I am trying now to compile with reax. I need a little help.

bash-3.00$ gmake power6
gmake[1]: Entering directory `/u/home/vranjan/src/lammps-reax/lammps-24Jun11/src/Obj_power6’
mpCC_r -O3 -qstrict -qnoipa -qlanglvl=oldmath -q64 -DLAMMPS_ARRAY -I…/…/lib/reax -DFFT_NONE -I/site/PET/pkgs/fftw-3.2.2-64bit/include -c fix_reax_bonds.cpp
“pair_reax_fortran.h”, line 31.2: 1540-0879 (W) #warning directive: “The following declaration is a test of the CONS macro.”.
“pair_reax_fortran.h”, line 32.2: 1540-0879 (W) #warning directive: “If it fails with an error, pair_reax_fortran.h must be modified by hand.”.
“pair_reax_fortran.h”, line 70.3: 1540-0063 (S) The text “_” is unexpected.

.
.

If you read the top of the REAX/pair_reax_fortran.h file, it
has some suggestions. This is an issue with getting Fortran
and C/C++ to talk to each other, which is unfortunately compiler/system
specific. Aidan may be able to provide more advice as he
wrote those macros (he is back in town next week).

If you get it to work, please post the altered code, and we can add
it as an ifdef option. You can see there is already IBM-specific code
there that you trigger with the -D_IBM, so we're already going
down that painful path.

I think you are the user that posted earlier problem with building
LAMMPS on some IBM platform. If you solved that, did it involve
any changes to LAMMPS source code? Our goal is for users
to never have to do anything more than specify an ifdef, so
if that wasn't the case for you, let us know.

Steve

Thanks for your email. Finally, I was able to compile it with reax. I still need to test it. In my desperation I may have done some unnecessary things (but hopefully not wrong things).

Actually system admin helped me compile LAMMPS (without reax). They changed Makefile, Make.sh, pppm.cpp, and lmtype.h.
I will post a detailed mail with all their suggestion once I test with some run.

Thank you for your support,

Vivek Ranjan

I have attached all the changed files with this email that I needed to get the LAMMPS compile on IBM power6 machine.

These are the changes that was requred:

diff Make.sh.new Make.sh.old

23c23
< elif (test “cmp style_$3.h style_$3.tmp” != “”) then

elif (test “diff --brief style_$3.h style_$3.tmp” != “”) then

diff Makefile.new Makefile.old
3c3
< SHELL = /bin/bash

SHELL = /bin/sh

diff lmptype.h.new lmptype.h.old
42,46d41
< /* Avoid 1540-0130 (S) “PRId64” is not declared (wct) /
< #ifndef PRId64 /
(wct) /
< #define PRId64 “ld” /
(wct) /
< #endif /
not PRId64 (wct) */

The error from the pppm.cpp was the following:

mpCC_r -O3 -qstrict -qnoipa -qlanglvl=oldmath -q64 -DLAMMPS_ARRAY -DFFT_NONE -I/site/PET/pkgs/fftw-3.2.2-64bit/include -c pppm.cpp
“pppm.cpp”, line 1026.50: 1540-0063 (S) The text “100” is unexpected.
“pppm.cpp”, line 875.16: 1540-0063 (S) The text “100” is unexpected.

replace all of the double “hz” variables with “hzz” as followed. Apparently, “hz” variable had already been defined as text “100” somewhere within this rats nest of include files and the “pppm.cpp” file wasn’t expecting it, so I simply changed the name of the variable to avoid any conflicts.

grep -n “hzz” pppm.cpp.new
875: double hx,hy,hzz;
888: hx = hy = hzz = 1/g_ewald; 892: nz_pppm = static_cast (zprd_slab/hzz + 1);
908: err = rms(hzz,zprd_slab,natoms,q2,acons);
910: err = rms(hzz,zprd_slab,natoms,q2,acons);
912: hzz = zprd_slab/nz_pppm;
926: hzz = zprd_slab/nz_pppm;
934: f = diffpr(hx,hy,hzz,q2,acons);
936: hmin = MIN(hx,MIN(hy,hzz));
939: fmid = diffpr(hx,hy,hzz,q2,acons);
947: fmid = diffpr(hx,hy,hzz,q2,acons); 958: double lprz = rms(hzz,zprd_slab,natoms,q2,acons);
1026:double PPPM::diffpr(double hx, double hy, double hzz, double q2, double **acons)
1036: lprz = rms(hzz,zprd*slab_volfactor,natoms,q2,acons);

I did some more trivial changes to compile LAMMPS with reax.

Thank you,

Vivek

IBMpower6Files.tar.gz (31.8 KB)

ok - I'll add your Makefile.power6 to the next patch, and you can check if
these issues go away. If there is an ifdef fix to any of them that
don't yet work, we can do that. But really, these issues are all b/c
IBM system software is different (broken in some cases) compared to
all other machines. Ask your IBM helper if he can explain (d) -
that one is really annoying.

a) change Makefile to use bash and diff, instead of sh and cmp

I hesitate to do this for fear of breaking other machines.
Does anyone know if bash is fully backward compatible with sh?
Likewise, diff --brief may not work on some platforms.
How can IBM justify not providing /bin/sh on their boxes?

b) provide a def for PRId64 in lmptype.h

did that with a new ifdef - how come IBM is the only
vendor that doesn't define that in their header files?

c) reax CONS def in pair_reax_fortran.h

added one with an IBM-specific ifdef - you can see if it works

d) change hz to another variable name in pppm.cpp

made the code change - it is mystifying to me
why IBM header files would re-define hz (not HZ, but hz)
so that an app code cannot use that variable

Steve

Vivek,

Congratulation on getting this working. This does not sound like a normal
IBM environment.....particularly the include file containing a #define for
a lower case variable name, and also the absence of something compatible
with the Bourne shell. Steve, you definitely should not try switching from
sh to bash, unless others complain.

Aidan

a) change Makefile to use bash and diff, instead of sh and cmp

I hesitate to do this for fear of breaking other machines.
Does anyone know if bash is fully backward compatible with sh?
Likewise, diff --brief may not work on some platforms.
How can IBM justify not providing /bin/sh on their boxes?

I just realized an elegant workaround for this from an earlier thread,
that requires no change in LAMMPS.

Since you don't have a /bin/sh on your system, simply add a soft link in
your system's /bin dir, so that bin/sh -> /bin/bash.
I think it will then work fine.

Steve

a) change Makefile to use bash and diff, instead of sh and cmp

I hesitate to do this for fear of breaking other machines.
Does anyone know if bash is fully backward compatible with sh?
Likewise, diff --brief may not work on some platforms.
How can IBM justify not providing /bin/sh on their boxes?

I just realized an elegant workaround for this from an earlier thread,
that requires no change in LAMMPS.

Since you don't have a /bin/sh on your system, simply add a soft link in
your system's /bin dir, so that bin/sh -> /bin/bash.

my AIX experience is a bit dated, but AIX _does_ ship
with a /bin/sh, however it is compatible to some /bin/sh
implementation that predates the "bourne shell" standard.
the real "bourne shell" on AIX machines used to be in /bin/bsh
login shell on the other has was traditionally a korn shell /bin/ksh

the problem with bash is that it has a lot of "bashisms",
that are on by default, you have to set the environment
variable POSIXLY_CORRECT or 'set -o posix' to trigger
fully bourne shell compatible behavior (all compatible
extensions are still active though, i.e. even then you
need something like the debian a-shell /bin/dash to
test your shell scripts for portability on linux).

cheers,
    axel.