32-bit vs 64-bit, compile & link problems

I am trying to port a version of MOM3 that successfully compiles on
the following 32-bit Linux machine (running SUSE 9.x):

[snowmiser] ~/MOM_3.0/EXP/NOW/MOM_UPDATES 405> uname -a
Linux snowmiser 2.6.5-7.151-smp #1 SMP Fri Mar 18 11:31:21 UTC 2005 i686 i686 i386 GNU/Linux

to the following 64-bit Linux machine (running gentoo r14 2.6.9).
[portage]> uname -a
Linux portage 2.6.9-gentoo-r14 #1 SMP Wed Feb 23 10:47:14 EST 2005 x86_64 AMD Opteron™ Processor 244 AuthenticAMD GNU/Linux

On snowmiser it compiled with pgf90 v5.2-4 (32-bit). This code was successfully ported from an SGI.

On portage we have tried using the evaluation copies of pgf90 6.0-4 and 5.2-4 (64-bit) and have consitently found errors. In all cases, the
following options were used:

-r8 -i4 -fast -time -Minfo=all -Minform=severe -byteswapio -v

The first problematic file is also the first one it tries to compile. This
contains software modules which call certain intrinsics. The output for the compile step of the problematic file (mpp.F90) looks like (using the verbose option) for the compile step (-c option):

_mpp.F90

/usr/pgi/linux86-64/6.0/bin/pgf901 mpp.F90 -opt 2 -inform severe -nohpf -nostatic -x 19 0x400000 -quad -x 59 4 -x 15 2 -x 49 0x400004 -x 51 0x20 -x 57 0x4c -x 58 0x10000 -x 124 0x1000 -x 57 0xfb0000 -x 58 0x78031040 -x 70 0x6c00 -x 48 4608 -x 49 0x100 -x 120 0x200 -stdinc /usr/pgi/linux86-64/6.0/include:/usr/local/include:/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.3/include:/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.3/include:/usr/include -def unix-def __unix -def unix -def linux -def __linux -def linux -def inline= -def NO_INLINE -def __NO_MATH_INLINES -def x86_64 -def LONG_MAX=9223372036854775807L -def ‘SIZE_TYPE=unsigned long int’ -def ‘PTRDIFF_TYPE=long int’ -def _THROW= -def amd64 -idir /usr/include/ -idir /usr/include/ -def snapshots -def energy_analysis -def levitus_ic -def read_my_kmt -def obc_south -def obc_north -def obc_west -def time_varying_sbc_data -def nowgrid -def read_lookup -def constvmix -def robert_time_filter -def tracer_horz_laplacian -def tracer_horz_mix_const -defecmwf -def velocity_horz_laplacian -def velocity_horz_mix_var -def am_cosine -def sgi -def ramdrive -def generate_a_grid -def read_my_kmt -def fill_perimeter_violations -def fill_isolated_cells -def smooth_topo -def round_shallow -def stream_function -def sf_9_point -def use_netCDF -preprocess -freeform -i4 -x 125 2 -x 70 2 -vect 48 -x 124 0x8 -x 0 319 -output /tmp/pgf90aaaaasqgab.ilm
PGF90/any Linux/x86-64 6.0-4: compilation successful

/usr/pgi/linux86-64/6.0/bin/pgf902 /tmp/pgf90aaaaasqgab.ilm -fn mpp.F90 -opt 2 -inform severe -x 51 0x20 -x 119 0xa10000 -x 122 0x40 -x 123 0x1000-x 127 4 -x 19 0x400000 -quad -x 120 0x80000000 -x 59 4 -y 80 0x1000 -x 80 0x10800000 -x 124 0x1400 -y 15 2 -y 80 0x1000 -x 80 0x10800000 -x 57 0x3b0000 -x 58 0x48000000 -x 49 0x100 -x 120 0x200 -astype 0 -x 121 1 -x 124 1 -x 9 1 -x 42 0x14200000 -x 72 0x1 -x 136 0x11 -x 92 1 -x 0 1 -x 0 63 -cmdline ‘+pgf90 /tmp/pgf90aaaaasqgab.ilm -L/usr/lib/gcc-lib/x86_64-pc-linux-gnu/3.4.3 -v -r8 -i4 -fast -time -Minfo=all -Minform=severe -byteswapio-Mbounds -Dsnapshots -Denergy_analysis -Dlevitus_ic -Dread_my_kmt -Dobc_south -Dobc_north -Dobc_west -Dtime_varying_sbc_data -Dnowgrid -Dread_lookup -Dconstvmix -Drobert_time_filter -Dtracer_horz_laplacian -Dtracer_horz_mix_const -Decmwf -Dvelocity_horz_laplacian -Dvelocity_horz_mix_var -Dam_cosine -Dsgi -Dramdrive -Dgenerate_a_grid -Dread_my_kmt -Dfill_perimeter_violations -Dfill_isolated_cells -Dsmooth_topo -Dround_shallow -Dstream_function -Dsf_9_point -Duse_netCDF -L/usr/lib -lnetcdf -L/usr/lib -ludunits -I/usr/include/ -I/usr/include/ -c’ -asm /tmp/pgf90baaaasqgab.sm
PGF90/x86 Linux/x86-64 6.0-4: compilation successful

/usr/pgi/linux86-64/6.0/bin/pgsmart -o /tmp/pgf90caaaasqgab.s /tmp/pgf90baaaasqgab.sm

/usr/bin/as /tmp/pgf90caaaasqgab.s -I/usr/include/ -I/usr/include/ -o mpp.o
/tmp/pgf90caaaasqgab.s: Assembler messages:
/tmp/pgf90caaaasqgab.s:440: Error: junk at end of line, first unrecognized character is :' /tmp/pgf90caaaasqgab.s:2419: Error: junk at end of line, first unrecognized character is :’
pgf90-Fatal-Nasm completed with exit code 1

Unlinking /tmp/pgf90aaaaasqgab.ilm
Unlinking /tmp/pgf90baaaasqgab.sm
Unlinking /tmp/pgf90caaaasqgab.s

So there looks like there is a problem when the file is converted
to assembly language.

When it time to link the *.o files, the output looks like:


=> linking …
pgf90 addobc.o adv_vel.o atmos.o baroclinic.o barotropic.o bcest.o blkdta.o blmixi.o buoy_track.o calc_psgrad.o cavitating.o checks.o cobc.o cobc2.o congrad.o continuity.o convect.o convert.o datamod.o delsq.o denscoef.o diag_energy.o diag_gyre.o diag_ice_snap.o diag_ice_timeavg.o diag_initial.o diag_masks.o diag_merd_basin.o diag_mw_inside.o diag_mw_outside.o diag_nor1st.o diag_out_scalar.o diag_out_snap.o diag_out_timavg.o diag_out_xy.o diag_out_xyz.o diag_out_yz.o diag_ptraj.o diag_region.o diag_rhoterms.o diag_stab.o diag_termbal.o diag_vmix.o diag_xbt.o diffusion.o driver.o expl_freesurf.o fast_fir.o filfir.o filt.o filtr.o filuv.o findex.o fluxx.o fluxy.o forcing.o freedrift.o friccoeffgran.o gasbc.o getriver.o gosbc.ogranvisccoef.o grids.o heatfluxes.o hmixc.o ice.o impl_freesurf.o implq.o invtri.o iomngr.o isopyc.o kppmix.o libpatch.o loadmw.o mom.o mom3mpp.o mpp_domains.o mpp_io.o neptune.o nonconstdiff.o nowsubs.o odam.o par_get.o poisson.o ppmix.o r_time_filter.o restio.o rinum.o rotation.o sbcmod.o setatm.o setice.o setocn.o setriver.o setsff.o setvbc.o size_check.o smagnl.o state.o statekpp.o switch.o task_simulator.o tcmix.o thermodynamic.o timeinterp.o timer.o tmngr.o tmngr_mod.o topog.o tracer.o tracer_adv_flx.o unesco_density.o util.o uvsolve.o vmix1d.o vmixc.o xctdbc_mod.o xland.o xobc_mod.o xsponge_mod.o znowgrid.o -L/usr/lib/gcc-lib/x86_64-pc-linux-gnu/3.4.3 -v -L/usr/lib -lnetcdf -L/usr/lib -ludunits -o NowIce1

/usr/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.3/crtbegin.o /usr/pgi/linux86-64/6.0/lib/f90main.o -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 addobc.o adv_vel.o atmos.o baroclinic.o barotropic.o bcest.o blkdta.o blmixi.o buoy_track.o calc_psgrad.o cavitating.o checks.o cobc.o cobc2.o congrad.o continuity.o convect.o convert.o datamod.o delsq.o denscoef.o diag_energy.o diag_gyre.o diag_ice_snap.o diag_ice_timeavg.o diag_initial.o diag_masks.o diag_merd_basin.o diag_mw_inside.o diag_mw_outside.o diag_nor1st.o diag_out_scalar.o diag_out_snap.o diag_out_timavg.o diag_out_xy.o diag_out_xyz.o diag_out_yz.o diag_ptraj.o diag_region.o diag_rhoterms.o diag_stab.o diag_termbal.o diag_vmix.o diag_xbt.o diffusion.o driver.o expl_freesurf.o fast_fir.o filfir.o filt.o filtr.o filuv.o findex.o fluxx.o fluxy.o forcing.o freedrift.o friccoeffgran.o gasbc.o getriver.o gosbc.o granvisccoef.o grids.o heatfluxes.o hmixc.o ice.o impl_freesurf.o implq.o invtri.o iomngr.o isopyc.o kppmix.o libpatch.o loadmw.o mom.o mom3mpp.o mpp_domains.o mpp_io.o neptune.o nonconstdiff.o nowsubs.o odam.o par_get.o poisson.o ppmix.o r_time_filter.o restio.o rinum.o rotation.o sbcmod.o setatm.o setice.o setocn.o setriver.o setsff.o setvbc.o size_check.o smagnl.o state.o statekpp.o switch.o task_simulator.o tcmix.o thermodynamic.o timeinterp.o timer.o tmngr.o tmngr_mod.o topog.o tracer.o tracer_adv_flx.o unesco_density.o util.o uvsolve.o vmix1d.o vmixc.o xctdbc_mod.o xland.o xobc_mod.o xsponge_mod.o znowgrid.o -o NowIce1 -L/usr/lib/gcc-lib/x86_64-pc-linux-gnu/3.4.3 -L/usr/lib -L/usr/lib -L/usr/pgi/linux86-64/6.0/lib -L/usr/lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.3 -rpath /usr/pgi/linux86-64/6.0/lib -lnetcdf -ludunits -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lc -lnspgc -lpgc -lm -lgcc -lc -lgcc /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.3/crtend.o /usr/lib64/crtn.o

followed by numerous error messages like:

driver.o(.text+0x49): In function MAIN_': : undefined reference to mpp_mod_mpp_init
driver.o(.text+0x6c): In function MAIN_': : undefined reference to mpp_mod_mpp_npes_’_

These errors are because the file mpp.o is never created, and that
has something to do with the problem of the assembly file having
errors.

Have there been other problems of this type? I guessing that
there is a compile-time library that is not being read or read correctly,
since the assembly language errors seem to be the symptom. Or
maybe it is a more basic conversion error?

Hi t_arbetter,

This most likely a problem with our code generator. Compiling these two files with ‘-O0’ instead of ‘-fast’ should work around the issue. We’ll investigate and should have a fix in a future release.

Thanks,
Mat

The code compiled successfully with the -O0 command.

Thanks for your quick reply!

– t