[Wrf-users] Undefined reference to MPI_Cart_coords in WRF Postprocessor v2.2.1

Jan Ploski Jan.Ploski at offis.de
Wed May 23 08:26:31 MDT 2007


Hello,

I'd like to report a problem with the WRF Postproccesor v2.2.1 together 
with a workaround. I did not find a public Bugzilla or alike to post it, 
so here it goes...

Compilation/linking fails as shown below:

pgf90 -Mfree -O0 -g -Kieee -pc 32 -Ktrap=fp -C -byteswapio -o 
../../exec/wrfpost.exe getVariable_LINUX.o getIVariable_LINUX.o 
getVariableB_LINUX.o getIVariableN_LINUX.o getVariableRSM.o MASKS_mod.o 
SOIL_mod.o VRBLS2D_mod.o VRBLS3D_mod.o BNDLYR.o  BOUND.o  CALCAPE.o 
CALDWP.o  CALDRG.o CALHEL.o  CALLCL.o CALMCVG.o  CALMXW.o  CALPOT.o 
CALPW.o CALRH.o  CALRCH.o CALSTRM.o CALTAU.o CALTHTE.o CALVIS.o CALVOR.o 
CALWXT.o CALWXT_RAMER.o CALWXT_BOURG.o CALWXT_REVISED.o CALWXT_EXPLICIT.o 
CALWXT_DOMINANT.o CLDRAD.o  CLMAX.o COLLECT.o  COLLECT_LOC.o DEWPOINT.o 
FDLVL.o  FIXED.o  FRZLVL.o  FRZLVL2.o GET_BITS.o  GRIBIT.o INITPOST.o 
LFMFLD.o  INITPOST_BIN.o MISCLN.o MIXLEN.o MDL2P.o MDLFLD.o 
MPI_FIRST_LINUX.o  MPI_LAST.o NGMFLD.o NGMSLP.o  OTLFT.o OTLIFT.o 
SLP_new.o SLP_NMM.o EXCH_LINUX.o PARA_RANGE.o  POSTDATA.o  PROCESS.o 
INITPOST_NMM.o EXCH2_LINUX.o READCNTRL.o  SCLFLD.o  SERVER.o 
SETUP_SERVERS.o SURFCE.o SPLINE.o  TABLE.o  TABLEQ.o  TRPAUS.o  TTBLEX.o 
WETBULB.o WRFPOST.o INITPOST_NMM_BIN.o CALMICT.o MICROINIT.o GPVS.o 
MDL2SIGMA.o ETCALC.o CANRES.o CALGUST.o WETFRZLVL.o SNFRAC.o MDL2AGL.o 
INITPOST_RSM.o AVIATION.o TIMEF.o DEALLOCATE.o 
/home/tpetrol/91_wrf_postprocessor/WRFV2/frame/module_internal_header_util.o 
/home/tpetrol/91_wrf_postprocessor/WRFV2/frame/pack_utils.o 
/home/tpetrol/91_wrf_postprocessor/WRFV2/frame/wrf_debug.o 
/home/tpetrol/91_wrf_postprocessor/WRFV2/frame/module_wrf_error.o 
/home/tpetrol/91_wrf_postprocessor/WRFV2/main/libwrflib.a 
-L/home/tpetrol/91_wrf_postprocessor/WRFV2/external/io_netcdf -lwrfio_nf 
-L/home/tpetrol/91_wrf_postprocessor/WRFV2/external/RSL_LITE -lrsl_lite 
-L/home/tpetrol/91_wrf_postprocessor/WRFV2/external/io_grib1 -lio_grib1 
-L/home/tpetrol/91_wrf_postprocessor/WRFV2/external/io_grib_share 
-lio_grib_share -L/home/tpetrol/91_wrf_postprocessor/WRFV2/external/io_int 
-lwrfio_int 
-L/home/tpetrol/91_wrf_postprocessor/WRFV2/external/esmf_time_f90 
-lesmf_time -L/export/lnx280/wd20dj/netcdf/lib -lnetcdf ../../lib/libw3.a 
../../lib/libmpi.a -L/opt/netcdf-3.6.1-pgcc/lib -lnetcdf
/home/tpetrol/91_wrf_postprocessor/WRFV2/external/RSL_LITE/librsl_lite.a(period.o): 
In function `rsl_lite_init_period_':
period.c:(.text+0x1ea): undefined reference to `MPI_Cart_coords'
/home/tpetrol/91_wrf_postprocessor/WRFV2/external/RSL_LITE/librsl_lite.a(period.o): 
In function `rsl_lite_pack_period_x_':
period.c:(.text+0x4db): undefined reference to `MPI_Cart_coords'
/home/tpetrol/91_wrf_postprocessor/WRFV2/external/RSL_LITE/librsl_lite.a(period.o): 
In function `rsl_lite_exch_period_x_':
period.c:(.text+0x172b): undefined reference to `MPI_Cart_coords'

The workaround is to edit mpi_c.c and add a dummy definition of 
MPI_Cart_coords:

diff ~/92_wrf_postprocessor/wrfpostprocV2/lib/wrfmpi_stubs/mpi_c.c 
~/91_wrf_postprocessor/wrfpostprocV2/lib/wrfmpi_stubs/mpi_c.c
234,239d233
< /* JPL, 2007-05-23 - added to fix an undefined reference error during 
linking */
< int MPI_Cart_coords ( MPI_Comm comm, int rank, int maxdims, int *coords 
)
< {
<   return 0;
< }
< 

(then recompile)

The rationale for the above workaround:

Normally the function MPI_Cart_coords is provided by libmpich.a, the core 
MPI library. My impression is that the postprocessor code does not use the 
MPI functions, but it has to link them in anyway for some mysterious 
reason (i.e. the linker needs them, not the programs). The postprocessor 
package includes a library named libmpi.a which contains "dummy" 
implementations of various MPI functions (mpi_c.c is part of that 
library). That's why I just inserted the missing function there and hope 
that it won't cause problems.

Maybe the developers of the postprocessor code can validate the above 
theory and incorporate a fix into a later release.

Best regards,
Jan Ploski

--
Dipl.-Inform. (FH) Jan Ploski
OFFIS
Betriebliches Informationsmanagement
Escherweg 2  - 26121 Oldenburg - Germany
Fon: +49 441 9722 - 184 Fax: +49 441 9722 - 202
E-Mail: Jan.Ploski at offis.de - URL: http://www.offis.de



More information about the Wrf-users mailing list