A minimalistic Jupyter kernel for native code execution.
Project description
Minimal Native kernel for Jupyter
The goal of this kernel is to provide a unified frontend for working with native languages from jupyter.
It was started from the jupyter C kernel.
Usage:
C/C++
- load to load a file to the cell
//%load https://passlab.github.io/CSCE569/resources/axpy.c
//%compiler: gcc
//%cflags: -fopenmp
//%ldflags: -lm
//%args: 1024
- Set a different compiler, such as clang, using magic keyword
//%compiler
//%compiler: clang
//%cflags: -fopenmp
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
int main (int argc, char** argv) {
int i;
#pragma omp parallel for num_threads(6)
for (i = 0; i < 12; i++)
printf("Thread: %d, i = %d\n", omp_get_thread_num(), i);
return 0;
}
Fortran
The Jupyter kernel adds the magic keyword as a comment in the source code. Since the keywords for comment in C/C++ and Fortran are different, we need to specify the magic keywords for Jupyter kernel accordingly.
In the following example of Fortran program, we must use the leading magic keyword !!% instead of //%.
!!%compiler: gfortran
!!%cflags: -fopenmp
PROGRAM Parallel_Hello_World
USE OMP_LIB
!$OMP PARALLEL
PRINT *, "Hello from process: ", OMP_GET_THREAD_NUM()
!$OMP END PARALLEL
END
Setup
Works only on Linux and OS X. Windows is not supported yet. If you want to use this project on Windows, please use Docker.
Make sure you have the following requirements installed:
- gcc
- jupyter
- python 3
- pip
Install (virtualenv, pip)
This kernel has been uploaded to the official Python package repository. Instead of building from source code, it can be installed directly by pip as follows.
virtualenv -p python3 venvsource venv/bin/activatepip3 install jupyter-native-kernelinstall_native_kernel --user
Install (system)
This installs the kernel at the system level. (Not tested yet.)
git clone <this repo>sudo pip3 install -e jupyter-native-kernelsudo install_native_kernel
To install on system folder, do sudo install_native_kernel --sys-prefix
Install (virtualenv)
This installs the kernel within the current virtualenv.
git clone <this repo>virtualenv -p python3 venvsource venv/bin/activatepip3 install -e jupyter-native-kernelinstall_native_kernel --user
License
This project is released under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jupyter_native_kernel-0.0.9.tar.gz.
File metadata
- Download URL: jupyter_native_kernel-0.0.9.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d57757301b33e28b0ff6a3c09dd8fa4748dc6e6e7ae92cef09b695498e79af33
|
|
| MD5 |
c2b41b58418a3e9ac60d53e2dfbefb2b
|
|
| BLAKE2b-256 |
06b724d34f9b671811932435ae9926eee59eebe430d1fa4e217603615243d4db
|
File details
Details for the file jupyter_native_kernel-0.0.9-py3-none-any.whl.
File metadata
- Download URL: jupyter_native_kernel-0.0.9-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f541585868aa26e28b0b27bbc5ebfb19b2bf7f8944d6bc5ada3f71f2a7b184d9
|
|
| MD5 |
f4247f52e3bb9b272394b829fb38a8dc
|
|
| BLAKE2b-256 |
b271674e4fad8e215eae2e4943384cdedde73b043a8394f5e31dd4476d1ab0b5
|