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

Jitify compilation errors are not visible in notebooks #10

Open
3 tasks
ptheywood opened this issue Sep 8, 2021 · 5 comments
Open
3 tasks

Jitify compilation errors are not visible in notebooks #10

ptheywood opened this issue Sep 8, 2021 · 5 comments

Comments

@ptheywood
Copy link
Member

ptheywood commented Sep 8, 2021

When running pyflamegpu from a notebook, jitify compile errors are not shown to the user

I.e. all that is seen is:

FLAMEGPURuntimeException: (InvalidAgentFunc) /__w/FLAMEGPU2/FLAMEGPU2/src/flamegpu/util/detail/JitifyCache.cu(342): Error compiling runtime agent function (or function condition) ('grass_growth'): function had compilation errors (see std::cout), in JitifyCache::buildProgram().

This is not the case for running python outside of a notebook

This appears to be resolved by running a more recent version of ipython/jupyter, but a workaround is still required for collab where we cannot update this.

Todo

  • Update instance hub to use a newer jupyter/ipython (@mondus)
    • ipykernel >= 6.0.0a5 outputs the stdout when an exception is thrown
    • Requires python >= 3.7, process will depend on the base AWS image used.
  • Describe this issue in a known issues section of the readme + the solution(s) (update, and/or restart the kernel)
  • Colab branch needs a new cell and section to perform this update, and instructions on how to restart the kernel. Potentially make this opt-in (i.e. comment it out initially unless there is a way to exclude from run_all

Notes

Locally, jupyter lab and jupyter notebook both show stdout on Ubuntu 21.04, python 3.9 with the following jupyter packages:


ipykernel           6.3.1
ipython             7.27.0
ipython-genutils    0.2.0

nbclassic           0.3.1
nbclient            0.5.4
nbconvert           6.1.0

jupyter-client      7.0.2
jupyter-core        4.7.1
jupyter-server      1.10.2
jupyterlab          3.1.10
jupyterlab-pygments 0.1.2
jupyterlab-server   2.8.0

And from About juptyer notebook:

The version of the notebook server is: 6.4.3-86f11a1

Python 3.9.5 (default, May 11 2021, 08:20:37) 
[GCC 10.3.0]

Python 3.9.5 (default, May 11 2021, 08:20:37) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.27.0 -- An enhanced Interactive Python. Type '?' for help.

The Innstance hub jupyter notebook is running:

ipykernel                     5.5.5
ipython                       7.16.1
ipython-genutils              0.2.0
ipywidgets                    7.6.3

nbclient                      0.5.3
nbconvert                     6.0.7
nbformat                      5.1.3

jupyter                       1.0.0
jupyter-client                6.1.12
jupyter-console               6.4.0
jupyter-core                  4.7.1
jupyterlab-pygments           0.1.2
jupyterlab-widgets            1.0.0
The version of the notebook server is: 6.4.0
The server is running on this version of Python:
Python 3.6.9 (default, Jan 26 2021, 15:33:00) 
[GCC 8.4.0]

Current Kernel Information:
Python 3.6.9 (default, Jan 26 2021, 15:33:00) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.

Installing the exact versions as found on the intancehub hosted copy, the stdout being consumed can be reproduced:

python3 -m pip install ipykernel==5.5.5 ipython==7.16.1 ipython-genutils==0.2.0 ipywidgets==7.6.3 nbclient==0.5.3 nbconvert==6.0.7 nbformat==5.1.3 jupyter==1.0.0 jupyter-client==6.1.12 jupyter-console==6.4.0 jupyter-core==4.7.1 jupyterlab-pygments==0.1.2 jupyterlab-widgets==1.0.0 

Colab is running the following:

ipython                       5.5.0
ipython-genutils              0.2.0
ipython-sql                   0.3.9
jupyter                       1.0.0
jupyter-client                5.3.5
jupyter-console               5.2.0
jupyter-core                  4.7.1
jupyterlab-pygments           0.1.2
jupyterlab-widgets            1.0.0
nbclient                      0.5.4
nbconvert                     5.6.1
nbformat                      5.1.3

Installing differnt versions of ipykernel has identified 6.0.0a5 (Released: Apr 26, 2021) as the first pypi release version which fixes this issue / introduces the change. This may help find a workaround.

The closed issues for milestone 6.0 for the ipykernel project may provide some insight.

The diff between 6.0.0a4 and 6.0.0a5 can also be found: ipython/ipykernel@6.0.0a4...6.0.0a5

ipython/ipykernel#630 is the relevant PR.

@ptheywood
Copy link
Member Author

Older ipython versions will also consume any stdout output from flamegpu, i.e. --timing or --verbose output.

@ptheywood
Copy link
Member Author

Updating ipykernel on colab does work, but requires a kernel restart. Pip also complains due to package incompatibility but it does work. This seems like a very sketchy solution though.

!python -m pip install ipykernel==6.0.0

Runtime > Restart Runtime (or ctrl + M .), then Yes. Variables are then lost, so most cells wil need re-running.

Screenshot_20210908_152641

@ptheywood
Copy link
Member Author

Decisions:

  • @mondus will tweak the instancehub image to upgrade the version on ipykernel via pip (and dependent packages
    • This may also need the python version upgrading / a new version installing. (ipykern 6.0.0 is python 3.7+)
  • The readme will be updated with a known issues section describing this issue, and solutions (update ipykernel, if on colab restart the kernel
  • The collab branch will have an (optional?) early cell which will upgrade the packages, and instruct users on how to restart the kernel.

ptheywood added a commit that referenced this issue Sep 8, 2021
Including missing compiler errors with older ipykernels and Google collab workaround

Part of #10
@ptheywood
Copy link
Member Author

This issues is still present, with google collab still running ipykernel 5.3.4

import ipykernel
print(ipykernel.__version__)
5.3.4

I opened an issue about this / requesting an update with googlecollab at the time: googlecolab/colabtools#2230

@ptheywood
Copy link
Member Author

Logs can be viewed by Runtime -> view runtime logs (FLAMEGPU/FLAMEGPU2#1020 (reply in thread)). We should probably add this to the text.

We could potentially ammend the error message in python land if running in jupyter too, if detection and ipython version detection is possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant