Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Windows only) "access violation" when running simulations with custom kernels #1671

Open
VeckoTheGecko opened this issue Aug 27, 2024 · 1 comment

Comments

@VeckoTheGecko
Copy link
Contributor

VeckoTheGecko commented Aug 27, 2024

parcels 3.0.4

When running on Windows, occasionally (without seeming to have changed any code) one can run into an access violation error.

E.g.,

INFO: Compiled GalapagosParticleAdvectionRK4SampleGalapagosAge ==> C:\Users\ADMINI~1\AppData\Local\Temp\parcels-tmp\b3cd2748cfdf0ad1ba5ba70184487415.dll
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-19-5733fa7ebae1> in <module>
     19 
     20 pset.execute(AdvectionRK4+pset.Kernel(SampleGalapagos)+Age, dt=delta(hours=1), output_file=outfile,
---> 21              recovery={ErrorCode.ErrorOutOfBounds: DeleteParticle})

E:\ProgramData\Anaconda3\envs\parcels\lib\site-packages\parcels\particleset.py in execute(self, pyfunc, endtime, runtime, dt, moviedt, recovery, output_file, movie_background_field, verbose_progress)
    418             else:
    419                 time = max(next_prelease, next_input, next_output, next_movie, endtime)
--> 420             self.kernel.execute(self, endtime=time, dt=dt, recovery=recovery, output_file=output_file)
    421             if abs(time-next_prelease) < tol:
    422                 pset_new = ParticleSet(fieldset=self.fieldset, time=time, lon=self.repeatlon,

E:\ProgramData\Anaconda3\envs\parcels\lib\site-packages\parcels\kernel.py in execute(self, pset, endtime, dt, recovery, output_file)
    274         # Execute the kernel over the particle set
    275         if self.ptype.uses_jit:
--> 276             self.execute_jit(pset, endtime, dt)
    277         else:
    278             self.execute_python(pset, endtime, dt)

E:\ProgramData\Anaconda3\envs\parcels\lib\site-packages\parcels\kernel.py in execute_jit(self, pset, endtime, dt)
    203         particle_data = pset._particle_data.ctypes.data_as(c_void_p)
    204         self._function(c_int(len(pset)), particle_data,
--> 205                        c_double(endtime), c_float(dt), *fargs)
    206 
    207     def execute_python(self, pset, endtime, dt):

OSError: exception: access violation reading 0x00000186DEE83138

It's an issue we've encountered a few times before (#793 , #1232). This issue is due to the conversion of the kernels to C, although why this would only crop up on Windows is a mystery to me

First step is to come up with a minimal reproducible example.

@VeckoTheGecko VeckoTheGecko changed the title "access violation" when running simulations with custom kernels (Windows only) "access violation" when running simulations with custom kernels Aug 27, 2024
@OceanParcels OceanParcels deleted a comment from YeGop0218 Aug 27, 2024
@VeckoTheGecko

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

1 participant