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

tex2notebook.py script that generates jupyter notebooks from the tex file of the OpenMP example document #29

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
5 changes: 5 additions & 0 deletions notebook/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
default:
python tex2notebook.py

clean:
rm -rf *.ipynb
40 changes: 40 additions & 0 deletions notebook/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## tex2notebook.py for OpenMP examples document
The tex2notebook.py script generates Jupyter Notebooks from the tex files of the OpenMP examples document.

### To convert

Under the `notebook` folder of the repository
```
$ python tex2notebook.py
```

All the notebooks will be generated under the current folder. The title page and TOC page are removed since they are not properly processed.

### Details and limitation
Each tex file is processed by the script which generates a single Jupyter notebook file. The textual content of the tex file is converted to markdown-formatted content enclosed in a notebook cell. A reference to a program source file (example source code in the example document) that appears in the tex file is converted to a cell that uses Jupyter `%load` magic, e.g. `%load ../sources/Example_parallel.1.c` such that running the cell causes loading the content of the file and then replacing the cell with the content. `%load` recognizes both absolute path and related path. Now the default one is `../sources/Example_*`.

Since all the OpenMP example source files are either C/C++ and Fortran. The correct setting for the notebook kernel
should be a kernel that can recognize C/C++ and Fortran. As of now, C/C++ and Fortran are not
officially supported by Jupyter notebook. Thus the script sets Python as the notebook kernel (Python3 works as well).
By doing that, users won't need to to set it manually when open a notebook. Of course, the C/C++/Fortran code is not compiliable or executable. User can always select a kernel from notebook interface if she has C/C++/Fortran kernel.

### Notebook Copyright
The generated notebooks have the same copyright as the orginal tex file and the official OpenMP document.

**Copyright © 1997-2016 OpenMP Architecture Review Board.
Permission to copy without fee all or part of this material is granted,
provided the OpenMP Architecture Review Board copyright notice and
the title of this document appear. Notice is given that copying is by
permission of OpenMP Architecture Review Board.**

### Acknowledgement
[Kewei Yan](https://github.com/ambipomyan) from PASSlab (https://passlab.github.io) of
UNC Charlotte is the main developer of this script. When this becomes a question,
the script is licensed with 3-clause BSD License,
and Copyrighted @ 2019 by PASSlab (https://passlab.github.io)
from University of North Carolina at Charlotte. All rights reserved.
To contact, reach Kewei or Yonghong Yan (yanyh15@github or gmail).

Funding for this development has been provided by the National Science Foundation
under award number [CISE CCF 1833332](https://www.nsf.gov/awardsearch/showAward?AWD_ID=1833332). Please also
acknowledge OpenMP cOMPunity, one of the OpenMP ARB members.
Loading