libyt now supports accessing interactive mode through Jupyter Notebook or Lab. Both serial (compile through g++) and parallel (compile through MPI) are supported. Can run python under MPI environment, gather output to root process, act like normal Python prompt, and has auto-completion feature.
Currently, this feature has only tested on local machines.
After installing libyt, set JUPYTER_PATH to <libyt-install-dir>/share/jupyter, so that jupyter knows how to find customized kernel. You can put it in .bashrc.
Support Jupyter Notebook / Lab UI
libyt
now supports accessing interactive mode through Jupyter Notebook or Lab. Both serial (compile throughg++
) and parallel (compile through MPI) are supported. Can run python under MPI environment, gather output to root process, act like normal Python prompt, and has auto-completion feature.Currently, this feature has only tested on local machines.
API
Use this feature through:
libyt
will stop and launch kernel ifflag_file_name
is found, and find empty port itself ifuse_connection_file
is false.If you want to specify connection info, you can refer to Connection File and the file name must be
libyt_kernel_connection.json
.How to Use?
Compile libyt
Set
-DINTERACTIVE_MODE=ON
-DJUPYTER_KERNEL=ON
Currently only supports build from CMake (version >= 3.15). It is based on
xeus-zmq
, which needs other libraries when compiling :After installing libyt, set
JUPYTER_PATH
to<libyt-install-dir>/share/jupyter
, so that jupyter knows how to find customized kernel. You can put it in.bashrc
.Getting
jupyter-client
andjupyter_libyt
Get these:
jupyter_libyt
jupyter-client >= 8.0.0
tested (not sure if7.x
will work or not)jedi
: for auto-completion. (If you have IPython, then this is probably already installed.)Set
LIBYT_KERNEL_INFO_DIR
system environment variable when launching jupyter client.jupyter_libyt
(or more precisely, the libyt kernel provisioner) uses this path to find libyt kernel and its info.Launch Jupyter Notebook or Lab:
Example
An example workflow of compiling libyt in parallel mode, and launch Jupyter Notebook or Lab:
cmake -S . -B build-jupyter \ -G "Unix Makefiles" \ -DINTERACTIVE_MODE:BOOL=ON \ -DJUPYTER_KERNEL=ON \ -DMPI_PATH=/home/cindytsai/Softwares/openmpi/4.1.4-gnu \ -DPYTHON_PATH=/home/cindytsai/Softwares/python/python3.9 \ -Dxeus-zmq_DIR=/home/cindytsai/Packages/xeus-zmq-1.1.0/build \ -Dnlohmann_json_DIR=/home/cindytsai/Packages/json-3.11.2/build \ -Dxeus_DIR=/home/cindytsai/Packages/xeus-3.1.1/build \ -Dxtl_DIR=/home/cindytsai/Packages/xtl-master/build \ -Dcppzmq_DIR=/home/cindytsai/Packages/cppzmq-4.10.0/build
cmake --build build-jupyter cmake --install build-jupyter --prefix
libyt
.libyt
will stop and launch the kernel)LIBYT_KERNEL_INFO_DIR
to where your application executable is. Then runjupyter-lab
orjupyter notebook
.TODO before Merge
libyt
defined command