Obtain Application
Docker Image
A docker image is available at Docker Hub. To use it, docker needs to be installed first. See this page for details.
Once docker is installed, it is possible to pull the image via:
Then it is possible to run the container in an interactive manner via:
Within the container, one can use one of the following commands to run the program.
One can also attach volume to the container to access the files in the host machine. This may be the main use case. Then one can run the file inside the container as follows.
Docker image is convenient on machines with older kernels or limited by other factors that does not allow execution of precompiled binaries.
Precompiled Binaries
The binaries are published on GitHub. https://github.com/TLCFEM/suanPan/releases
Binaries on Windows, Ubuntu and macOS are compiled and deployed automatically on the master
branch. The precompiled binaries are compiled on the following OS versions.
Windows
Windows Server 2022
Linux
Ubuntu 22.04
macOS
Ventura 13
For older versions or other flavours of Linux, successful execution is not guaranteed. Please consider compiling the binaries manually.
In order to enable CUDA
backed solvers, the program shall be compiled locally with preinstalled external libraries. See this page.
Currently, the following package managers can be used to install the program.
The binaries are tested in standard environments: fresh new Win10/11 images, docker images Ubuntu and Fedora, and macOS GitHub image.
Chocolatey
snap
flatpak
To run the application, one shall use the following command in terminal.
Since no shim is created, it would be convenient to create alias such that
Then it is possible to use suanpan
to invoke the application.
Execute Program
By default, the AVX2
support is turned on to utilize CPU capability. For CPUs that do not support AVX2
, the application cannot be successfully executed. Users can either compile the program by themselves or request a specific version by filing an issue.
The name of the executable is suanPan
, however, snap/chocolatey/scoop will create shim executable named as suanpan
. Depending on how the application is installed, one may use suanpan
or suanPan
to invoke the application.
The parallelization is enabled mostly by the TBB
library and <execution>
header (C++17). If the program is compiled with SUANPAN_MT macro, parallelization is used by default. The OpenMP is enabled in several parts of the program, users can set environment variable OMP_NUM_THREADS to customize some OpenMP based parallelization. To do so, users can, for example, in Windows, use the following command.
On Linux, the dynamic loading path needs to be set so that dynamic libraries such as libtbb.so
can be successfully found. If the application is installed via snap
/apt
/dnf
, it is automatically done.
Alternatively, users can execute the program via the provided suanPan.sh
script.
CLI Mode
By running the program without any parameters, it enters CLI mode by default. Users can create models in an interactive manner.
A command named as example
is available to automatically create an example model and perform the analysis.
Batch Mode
To analyze the model written in a model file named as for example example.supan
, the -f
or --file
parameter can be used. First we create the file example.supan
with exit
command.
Then we can run it by the following command.
Or on Windows,
If the model has been prechecked, it is possible to run the analysis without output. It is known that printing strings to terminals slows down the analysis. Users can use the -np
or --noprint
option to suppress output.
In the CLI mode, it is possible to use file
command to load the file.
VS Code
The VS Code extension is available here. It provides syntax highlighting and code completion.
Sublime Text Workspace
I personally use Sublime Text as my model editor. Other tools like VS Code can also be used.
Syntax Highlighting
Create a new syntax file via Tools -> Developer -> New Syntax...
, copy and paste the following sample content into the new file and save as suanPan.sublime-syntax
under the default path. It provides syntax highlighting for comments only. Other components can be added accordingly.
A syntax file with (almost) all commands is provided as suanPan.sublime-syntax
in the archive. Please feel free to use/modify it. It may be necessary to manually search for the file if the application is installed via some package manager.
Autocomplete
All keywords used are stored in the JSON file suanPan.sublime-completions
. Place the file in folder ~/.config/sublime-text-3/Packages/User/
(Linux) or %appdata%\Sublime Text 3\Packages\User
(Windows) and you are good to go with the previous syntax file. The new path has been changed to ~/.config/sublime-text/Packages/User/
( Linux) and %appdata%\Sublime Text\Packages\User
(Windows) in Sublime Text 4
.
Build System
In order to render ANSI color codes correctly in Linux like systems, you may wish to install ANSIescape package. Now define a new build system via Tools -> Build System -> New Build System...
, copy and paste the following contents in the file and save it as suanPan.sublime-build
. You may need to replace command suanpan
with the full path of the executable.
Now models can be run in Sublime Text via the shortcut Ctrl+B
.
To disable colored output, use -nc
option such as
Automation
Windows
A batch file named as AddAssociation.bat
is provided in the archive. It associates *.sp
and *.supan
files with the program and copies configuration files to default folder if Sublime Text is installed. If the package is installed via package managers, pleas manually search for and execute this file.
Admin privilege is required.
Linux
A bash script named as suanPan.sh
is provided in the archive to set up the above configurations automatically. The script can be used to both execute the program and create symbolic links.
For the first time use, the following commands create a soft link under $HOME/.local/bin
so that users can execute the program anywhere by invoking command suanpan
in any folder. The Sublime Text configuration files are copied to the default folder if Sublime Text is installed.
Check the following recording.
Changes Made to the System
The application itself does not write any files to folders other than the current working directory.
There are some exceptions though.
If the
terminal
command is used, one can change files in the file system.If one decides to download new versions via the bundled updater, the archive is downloaded to the current working directory. The updater is not always bundled.
The script suanPan.sh
writes the following files to the system.
$HOME/.local/share/applications/suanPan.desktop
$HOME/.local/bin/suanpan
$HOME/.config/sublime-text/Packages/User/suanPan.sublime-build
$HOME/.config/sublime-text/Packages/User/suanPan.sublime-completions
$HOME/.config/sublime-text/Packages/User/suanPan.sublime-syntax
The script AddAssociation.bat
changes the following settings.
Associate
*.sp
and*.supan
files with the program.Copy configuration files to default folder if Sublime Text is installed.
Last updated