ImperialCollegeLondon / virtual_ecosystem

This repository is the home for the codebase for the Virtual Ecosystem project.
https://virtual-ecosystem.readthedocs.io
BSD 3-Clause "New" or "Revised" License
9 stars 1 forks source link

Unable to run and rerun ve_example #543

Closed hrlai closed 1 week ago

hrlai commented 1 week ago

Hi there, I managed to get pass the installation steps and then tried to run the example. However, for the following step:

%%bash
ve_run /tmp/ve_example/config \
    --out /tmp/ve_example/out \
    --logfile /tmp/ve_example/out/logfile.log \
    --progress \

I ended up with memory/access issue:

Starting Virtual Ecosystem simulation.
* Logging to: ve_example/out/logfile.log
* Loading configuration
* Saved compiled configuration: ve_example/out/vr_full_model_configuration.toml
* Built core model components
* Initial data loaded
* Models initialised: animals, plants, litter, hydrology, abiotic_simple, soil
* Starting simulation
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 24/24 [00:05<00:00,  4.27it/s]
* Simulation completed
Segmentation fault (core dumped)

Then when I tried the same command again, it seemed to be prevented by some generated out files:

Starting Virtual Ecosystem simulation.
* Logging to: ve_example/out/logfile.log
* Loading configuration
* Saved compiled configuration: ve_example/out/vr_full_model_configuration.toml
* Built core model components
* Initial data loaded
* Models initialised: animals, plants, litter, hydrology, abiotic_simple, soil
* Starting simulation
  0%|                                                                                                                                                                   | 0/24 [00:00<?, ?it/s]Traceback (most recent call last):
  File "/home/hrlai/Documents/collaboration/virtual_ecosystem/.venv/bin/ve_run", line 8, in <module>
    sys.exit(ve_run_cli())
  File "/home/hrlai/Documents/collaboration/virtual_ecosystem/.venv/lib/python3.10/site-packages/virtual_ecosystem/entry_points.py", line 224, in ve_run_cli
    ve_run(
  File "/home/hrlai/Documents/collaboration/virtual_ecosystem/.venv/lib/python3.10/site-packages/virtual_ecosystem/main.py", line 275, in ve_run
    outfile_path = data.output_current_state(
  File "/home/hrlai/Documents/collaboration/virtual_ecosystem/.venv/lib/python3.10/site-packages/virtual_ecosystem/core/data.py", line 467, in output_current_state
    self.save_timeslice_to_netcdf(out_path, variables_to_save, time_index)
  File "/home/hrlai/Documents/collaboration/virtual_ecosystem/.venv/lib/python3.10/site-packages/virtual_ecosystem/core/data.py", line 402, in save_timeslice_to_netcdf
    check_outfile(output_file_path)
  File "/home/hrlai/Documents/collaboration/virtual_ecosystem/.venv/lib/python3.10/site-packages/virtual_ecosystem/core/utils.py", line 58, in check_outfile
    raise to_raise
virtual_ecosystem.core.exceptions.ConfigurationError: A file in the user specified output folder (ve_example/out) already makes use of the specified output file name (continuous_state00001.nc), this file should either be renamed or deleted!
  0%|   

Should I manually remove the files including continuous_state00001.nc etc.? If so, should this be documented...? Thanks in advance!

Cheers, Hao Ran

Operating System: Ubuntu 22.04.4 LTS
Kernel: Linux 6.8.0-40-generic Architecture: x86-64

jacobcook1995 commented 1 week ago

Yes those files are temporary outputs that are supposed to get cleaned up at the end of the run, so if a run fails midway through the files end up sticking around and need to be manually deleted. This definitely should be added as a note in the documentation!

When you delete all the continuous_statexxxxx.nc files and try to run the example simulation again does it run okay? (if not there may be a bigger issue here)

hrlai commented 1 week ago

Thanks! Removing all the .nc files (including all_continuous-data.nc) helped.

I still get segfault error in Ubuntu, but it ran on my Windows machine. I'm closing this now because this seems to be a system-specific issue, not of the package. I'll keep you all posted re: Ubuntu.