|
| 1 | +<div align="center"> |
| 2 | + |
| 3 | +# Fortran kernel for Jupyter with Coarray support |
| 4 | + |
| 5 | +[](https://beta.mybinder.org/v2/gh/sourceryinstitute/jupyter-CAF-kernel/master) |
| 6 | +[](https://microbadger.com/images/sourceryinstitute/jupyter-caf-kernel) |
| 7 | +[](https://hub.docker.com/r/sourceryinstitute/jupyter-caf-kernel/) |
| 8 | +[](https://github.com/sourceryinstitute/jupyter-CAF-kernel#readme) |
| 9 | +[][license] |
| 10 | + |
| 11 | +</div> |
| 12 | + |
| 13 | +---- |
| 14 | + |
| 15 | +## Quick start |
| 16 | + |
| 17 | + * [Try][try CAF] Coarray Fortran in the cloud with [GFortran] and [OpenCoarrays] |
| 18 | + using [Binder]: __http://bit.ly/TryCoarrays__ |
| 19 | + This will open the [`index.ipynb`] file in an interactive |
| 20 | + environment using [Binder]. |
| 21 | + * Launch a full JupyterHub [Binder] Fortran environment in the cloud with [OpenCoarrays]: __http://bit.ly/CAF-Binder__ |
| 22 | + |
| 23 | +## Run locally |
| 24 | + |
| 25 | +```bash |
| 26 | +docker pull sourceryinstitute/jupyter-caf-kernel:latest |
| 27 | +docker run -i -t -p 8888:8888 sourceryinstitute/jupyter-caf-kernel:latest |
| 28 | +``` |
| 29 | + |
| 30 | +You should see output similar to the following which will instruct you |
| 31 | +to point your web browser to `http://localhost:8888/?token=...` |
| 32 | + |
| 33 | +``` |
| 34 | +[I 19:29:08.089 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret |
| 35 | +[W 19:29:08.188 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended. |
| 36 | +[I 19:29:08.221 NotebookApp] JupyterLab alpha preview extension loaded from /opt/conda/lib/python3.5/site-packages/jupyterlab |
| 37 | +[I 19:29:08.233 NotebookApp] Serving notebooks from local directory: /home/jovyan |
| 38 | +[I 19:29:08.233 NotebookApp] 0 active kernels |
| 39 | +[I 19:29:08.233 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/?token=67e0bf26a40f863c8af93c030de57b4802cd7b3d9f10ae17 |
| 40 | +[I 19:29:08.233 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). |
| 41 | +[C 19:29:08.234 NotebookApp] |
| 42 | +
|
| 43 | + Copy/paste this URL into your browser when you connect for the first time, |
| 44 | + to login with a token: |
| 45 | + http://localhost:8888/?token=67e0bf26a40f863c8af93c030de57b4802cd7b3d9f10ae17 |
| 46 | +``` |
| 47 | + |
| 48 | +When running locally (this way) you won't have access to the examples |
| 49 | +folder or [`index.ipynb`]. |
| 50 | + |
| 51 | +## About |
| 52 | + |
| 53 | +This Coarray Fortran kernel is still a bit rough around the edges. It |
| 54 | +is a shameless fork of the [jupyter-c-kernel], quickly thrown |
| 55 | +together. This is [licensed under the MIT license][license], as is |
| 56 | +[jupyter-c-kernel]. I also drew inspiration from the |
| 57 | +[jupyter-fortran-kernel]. |
| 58 | + |
| 59 | +### Whats up with the `prebuild` directory? |
| 60 | + |
| 61 | +The `prebuild` directory is there so that the docker image used to |
| 62 | +launch the Coarray Fortran kernel on [Binder] can be built |
| 63 | +automatically on Docker Hub. The `Dockerfile` at the project root then |
| 64 | +wraps the one located in `prebuild`. This is because we must compile |
| 65 | +GCC from source to get a new enough version and this takes a very long |
| 66 | +time. We don't want users to have to wait forever to spawn a new |
| 67 | +notebook on [Binder], so we ensure that the base image is built ahead |
| 68 | +of time, locally, or through the Docker Hub automated build process. |
| 69 | + |
| 70 | +## Manual local installation |
| 71 | + |
| 72 | +The recommended usage of this kernel is through [Binder] in the cloud, |
| 73 | +or [via Docker, as described above](#Run-locally). If you decide to |
| 74 | +install this kernel locally on your system you will need the following |
| 75 | +software packages installed: |
| 76 | + |
| 77 | + * GCC and [GFortran] >= 8.2 |
| 78 | + * [MPICH] >= 3.2 |
| 79 | + * [OpenCoarrays] |
| 80 | + * [Jupyter] |
| 81 | + * Python 3 |
| 82 | + * pip |
| 83 | + |
| 84 | +### Step-by-step |
| 85 | + |
| 86 | + 1. `git clone https://github.com/sourceryinstitute/jupyter-CAF-kernel` |
| 87 | + 1. `cd jupyter-CAF-kernel` |
| 88 | + 1. `pip install -e prebuild/jupyter-caf-kernel` |
| 89 | + 1. `jupyter-kernelspec install prebuild/jupyter-caf-kernel/Coarray-Fortran/` |
| 90 | + 1. `jupyter-notebook .` |
| 91 | + |
| 92 | +## Contributing |
| 93 | + |
| 94 | +Contributions are most welcome! |
| 95 | + |
| 96 | +### ToDo |
| 97 | + |
| 98 | + * [ ] Use proper Python OOP class extension & better understand base class |
| 99 | + * [ ] Improve I/O |
| 100 | + * [ ] Improve exception handling and error reporting |
| 101 | + * [x] Improve magics |
| 102 | + * [ ] Use [MetaKernel] to build the kernel and magics |
| 103 | + * [ ] Allow use of all aplicable [MetaKernel magics] |
| 104 | + * [ ] Don't attempt to compile code when only magics are present |
| 105 | + * [ ] Different flavors of Docker images (so that less space is |
| 106 | + used). See [jupyter/docker-stacks][jupyter-stacks] |
| 107 | + |
| 108 | +### Version control |
| 109 | + |
| 110 | + 1. [Fork] |
| 111 | + 1. Create branches named `issue-X` where `X` is the number of the |
| 112 | + issue. |
| 113 | + 1. Commit changes |
| 114 | + 1. [Pull Request] |
| 115 | + |
| 116 | +## License |
| 117 | + |
| 118 | +[MIT][license] |
| 119 | + |
| 120 | +[Binder]: https://beta.mybinder.org |
| 121 | +[try CAF]: http://bit.ly/TryCoarrays |
| 122 | +[GFortran]: https://gcc.gnu.org/wiki/GFortran |
| 123 | +[OpenCoarrays]: https://github.com/sourceryinstitute/OpenCoarrays#readme |
| 124 | +[`index.ipynb`]: https://nbviewer.jupyter.org/github/sourceryinstitute/jupyter-CAF-kernel/blob/master/index.ipynb |
| 125 | +[jupyter-c-kernel]: https://github.com/brendan-rius/jupyter-c-kernel#readme |
| 126 | +[jupyter-fortran-kernel]: https://github.com/ZedThree/jupyter-fortran-kernel |
| 127 | +[MPICH]: https://www.mpich.org |
| 128 | +[license]: https://github.com/sourceryinstitute/jupyter-CAF-kernel/blob/master/LICENSE |
| 129 | +[Fork]: https://github.com/sourceryinstitute/jupyter-CAF-kernel/fork |
| 130 | +[Pull Request]: https://github.com/sourceryinstitute/jupyter-CAF-kernel/compare?expand=1 |
| 131 | +[MetaKernel]: https://github.com/Calysto/metakernel#readme |
| 132 | +[MetaKernel magics]: https://github.com/Calysto/metakernel/blob/master/metakernel/magics/README.md |
| 133 | +[jupyter-stacks]: https://github.com/jupyter/docker-stacks#readme |
| 134 | +[Jupyter]: https://jupyter.org |
0 commit comments