RISC-V public beta platform released · Configuring Jupiter+Octave scientific computing environment on SG2042


JupyterHub is an open source shared computing platform that manages a separate Jupyter environment for each user and can be used for student classes, enterprise data science groups, or scientific research groups. It is a multi-user hub that can spawn, manage and proxy multiple instances of single-user Jupyter notebook servers.
GNU Octave is a software using a high-level programming language primarily used for numerical analysis. Octave helps solve linear and nonlinear problems numerically and conduct other numerical experiments using a MATLAB-compatible language. It is also available as a batch-oriented language. Because it is part of the GNU Project, it is free software under the terms of the GNU General Public License.
In this issue, we will try Jupyter and Octave to form a multi-user scientific computing platform.

Experimental Materials:

Python 3 (if not, please install python3 first)
pip (if not installed, please install python3-pip first)
Octave source code
One HS-2 server

server configuration:

CPU: SG2042 (64 cores)
Hard drive capacity: 1TB
Operating system: Ubuntu 22.10 (GNU/Linux 6.1.31 riscv64)

Experimental steps:

First install JupyterHub, JupyterLab and Jupyter Notebook through pip:

pip3 install jupyterhub jupyterlab notebook

Generate the configuration file (the configuration file can be modified according to the actual situation):

jupyterhub --generate-config

Then start jupyterhub:


Or run in the background:

nohup jupyterhub &

Just access [server address]:8000 with your browser. After accessing it, we found that though we saw JupyerHub running, it only had Python 3 and no Octave option.

Therefore, we also need to install Octave and related components.
There are two ways to install Octave: compile installation and apt installation.
Method 1: Install directly using apt

sudo apt install octave

Method 2: Compile and install

Download Octave source code package

wget https://mirror2.sandyriver.net/pub/software/gnu/octave/octave-8.3.0.tar.gz

(If the download speed is slow, you can download it on your computer in advance and then transfer the file to the server)

Unzip the Octave source package

tar -xzvf octave-8.3.0.tar.gz

Enter the Octave source code folder

cd octave-8.3.0/





make -j64 (the number of threads is set according to the actual situation)


sudo make install

Run octave shell. If the version number and prompt appear, it means the installation is successful!


Install octave-kernel

pip3 install octave-kernel

Install gnuplot

sudo apt-get install gnuplot

Then restart jupyterhub (if it is running in the background, please make sure that all jupyterhub related processes have been killed before restarting):



nohup jupyterhub & (running in the background)

Then open the browser again and visit [server address]:8000 to see the Octave notes.

We choose Octave to create a new note.
Draw a graph of a sine function:

gnuplot_binary('/usr/bin/gnuplot'); % Set the path to the gnuplot binary file, the specific path may be different
% Generate a set of x values ​​(from 0 to 2π with intervals of 0.01)
x = 0:0.01:2*pi;
% Calculate the corresponding sine value
y = sin(x);
% Plot the sine function graph
plot(x, y);
title("Sin Function"); % add title
xlabel("x"); % add x-axis label
ylabel("sin(x)"); % add y-axis label
grid on; % add grid lines


Draw a heart shape:

In fact, Octave can not only draw pictures, but can even calculate the Fibonacci sequence.
Even calculating pi:

The result indicates that the library is missing. Therefore we need to install the symbolic package.
Thanks to Octave’s support for installing expansion packs, we can use some expansion packs to achieve more functions and make Octave more powerful.

After entering Octave Shell, first update the expansion package source, then download and install the symbolic package:

pkg update
pkg install -forge symbolic

Just try running again:

Then test 10, 100, 1000, 10000 and 100000 bits respectively:

10 digits: 1.1531 seconds
100 bits: 1.155 seconds
1000 bits: 1.1567 seconds
10000 bits: 1.2044 seconds
100000 bits: 3.2812 seconds

The next step is to try multi-user. Although Jupyterhub can be managed by a single notebook with multiple users, if you need to achieve multi-user management, you need a root account.

First switch to the root account:


After entering the password, log in as the root user, and then return to the home directory:


Install related packages:

pip3 install jupyterhub jupyterlab notebook

Create a new jupyerhub folder:

mkdir jupyterhub

Copy the previous configuration file (you can modify it appropriately according to your own situation)

cp jupyterhub_config.py jupyterhub

Or create a new configuration file

jupyterhub --generate-config

Start JupyterHub


Start JupyterHub in background

nohup jupyterhub &

But there is no Octave in other user interfaces, so I installed octave-kernel directly under the root user.

pip3 install octave-kernel

Start three users at the same time, calculate Pi, and observe the time taken to ensure that the Octave of the three users is in the Busy state.

The results are as follows (accurate to 100,000 decimal points):

perfxlab01: 6.762 seconds
python01: 6.6159 seconds
python02: 6.9564 seconds

After testing, the difference is only a few tenths of a second, but it takes longer than calculating pi for a single user.

Not only can you use Octave notes, you can also use the Octave command symbol (Shift+Enter to send commands).


When performing configuration or compilation, if you are prompted that required dependencies are missing, please install the required dependencies first and then perform configuration or compilation again.
When running the code, if you are prompted that required dependencies are missing, you can first log in as root and install the required dependencies, and then restart the Jupyter server of each user (or directly restart the entire JupyterHub).

Experiment summary:

With the blessing of JupyterHub, the HS-2 server can now become an excellent scientific computing platform. Coupled with Octave, you can not only use Python to run scientific computing on JupyterHub, but you can also use Octave to complete scientific computing tasks, and even more Users use the same JupyterHub server.

JupyterHub page
Octave official website
Octave Packages
Configuration Reference — JupyterHub documentation