compiling 32-bit for MPI

I have inherited a FORTRAN code that I need to compile in 32-bit mode. I have been able to create a serial executabel, but I need mpi. I try:

$PGI/linux86/2012/mpi/mpich/bin/mpif90 -tp=piii testmp.f90

I get the error:

/opt/pgi/linux86/2012/mpi/mpich/lib/libmpich.a(p4_utils.o): In function p4_usclock': /home/sw/cdk/cdk/mpich-1.2.7/mpich-1.2.7/mpid/ch_p4/p4/lib/p4_utils.c:1473: undefined reference to __mth_i_dfloatux’

I found a __mth_i_dfloatux in /opt/pgi/linux86/2012/lib/libpgsse2.a. But even when I add linker flags:

-L/opt/pgi/linux86/2012/lib -lpgsse2

I get the same error. The compiler still can’t find this function.

Right now, moving to 64-bit is not an option. Anyone know what I can do to get this thing to compile? BTW, after some tests, this seems to be problem with any 32-bit compilation, not just with this particular code.

Thanks!

Hi cablesb,

The first thing to try is to see if you can use “-m32” instead of “-tp=piii”. If the issue really is just 32-btis versus 64, then “-m32” should work and you don’t need to worry about SSE. “-tp=piii”, specifically targets a very old Pentium III processor that pre-dates SSE.

As for the the undefined reference, the mpif90 driver is not putting the SSE library in the correct order, hence it’s symbols aren’t being found by the linker. Adding the verbose flag ("-v") shows the linker options:

$PGI/linux86/2012/mpi/mpich/bin/mpif90 -tp=piii test.f90 -o test.out -L/usr/pgi/linux86/12.9/lib -lpgsse2 -v
...
/usr/bin/ld /usr/lib/crt1.o /usr/lib/crti.o /usr/pgi/linux86/12.9/lib/trace_init.o /usr/lib/gcc/x86_64-redhat-linux/4.1.2/32/crtbegin.o /usr/pgi/linux86/12.9/lib/initmp.o /usr/pgi/linux86/12.9/lib/f90main.o -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/pgi/linux86/12.9/lib/pgi.ld -L/usr/pgi/linux86/2012/mpi/mpich/lib -L/usr/pgi/linux86/12.9/lib -L/usr/pgi/linux86/12.9/lib -L/usr/lib -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/32 test.o -lpgsse2 -lmpichf90 -lmpich -lrt -rpath /usr/pgi/linux86/12.9/mpi/mpich/lib -rpath /usr/pgi/linux86/12.9/mpi/mpich/lib -rpath /usr/pgi/linux86/12.9/lib -o test.out -L/usr/pgi/linux86/12.9/mpi/mpich/lib -L/usr/pgi/linux86/12.9/mpi/mpich/lib -lfmpich -lmpichf90 -lmpich -lpthread -lpgmp -lnuma -lpthread -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lpgsse1 -lnspgc -lpgc -lrt -lpthread -lm -lgcc -lc -lgcc /usr/lib/gcc/x86_64-redhat-linux/4.1.2/32/crtend.o /usr/lib/crtn.o

So you’re three option’s here are to either manually call the linker putting “-lpgsse2” with the other PGI libs, split the compilation from the link steps, or build your own MPICH libraries targeting a PIII.

/usr/bin/ld /usr/lib/crt1.o /usr/lib/crti.o /usr/pgi/linux86/12.9/lib/trace_init.o /usr/lib/gcc/x86_64-redhat-linux/4.1.2/32/crtbegin.o /usr/pgi/linux86/12.9/lib/initmp.o /usr/pgi/linux86/12.9/lib/f90main.o -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/pgi/linux86/12.9/lib/pgi.ld -L/usr/pgi/linux86/2012/mpi/mpich/lib -L/usr/pgi/linux86/12.9/lib -L/usr/pgi/linux86/12.9/lib -L/usr/lib -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/32 test.o  -lmpichf90 -lmpich -lrt -rpath /usr/pgi/linux86/12.9/mpi/mpich/lib -rpath /usr/pgi/linux86/12.9/mpi/mpich/lib -rpath /usr/pgi/linux86/12.9/lib -o test.out -L/usr/pgi/linux86/12.9/mpi/mpich/lib -L/usr/pgi/linux86/12.9/mpi/mpich/lib -lfmpich -lmpichf90 -lmpich -lpthread -lpgmp -lnuma -lpthread -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lpgsse1 -lpgsse2 -lnspgc -lpgc -lrt -lpthread -lm -lgcc -lc -lgcc /usr/lib/gcc/x86_64-redhat-linux/4.1.2/32/crtend.o /usr/lib/crtn.o



% $PGI/linux86/2012/mpi/mpich/bin/mpif90 -tp=piii test.f90 -c
% $PGI/linux86/2012/mpi/mpich/bin/mpif90 test.o -o test.out -m32

Hope this helps,
Mat

Splitting the linking and compiling did the trick. Thanks very much!