husseinaluie / FlowSieve

FlowSieve coarse-graining code base
https://flowsieve.readthedocs.io/en/latest/
Other
18 stars 9 forks source link

Errors, compute_KE_spectra_and_slopes.cpp:(.text+0x139a): undefined reference to functions, such as `potential_vel_from_F #38

Closed YanchongDuan closed 5 months ago

YanchongDuan commented 5 months ago

Hi Guys I tried to compile the code but failed due to the errors occuring in compute_KE_spectra_and_slopes.cpp. Several warnings about undefined reference to functions can be seen, as follows: /usr/bin/ld: Functions/compute_KE_spectra_and_slopes.o: in function compute_KE_spectra_and_slopes(std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, dataset const&, double)': compute_KE_spectra_and_slopes.cpp:(.text+0x114f): undefined reference totoroidal_vel_from_F(std::vector<double, std::allocator >&, std::vector<double, std::allocator >&, std::vector<double, std::allocator > const&, std::vector<double, std::allocator > const&, std::vector<double, std::allocator > const&, int, int, int, int, std::vector<bool, std::allocator > const&)' /usr/bin/ld: compute_KE_spectra_and_slopes.cpp:(.text+0x11a2): undefined reference to potential_vel_from_F(std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, int, int, int, int, std::vector<bool, std::allocator<bool> > const&)' /usr/bin/ld: compute_KE_spectra_and_slopes.cpp:(.text+0x1356): undefined reference totoroidal_vel_from_F(std::vector<double, std::allocator >&, std::vector<double, std::allocator >&, std::vector<double, std::allocator > const&, std::vector<double, std::allocator > const&, std::vector<double, std::allocator > const&, int, int, int, int, std::vector<bool, std::allocator > const&)' /usr/bin/ld: compute_KE_spectra_and_slopes.cpp:(.text+0x139a): undefined reference to `potential_vel_from_F(std::vector<double, std::allocator >&, std::vector<double, std::allocator >&, std::vector<double, std::allocator > const&, std::vector<double, std::allocator > const&, std::vector<double, std::allocator > const&, int, int, int, int, std::vector<bool, std::allocator > const&)' collect2: error: ld returned 1 exit status make: *** [Makefile:213: Case_Files/coarse_grain.x] Error 1

Could you kindly provide some help to fix this problem? Thanks!

bastorer commented 5 months ago

Hi!

Sorry to hear that you're running into problems compiling! Could you tell me which executable you were trying to make (what make command you called)? I'll try to reproduce the error from there :-)

YanchongDuan commented 5 months ago

Thanks for prompt reply. I just run make following your tutorial for install, namely, make Case_Files/coarse_grain.x

bastorer commented 5 months ago

Okay, thanks! I think when we did a bit of re-structuring of the files some of the compile commands were accidentally broken. I'm testing a fresh install now to check which make commands were affected, and will hopefully have a push soon to fix them! I'll keep you updated.

bastorer commented 5 months ago

Alright, I think this has been resolved now with the latest commits (ccb9f203c84b0fa0e7cb64fefe7c15f49c9fb0d2 and 0aaf0bdfd4a77ccbcd64f621a1e6d0000df03ebe). Can you do a git pull to update to the latest version and let me know if that works for you?

YanchongDuan commented 5 months ago

Thanks. It seems that the compiling problem has been resolved; now the coarse_grain.x file can be generated with : make Case_Files/coarse_grain.x However, when I try the tutorials for test, another problem occurs. Though the velocity_sample.nc file has been generated by generate_data.py file, when I perform the filtering step by ./coarse_grain.x --input_file velocity_sample.nc --filter_scales "1e3 15e3 50e3 100e3", no filtered .nc files can be found. Do you known probable reason for this? ps: the code was running on a laptop workstation for test purpose at the present stage.

bastorer commented 5 months ago

Hmm, that's curious. Is it giving you any error messages?

Could you change line 8 of Makefile to set DEBUG=2 and then re-run the same tutorial case and copy the terminal output here?

Running on a laptop should be fine. So long as you have the libraries installed (netcdf, mpi, etc), that should be all you need. The tutorials (except for the large Helmholtz one) should be small enough to run.

YanchongDuan commented 5 months ago

Thank you for the response. I also tried to compile the code in a supercomputer to check whether the problem still occurs. In addtion, following your suggestions (change line 8 of Makefile to set DEBUG=2 ), I compiled the code again, but the problem persists. The followings are the terminal outputs after performing the command: ./coarse_grain.x --input_file velocity_sample.nc --filter_scales "1e3 15e3 50e3 100e3"

Commandline flag "--input_file" got value "velocity_sample.nc" Commandline flag "--time" received no value - will use default "time" Commandline flag "--depth" received no value - will use default "depth" Commandline flag "--latitude" received no value - will use default "latitude" Commandline flag "--longitude" received no value - will use default "longitude" Commandline flag "--is_degrees" received no value - will use default "true" Commandline flag "--Nprocs_in_time" received no value - will use default "1" Commandline flag "--Nprocs_in_depth" received no value - will use default "1" Commandline flag "--zonal_vel" received no value - will use default "uo" Commandline flag "--merid_vel" received no value - will use default "vo" Commandline flag "--region_definitions_file" received no value - will use default "region_definitions.nc" Commandline flag "--region_definitions_dim" received no value - will use default "region" Commandline flag "--region_definitions_var" received no value - will use default "region_definition" Commandline flag "--filter_scales" got value "1e3 15e3 50e3 100e3" Filter scales (4) are: 1km, 15km, 50km, 100km,

Compiled at 13:09:49 on Mar 9 2024. Version 3.5.1

Using spherical coordinates. Reading in source data.

Attempting to read time from velocity_sample.nc Detected file format (3) is NC_FORMAT_NETCDF4 (3) 1 fill value = 1e+100 scale factor = 1 additive offset = 0 Land cover = 0% (1 water vs 0 land) (0 land converted to water) var_max = 0 var_min = 0 num zeros = 1

Attempting to read depth from velocity_sample.nc Detected file format (3) is NC_FORMAT_NETCDF4 (3) 1 fill value = 1e+100 scale factor = 1 additive offset = 0 Land cover = 0% (1 water vs 0 land) (0 land converted to water) var_max = 0 var_min = 0 num zeros = 1

Attempting to read latitude from velocity_sample.nc Detected file format (3) is NC_FORMAT_NETCDF4 (3) 128 fill value = 1e+100 scale factor = 1 additive offset = 0 Land cover = 0% (128 water vs 0 land) (0 land converted to water) var_max = 74414.1 var_min = -74414.1 num zeros = 0

Attempting to read longitude from velocity_sample.nc Detected file format (3) is NC_FORMAT_NETCDF4 (3) 128 fill value = 1e+100 scale factor = 1 additive offset = 0 Land cover = 0% (128 water vs 0 land) (0 land converted to water) var_max = 398438 var_min = 1562.5 num zeros = 0

Nproc(time, depth) = (1, 1)

Processor 0 has time color 0 and rank 0. Processor 0 has depth color 0 and rank 0. Processor 0 has time-depth color 0 and rank 0. Converting grid coordinates (if appropriate). Attempting to read uo from velocity_sample.nc Detected file format (3) is NC_FORMAT_NETCDF4 (3) 1 1 128 128 fill value = -1e+10 scale factor = 1 additive offset = 0 Land cover = 0% (16384 water vs 0 land) (0 land converted to water) var_max = 1.06231 var_min = -0.154889 num zeros = 0

Attempting to read vo from velocity_sample.nc Detected file format (3) is NC_FORMAT_NETCDF4 (3) 1 1 128 128 fill value = -1e+10 scale factor = 1 additive offset = 0 Land cover = 0% (16384 water vs 0 land) (0 land converted to water) var_max = 0.775559 var_min = -0.844836 num zeros = 0

Attempting to read uo from velocity_sample.nc has 4 dimensions of size 1 1 128 128 MPI rank 0 has sizes:a 1 1 128 128 scale factor = 1 additive offset = 0 fill value = -1e+10 Land cover = 0% (16384 water vs 0 land) region_definitions.nc does not exist. Computing geographic region areas Extending the domain to the poles Extending latitude to poles terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 18446744073709551552) >= this->size() (which is 0) Aborted (core dumped)

YanchongDuan commented 5 months ago

Just forget about the aforementioned problem. When I noticed the notes when compiling (i.e., when compiling, use the constants.hpp file provided in this directory), the basic tutorial works. So I think we could close this issue now.