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

Throwing explicit error in codegenerator when using random() in JIT Kernel #1230

Merged
merged 1 commit into from Aug 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions parcels/compilation/codegenerator.py
Expand Up @@ -319,6 +319,10 @@ def visit_Attribute(self, node):
raise NotImplementedError("Cannot convert numpy functions in kernels to C-code.\n"
"Either use functions from the math library or run Parcels in Scipy mode.\n"
"For more information, see http://oceanparcels.org/faq.html#kernelwriting")
elif node.value.id in ['random']:
raise NotImplementedError("Cannot convert random functions in kernels to C-code.\n"
"Use `import parcels.rng as ParcelsRandom` and then ParcelsRandom.random(), ParcelsRandom.uniform() etc.\n"
"For more information, see http://oceanparcels.org/faq.html#kernelwriting")
else:
raise NotImplementedError("Cannot convert '%s' used in kernel to C-code" % node.value.id)

Expand Down