PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

compiling 32-bit for MPI

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
cablesb



Joined: 21 Jan 2010
Posts: 33

PostPosted: Thu Sep 06, 2012 9:25 am    Post subject: compiling 32-bit for MPI Reply with quote

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!
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5952
Location: The Portland Group Inc.

PostPosted: Thu Sep 06, 2012 10:59 am    Post subject: Reply with quote

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:
Code:
$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.
Code:

/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

Code:

% $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
Back to top
View user's profile
cablesb



Joined: 21 Jan 2010
Posts: 33

PostPosted: Thu Sep 06, 2012 11:41 am    Post subject: Reply with quote

Splitting the linking and compiling did the trick. Thanks very much!
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group