wrf-model / WPS

The official repository for the WRF Preprocessing System (WPS)
205 stars 162 forks source link

WPS build fails when WRF was compiled with an 'smpar' option #110

Open mgduda opened 5 years ago

mgduda commented 5 years ago

When WRF was compiled with an smpar option, the WRF I/O API library contains references to OpenMP libraries (e.g., 'GOMP' with the GNU compilers). Because the WPS doesn't support an smpar option and therefore never links the OpenMP library, the build of geogrid.exe and metgrid.exe will fail with errors like:

gfortran   -o geogrid.exe cio.o wrf_debug.o bitarray_module.o constants_module.o module_stringutil.o geogrid.o gridinfo_module.o hash_module.o interp_module.o list_module.o llxy_module.o misc_definitions_module.o module_debug.o module_map_utils.o output_module.o parallel_module.o process_tile_module.o proc_point_module.o queue_module.o read_geogrid.o smooth_module.o source_data_module.o \
        /dev/shm/WPS/../WRF/frame/module_driver_constants.o \
        /dev/shm/WPS/../WRF/frame/pack_utils.o /dev/shm/WPS/../WRF/frame/module_machine.o \
        /dev/shm/WPS/../WRF/frame/module_internal_header_util.o \
        -I/dev/shm/WPS/../WRF/external/io_netcdf -I/dev/shm/WPS/../WRF/external/io_grib_share -I/dev/shm/WPS/../WRF/external/io_grib1 -I/dev/shm/WPS/../WRF/external/io_int -I/dev/shm/WPS/../WRF/inc -I/sysdisk1/duda/Thursday_test/local/include \
        -L/dev/shm/WPS/../WRF/external/io_grib1 -lio_grib1 -L/dev/shm/WPS/../WRF/external/io_grib_share -lio_grib_share -L/dev/shm/WPS/../WRF/external/io_int -lwrfio_int -L/dev/shm/WPS/../WRF/external/io_netcdf -lwrfio_nf -L/sysdisk1/duda/Thursday_test/local/lib -lnetcdff -lnetcdf \

/dev/shm/WPS/../WRF/external/io_netcdf/libwrfio_nf.a(wrf_io.o): In function `__ext_ncd_support_routines_MOD_transpose._omp_fn.0':
wrf_io.f:(.text+0x77): undefined reference to `GOMP_loop_runtime_start'
wrf_io.f:(.text+0x463): undefined reference to `GOMP_loop_runtime_next'
wrf_io.f:(.text+0x470): undefined reference to `GOMP_loop_end_nowait'
/dev/shm/WPS/../WRF/external/io_netcdf/libwrfio_nf.a(wrf_io.o): In function `__ext_ncd_support_routines_MOD_transpose._omp_fn.1':
wrf_io.f:(.text+0x517): undefined reference to `GOMP_loop_runtime_start'
wrf_io.f:(.text+0x901): undefined reference to `GOMP_loop_runtime_next'
wrf_io.f:(.text+0x90e): undefined reference to `GOMP_loop_end_nowait'
/dev/shm/WPS/../WRF/external/io_netcdf/libwrfio_nf.a(wrf_io.o): In function `__ext_ncd_support_routines_MOD_transpose._omp_fn.2':
wrf_io.f:(.text+0x9b5): undefined reference to `GOMP_loop_runtime_start'
wrf_io.f:(.text+0xd7b): undefined reference to `GOMP_loop_runtime_next'
wrf_io.f:(.text+0xd88): undefined reference to `GOMP_loop_end_nowait'
/dev/shm/WPS/../WRF/external/io_netcdf/libwrfio_nf.a(wrf_io.o): In function `__ext_ncd_support_routines_MOD_transpose._omp_fn.3':
wrf_io.f:(.text+0xe25): undefined reference to `GOMP_loop_runtime_start'
wrf_io.f:(.text+0x11e9): undefined reference to `GOMP_loop_runtime_next'
wrf_io.f:(.text+0x11f6): undefined reference to `GOMP_loop_end_nowait'
/dev/shm/WPS/../WRF/external/io_netcdf/libwrfio_nf.a(wrf_io.o): In function `__ext_ncd_support_routines_MOD_transpose._omp_fn.4':
wrf_io.f:(.text+0x1295): undefined reference to `GOMP_loop_runtime_start'
wrf_io.f:(.text+0x1685): undefined reference to `GOMP_loop_runtime_next'
wrf_io.f:(.text+0x1692): undefined reference to `GOMP_loop_end_nowait'
zephyr213 commented 4 years ago

I got the similar error building WPS. Neither dmpar nor dm+sm of WRF build works. I finally built WRF with serial, then the geogrid and metgrid can be built.

weiwangncar commented 4 years ago

This may not be ideal, but for most purposes, serially compiled WPS should work pretty well.

yriveiro commented 4 years ago

Same problem here, WRF 4.2.1 with dm+sm:

#22 28.20 /usr/sbin/ld: wrf_io.f:(.text+0x35c7): undefined reference to `GOMP_loop_maybe_nonmonotonic_runtime_next'
#22 28.20 /usr/sbin/ld: /var/lib/wrf/external/io_netcdf/libwrfio_nf.a(wrf_io.o): in function `__ext_ncd_support_routines_MOD_transpose._omp_fn.11':
#22 28.20 wrf_io.f:(.text+0x3a95): undefined reference to `GOMP_loop_maybe_nonmonotonic_runtime_start'
hermannschwaerzlerUIBK commented 4 years ago

I had a similar problem after compiling WRF 4.1 with an Intel compiler using option 14 (smpar).

My solution/workaround was this:

  1. ./clean
  2. ./configure # I chose option "17 ... Intel Compiler (serial)"
  3. edit configure.wps by adding -qopenmp at the end of the lines that set WRFLIB (after -lnetcdff -lnetcdf_)
  4. ./compile >& log.compile

Voila: everything is compiled as expected.

MichaelLaufer commented 4 years ago

@mgduda @hermannschwaerzlerUIBK I am seeing this as well with WRF 4.2 compiled with dm+sm. While compiling with dmpar works just fine.

Any idea as to the root cause of this? Has this worked in the past? Can we add logic to check the WRF configure.wrf file to see if it was compiled with smpar or dm+sm and make the changes?

Is this the place that would need changing in the configure script? Config.pl location

B4dWo1f commented 3 years ago
3. edit _configure.wps_ by adding **-qopenmp** at the end of the lines that set WRF_LIB (after _-lnetcdff -lnetcdf_)

I got an error suggesting that it was -fopenmp rather than "-qopenmp". It worked for me leaving line 107 in configure.wps like this:

-L$(NETCDF)/lib -lnetcdff -lnetcdf -fopenmp
serbinsh commented 2 years ago

In the chance that this is helpful, I am also running into a bunch of "undefined reference to " errors when trying to build WPS serial, parallel and non grib

However, looking at the comments above I tried editing

WRF_LIB         =       -L$(WRF_DIR)/external/io_grib1 -lio_grib1 \
                        -L$(WRF_DIR)/external/io_grib_share -lio_grib_share \
                        -L$(WRF_DIR)/external/io_int -lwrfio_int \
                        -L$(WRF_DIR)/external/io_netcdf -lwrfio_nf \
                        -L$(NETCDF)/lib -lnetcdff -lnetcdf

to

WRF_LIB         =       -L$(WRF_DIR)/external/io_grib1 -lio_grib1 \
                        -L$(WRF_DIR)/external/io_grib_share -lio_grib_share \
                        -L$(WRF_DIR)/external/io_int -lwrfio_int \
                        -L$(WRF_DIR)/external/io_netcdf -lwrfio_nf \
                        -L$(NETCDF)/lib -lnetcdff -lnetcdf -fopenmp

And it compiled serial, parallel and with grib2. I still need to test it but the exe compiles

kdo037 commented 3 months ago
  • ./clean
  • ./configure # I chose option "17 ... Intel Compiler (serial)"
  • edit configure.wps by adding -qopenmp at the end of the lines that set WRFLIB (after -lnetcdff -lnetcdf_)
  • ./compile >& log.compile

It works. Thanks a lot!