UMEP-dev / SuPy

SUEWS that speaks Python
https://supy.readthedocs.io/
GNU General Public License v3.0
13 stars 7 forks source link

run_supy() RuntimeError: SUEWS kernel error #70

Closed markhallows1 closed 1 year ago

markhallows1 commented 1 year ago

I am running supy (version 2022.2.17) on an AWS instance using 2 CPU and 8GB RAM and system version:

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"

My attempt to run run_supy() in either serial or parallel mode using the following lines produces "RuntimeError: SUEWS kernel error":

sp.check_state(df_state_spinup)
sp.check_forcing(df_forcing_spinup)
df_spinup_res, df_spinup_final = sp.run_supy(df_forcing_spinup, df_state_spinup, serial_mode=False)
2022-10-26 12:40:20,873 - SuPy - INFO - SuPy is validating `df_state`...
2022-10-26 12:40:22,510 - SuPy - INFO - All checks for `df_state` passed!
2022-10-26 12:40:22,511 - SuPy - INFO - SuPy is validating `df_forcing`...
2022-10-26 12:40:22,535 - SuPy - INFO - All checks for `df_forcing` passed!
2022-10-26 12:40:22,536 - SuPy - INFO - ====================
2022-10-26 12:40:22,538 - SuPy - INFO - Simulation period:
2022-10-26 12:40:22,540 - SuPy - INFO -   Start: 2019-10-16 00:05:00
2022-10-26 12:40:22,541 - SuPy - INFO -   End: 2019-12-31 23:00:00
2022-10-26 12:40:22,543 - SuPy - INFO - 
2022-10-26 12:40:22,544 - SuPy - INFO - No. of grids: 15
2022-10-26 12:40:22,545 - SuPy - INFO - SuPy is running in parallel mode
---------------------------------------------------------------------------
RemoteTraceback                           Traceback (most recent call last)
RemoteTraceback: 
"""
ValueError: failed to initialize intent(inout) array -- input 'O' not compatible to 'd'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/supy/_run.py", line 121, in suews_cal_tstep_multi
    res_suews_tstep_multi = sd.suews_cal_multitsteps(**dict_input)
ValueError: failed in converting 70th argument `icefrac' of suews_driver.suews_driver.suews_cal_multitsteps to C/Fortran array

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/supy/_run.py", line 371, in run_supy_ser
    for input_grid in list_input
  File "/opt/conda/lib/python3.7/site-packages/supy/_run.py", line 371, in <listcomp>
    for input_grid in list_input
  File "/opt/conda/lib/python3.7/site-packages/supy/_run.py", line 126, in suews_cal_tstep_multi
    with open("problems.txt", "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'problems.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/multiprocess/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/opt/conda/lib/python3.7/site-packages/multiprocess/pool.py", line 47, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/opt/conda/lib/python3.7/site-packages/supy/_run.py", line 417, in run_save_supy
    df_forcing_tstep, df_state_init_m, save_state, n_yr
  File "/opt/conda/lib/python3.7/site-packages/supy/_run.py", line 376, in run_supy_ser
    raise RuntimeError("SUEWS kernel error")
RuntimeError: SUEWS kernel error
"""

The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
<ipython-input-27-de98ae1444a9> in <module>
      2 sp.check_state(df_state_spinup)
      3 sp.check_forcing(df_forcing_spinup)
----> 4 df_spinup_res, df_spinup_final = sp.run_supy(df_forcing_spinup, df_state_spinup, serial_mode=False)

/opt/conda/lib/python3.7/site-packages/supy/_supy_module.py in run_supy(df_forcing, df_state_init, save_state, chunk_day, logging_level, check_input, serial_mode)
    364         logger_supy.info(f"SuPy is running in parallel mode")
    365         df_output, df_state_final = run_supy_par(
--> 366             df_forcing, df_state_init, save_state, chunk_day
    367         )
    368     else:

/opt/conda/lib/python3.7/site-packages/supy/_run.py in run_supy_par(df_forcing_tstep, df_state_init_m, save_state, n_yr)
    448                     list_save_state,
    449                     list_n_yr,
--> 450                     list_dir_temp,
    451                 ),
    452             )

/opt/conda/lib/python3.7/site-packages/multiprocess/pool.py in starmap(self, func, iterable, chunksize)
    274         `func` and (a, b) becomes func(a, b).
    275         '''
--> 276         return self._map_async(func, iterable, starmapstar, chunksize).get()
    277 
    278     def starmap_async(self, func, iterable, chunksize=None, callback=None,

/opt/conda/lib/python3.7/site-packages/multiprocess/pool.py in get(self, timeout)
    655             return self._value
    656         else:
--> 657             raise self._value
    658 
    659     def _set(self, i, obj):

/opt/conda/lib/python3.7/site-packages/multiprocess/pool.py in worker()
    119         job, i, func, args, kwds = task
    120         try:
--> 121             result = (True, func(*args, **kwds))
    122         except Exception as e:
    123             if wrap_exception and func is not _helper_reraises_exception:

/opt/conda/lib/python3.7/site-packages/multiprocess/pool.py in starmapstar()
     45 
     46 def starmapstar(args):
---> 47     return list(itertools.starmap(args[0], args[1]))
     48 
     49 #

/opt/conda/lib/python3.7/site-packages/supy/_run.py in run_save_supy()
    415     # run supy in serial mode
    416     df_output, df_state_final = run_supy_ser(
--> 417         df_forcing_tstep, df_state_init_m, save_state, n_yr
    418     )
    419     # save to path_dir_temp

/opt/conda/lib/python3.7/site-packages/supy/_run.py in run_supy_ser()
    374 
    375             except:
--> 376                 raise RuntimeError("SUEWS kernel error")
    377 
    378             # collect output arrays

RuntimeError: SUEWS kernel error

Screenshots

(from attempt to run in serial mode) SUEWS kernel error

Thanks!

sunt05 commented 1 year ago

Hello @markhallows1 - Wellcome to supy!

In this case, I think you'll need to install a development version of supy as the pre-compiled supy-driver seems incompatbible with your environment.

Please follow the quick guide to install a dev version of supy and see if the issue is gone.

note: you'll need the fortran compiler gfortran which I think should be available on Debian.

markhallows1 commented 1 year ago

That's solved my issue thanks :)