OceanParcels / Parcels

Main code for Parcels (Probably A Really Computationally Efficient Lagrangian Simulator)
https://www.oceanparcels.org
MIT License
295 stars 136 forks source link

Error when generating output file #991

Closed camines closed 3 years ago

camines commented 3 years ago

Hello,

I'm trying to learn how to use parcels :)

I'm working with Linux and I'm working on a Jupyter Notebook

I first tried to run at the terminal the python example_peninsula.py --fieldset 100 100 But it gave me a lot of errors, so I tried the tutorials

Im doing the first tutorial 'https://nbviewer.jupyter.org/github/OceanParcels/parcels/blob/master/parcels/examples/parcels_tutorial.ipynb#Reading-in-data-from-arbritrary-NetCDF-files'

I save the parcels_examples at /.conda/envs/envs/py3_parcels/lib/ parcels_examples and when I'm doing the 'output_file' Im getting the following>

`--------------------------------------------------------------------------- CalledProcessError Traceback (most recent call last) ~/.conda/envs/py3_parcels/lib/python3.6/site-packages/parcels/compiler.py in compile(self, src, obj, log) 51 try: ---> 52 subprocess.check_call(cc, stdout=logfile, stderr=logfile) 53 except OSError:

~/.conda/envs/py3_parcels/lib/python3.6/subprocess.py in check_call(*popenargs, **kwargs) 310 cmd = popenargs[0] --> 311 raise CalledProcessError(retcode, cmd) 312 return 0

CalledProcessError: Command '['gcc', '-Wall', '-fPIC', '-I/home/zmaw/u301568/.conda/envs/py3_parcels/lib/python3.6/site-packages/parcels/include', '-g', '-O3', '-m64', '-o', '/tmp/parcels-100738/5dff5ec76207e63f2318c51708a235a3_0.so', '/tmp/parcels-100738/5dff5ec76207e63f2318c51708a235a3_0.c', '-shared', '-m64']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

RuntimeError Traceback (most recent call last)

in 3 runtime=timedelta(days=6), # the total length of the run 4 dt=timedelta(minutes=5), # the timestep of the kernel ----> 5 output_file=output_file) ~/.conda/envs/py3_parcels/lib/python3.6/site-packages/parcels/particleset.py in execute(self, pyfunc, endtime, runtime, dt, moviedt, recovery, output_file, movie_background_field, verbose_progress, postIterationCallbacks, callbackdt) 670 self.kernel.remove_lib() 671 cppargs = ['-DDOUBLE_COORD_VARIABLES'] if self.lonlatdepth_dtype == np.float64 else None --> 672 self.kernel.compile(compiler=GNUCompiler(cppargs=cppargs)) 673 self.kernel.load_lib() 674 ~/.conda/envs/py3_parcels/lib/python3.6/site-packages/parcels/kernel.py in compile(self, compiler) 224 with open(self.src_file, 'w') as f: 225 f.write(self.ccode) --> 226 compiler.compile(self.src_file, self.lib_file, self.log_file) 227 logger.info("Compiled %s ==> %s" % (self.name, self.lib_file)) 228 self._cleanup_files = finalize(self, cleanup_remove_files, self.delete_cfiles, self.src_file, self.lib_file, self.log_file) ~/.conda/envs/py3_parcels/lib/python3.6/site-packages/parcels/compiler.py in compile(self, src, obj, log) 63 64 Log output: %s""" % (" ".join(cc), src, logfile.name, logfile2.read()) ---> 65 raise RuntimeError(err) 66 67 RuntimeError: Error during compilation: Compilation command: gcc -Wall -fPIC -I/home/zmaw/u301568/.conda/envs/py3_parcels/lib/python3.6/site-packages/parcels/include -g -O3 -m64 -o /tmp/parcels-100738/5dff5ec76207e63f2318c51708a235a3_0.so /tmp/parcels-100738/5dff5ec76207e63f2318c51708a235a3_0.c -shared -m64 Source file: /tmp/parcels-100738/5dff5ec76207e63f2318c51708a235a3_0.c Log file: /tmp/parcels-100738/5dff5ec76207e63f2318c51708a235a3_0.log Log output: In file included from /tmp/parcels-100738/5dff5ec76207e63f2318c51708a235a3_0.c:1:0: /home/zmaw/u301568/.conda/envs/py3_parcels/lib/python3.6/site-packages/parcels/include/parcels.h: In function ‘temporal_interpolation_structured_grid’: /home/zmaw/u301568/.conda/envs/py3_parcels/lib/python3.6/site-packages/parcels/include/parcels.h:511:7: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode for (int i = 0; i < tii; i++) { \ ^ /home/zmaw/u301568/.conda/envs/py3_parcels/lib/python3.6/site-packages/parcels/include/parcels.h:544:7: note: in expansion of macro ‘INTERP’ INTERP(spatial_interpolation_bilinear, spatial_interpolation_trilinear_surface); ^ /ho…`
CKehl commented 3 years ago

Which version of Parcels are you using ?

I fixed those C99 / C11 issues some time ago by including the cpp-argument '-std=gnu11' to the standard compile process with the gnu-compiler. I am missing that argument in your compile command. Hence the parcels-version would be very helpful.

i.e.

$: python
Python 3.7.6 | packaged by conda-forge | (default, Dec 27 2019, 00:09:34) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import parcels
INFO: Compiled random ==> /tmp/parcels-1000/libparcels_random_2ae08c34-207c-42cb-b86e-b5d788a56d67.so
>>> print(parcels.__version__)
2.1.5.dev133+gd75d8144.d20210211
>>> 

(this is just an example-print from my development-branch - for you, the version number should be at least 2.1, better be the new 2.2)

reint-fischer commented 3 years ago

Closing this as it seems no further issues are reported. Please re-open if issue persists