Ubuntu 20.04 LTS Desktop has the best compatibility with this project’s runtime environment and presents fewer compilation issues. Ubuntu 18.04 LTS Desktop comes with OpenGL version below 4.3 and is difficult to upgrade Ubuntu 22.04 LTS Desktop has newer versions of g++, gcc and CUDA which may require version adjustments The author’s development environment uses Ubuntu 22.04 LTS Desktop. Other Linux distributions may work but require additional configuration.
$ glxinfo | grep "OpenGL version"
OpenGL version string: 4.6.0 NVIDIA 510.47.03
$ sudo apt install mesa-utils
Check the driver version:
$ nvidia-smi
Fri Jul 11 16:30:01 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 572.61 Driver Version: 572.61 CUDA Version: 12.8 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Driver-Model | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce GTX 1080 Ti WDDM | 00000000:01:00.0 On | N/A |
| 37% 64C P0 60W / 250W | 4599MiB / 11264MiB | 1% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
When executing the nvidia-smi
command, you may encounter a “not found” error, which is usually caused by Ubuntu 22.04 not having the latest graphics drivers installed. A straightforward solution is to reinstall the appropriate graphics driver via Software & Updates → Additional Drivers, then restart the system after installation.
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Fri_Jun_14_16:44:19_Pacific_Daylight_Time_2024
Cuda compilation tools, release 12.6, V12.6.20
Build cuda_12.6.r12.6/compiler.34431801_0
For CUDA installation, please refer to the official website. After successful installation, you need to configure the environment variables by opening the .bashrc
file:
$ sudo vim ~/.bashrc
Add the following at the end of the file:
export PATH=/usr/local/cuda-12.6/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-12.6/lib64:$LD_LIBRARY_PATH
Activate the configuration file:
source ~/.bashrc
Install CMake:
$ sudo apt install cmake
Check cmake version:
$ cmake --version
cmake version 3.31.6
CMake suite maintained and supported by Kitware (kitware.com/cmake).
It is recommended to install cmake-gui. The PeriDyno project has numerous configurable compilation parameters, and using a graphical interface makes it convenient to select the libraries you need to compile.
Below we will also introduce the method of enabling optional CMake parameters for compilation via the command line.
Note that the default installed version of CMake might be too low and could potentially be incompatible with the latest version of CUDA. If you encounter the error “The CMAKE_CUDA_COMPILER: /usr/local/ is not a full path to an existing compiler tool”, please install a newer version of CMake. The installation method is as follows:
$ sudo apt remove cmake
$ sudo apt autoremove
$ sudo snap install cmake --classic
$ sudo apt-get update
$ sudo apt install g++
$ sudo apt install gcc
Check whether the versions of gcc
and g++
are compatible with CUDA. The compatibility between CUDA versions and GCC/Clang versions can be found in the file cuda/include/crt/host_config.h
.
$ gcc --version
$ g++ --version
Install the corresponding versions of gcc
and g++
, and modify the versions using update-alternatives
.
$ apt install gcc-12 g++-12
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 120
$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 120
$ sudo apt-get install libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev libxrandr-dev libxinerama-dev libxcursor-dev
$ sudo apt install -y mesa-common-dev libgl-dev pkg-config
$ git clone -b linux --recursive https://gitee.com/peridyno/peridyno.git
build
directory:$ mkdir build
$ cd build
$ cmake .. -D PERIDYNO_EXAMPLE=ON
(Note: If you encounter any issues during compilation, ensure all dependencies are properly installed and check the CMake output for errors.)
$ cmake -D PERIDYNO_EXMAPLE=ON ..
-- The CUDA compiler identification is NVIDIA 12.1.105
-- The CXX compiler identification is GNU 12.3.0
-- The C compiler identification is GNU 12.3.0
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found version "12.1")
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Using X11 for window creation
-- Found X11: /usr/include
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Configuring done (14.6s)
-- Generating done (1.5s)
-- Build files have been written to: /public/home/acpagbrbsr/Software/peridyno/build
If you have installed cmake-gui:
Optional CMake parameters can be viewed in cmake-gui via: Tools → Show My Changes.
This displays the modified parameters in cmake-gui, which can be directly used in CMake command-line.
You can compile the project using either make or ninja.
hehao@hehao:~/peridyno-gitee/build$ make
[ 2%] Built target Imath
[ 6%] Built target glfw
[ 7%] Built target glad
[ 9%] Built target imgui
[ 12%] Built target Core
[ 38%] Built target Alembic
[ 58%] Built target Framework
[ 60%] Built target RenderCore
[ 60%] Built target ABCExporter
[ 62%] Built target ImWidgets
[ 65%] Built target IO
Scanning dependencies of target GLRenderEngine
[ 67%] Built target Volume
[ 69%] Built target HeightField
[ 70%] Built target RigidBody
[ 75%] Built target ParticleSystem
[ 75%] Building CXX object src/Rendering/Engine/OpenGL/CMakeFiles/GLRenderEngine.dir/gl/Program.cpp.o
[ 79%] Built target Peridynamics
[ 79%] Linking CUDA device code CMakeFiles/GLRenderEngine.dir/cmake_device_link.o
[ 79%] Linking CXX static library ../../../../lib/Release/libGLRenderEngine.a
[ 85%] Built target GLRenderEngine
[ 86%] Linking CUDA device code CMakeFiles/GlfwGUI.dir/cmake_device_link.o
[ 86%] Linking CXX shared library ../../../../lib/Release/libdynoGlfwGUI-0.6.0.so
[ 86%] Built target GlfwGUI
[ 86%] Linking CUDA device code CMakeFiles/GL_GlfwGUI.dir/cmake_device_link.o
[ 86%] Linking CUDA device code CMakeFiles/GL_Bricks.dir/cmake_device_link.o
[ 87%] Linking CUDA device code CMakeFiles/GL_Buoyancy.dir/cmake_device_link.o
[ 87%] Linking CUDA device code CMakeFiles/GL_InstanceVisualizer.dir/cmake_device_link.o
[ 88%] Linking CUDA device code CMakeFiles/GL_CapillaryWave.dir/cmake_device_link.o
[ 88%] Linking CUDA device code CMakeFiles/GL_Cloth.dir/cmake_device_link.o
[ 88%] Linking CUDA device code CMakeFiles/GL_Elasticity.dir/cmake_device_link.o
[ 88%] Linking CUDA device code CMakeFiles/GL_CollisionMask.dir/cmake_device_link.o
[ 88%] Linking CXX executable ../../bin/Release/GL_GlfwGUI
[ 89%] Linking CXX executable ../../bin/Release/GL_Buoyancy
[ 89%] Linking CXX executable ../../bin/Release/GL_Bricks
[ 89%] Linking CXX executable ../../bin/Release/GL_Elasticity
[ 89%] Linking CXX executable ../../bin/Release/GL_CapillaryWave
[ 89%] Linking CXX executable ../../bin/Release/GL_CollisionMask
[ 89%] Linking CXX executable ../../bin/Release/GL_InstanceVisualizer
[ 89%] Linking CXX executable ../../bin/Release/GL_Cloth
[ 89%] Built target GL_GlfwGUI
[ 90%] Linking CUDA device code CMakeFiles/GL_Ocean.dir/cmake_device_link.o
[ 91%] Built target GL_CollisionMask
[ 91%] Built target GL_Elasticity
[ 91%] Built target GL_Cloth
[ 91%] Built target GL_Buoyancy
[ 92%] Built target GL_Bricks
[ 93%] Built target GL_InstanceVisualizer
[ 93%] Built target GL_CapillaryWave
[ 93%] Linking CUDA device code CMakeFiles/GL_OceanPatch.dir/cmake_device_link.o
[ 93%] Linking CUDA device code CMakeFiles/GL_ParticleEmitter.dir/cmake_device_link.o
[ 94%] Linking CUDA device code CMakeFiles/GL_ParticleFluid.dir/cmake_device_link.o
[ 94%] Linking CUDA device code CMakeFiles/GL_Plasticity.dir/cmake_device_link.o
[ 94%] Linking CUDA device code CMakeFiles/GL_Timing.dir/cmake_device_link.o
[ 94%] Linking CUDA device code CMakeFiles/GL_TwoTets.dir/cmake_device_link.o
[ 94%] Linking CXX executable ../../bin/Release/GL_Ocean
[ 94%] Linking CUDA device code CMakeFiles/GL_TwoBoxes.dir/cmake_device_link.o
[ 94%] Linking CXX executable ../../bin/Release/GL_ParticleFluid
[ 94%] Built target GL_Ocean
[ 96%] Linking CXX executable ../../bin/Release/GL_Timing
[ 96%] Linking CXX executable ../../bin/Release/GL_OceanPatch
[ 96%] Linking CXX executable ../../bin/Release/GL_Plasticity
[ 96%] Linking CXX executable ../../bin/Release/GL_ParticleEmitter
[ 96%] Linking CXX executable ../../bin/Release/GL_TwoTets
[ 97%] Linking CUDA device code CMakeFiles/GL_Wireframe.dir/cmake_device_link.o
[ 97%] Linking CXX executable ../../bin/Release/GL_TwoBoxes
[ 97%] Linking CXX executable ../../bin/Release/GL_Wireframe
[ 98%] Built target GL_ParticleFluid
[ 98%] Built target GL_OceanPatch
[ 98%] Linking CUDA device code CMakeFiles/GL_GhostSPH.dir/cmake_device_link.o
[ 98%] Built target GL_Timing
[ 99%] Built target GL_TwoTets
[ 99%] Built target GL_ParticleEmitter
[ 99%] Built target GL_Plasticity
[ 99%] Built target GL_TwoBoxes
[100%] Linking CXX executable ../../../bin/Release/GL_GhostSPH
[100%] Built target GL_Wireframe
[100%] Built target GL_GhostSPH
$ cd bin/Release
$ ./GL_GlfwGUI
git clone https://github.com/SaschaWillems/Vulkan.git
git submodule sync
git submodule update --init --recursive
mkdir build
cd build
cmake ..
make
If Vulkan is installed, you can choose Vulkan mode for compilation:
PeriDyno supports plugin integration. By default, plugins are disabled to improve compilation speed. To use plugins, enable the PERIDYNO_LIBRARY_PLUGIN option during the CMake configuration phase:
After reconfiguring and regenerating with Configure and Generate, optional plugins will become available:
sudo apt-get install build-essential
sudo apt-get install qtcreator
sudo apt-get install qt5-default
sudo apt-get install libqt5svg5*
hehao@hehao:~/peridyno-gitee/build$ cmake -D PERIDYNO_Qt5_GUI=ON ..
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- The CUDA compiler identification is NVIDIA 11.6.55
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working CUDA compiler: /usr/local/cuda-11.6/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda-11.6/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda-11.6 (found version "11.6")
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Using X11 for window creation
-- Found X11: /usr/include
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hehao/peridyno-gitee/build
$ make -j8
hehao@hehao:~/peridyno-gitee/build$ make -j8
[ 1%] Automatic MOC for target nodes
[ 2%] Built target glad
[ 6%] Built target glfw
[ 9%] Built target Core
[ 9%] Built target nodes_autogen
[ 11%] Built target imgui
[ 21%] Built target nodes
[ 44%] Built target Framework
[ 46%] Built target RenderCore
[ 50%] Built target IO
[ 52%] Built target ImWidgets
[ 54%] Built target Volume
[ 56%] Built target RigidBody
[ 63%] Built target GLRenderEngine
[ 63%] Automatic MOC and UIC for target QtGUI
[ 64%] Built target GlfwGUI
[ 66%] Built target Interaction
[ 70%] Built target Modeling
[ 70%] Built target QtGUI_autogen
[ 75%] Built target ParticleSystem
[ 75%] Built target GL_GlfwGUI
[ 76%] Built target GL_InstanceVisualizer
[ 78%] Built target GL_SegmentVisualizer
[ 78%] Built target GL_MouseInteractionInGraphicsPipeline
[ 78%] Built target GL_MouseInteraction
[ 78%] Built target GL_Topology
[ 80%] Built target HeightField
[ 84%] Built target Peridynamics
[ 97%] Built target QtGUI
[ 99%] Built target Qt_Bricks
[ 99%] Built target Qt_MarchingCubes
[ 99%] Built target Qt_ShowChinese
[ 99%] Built target Qt_Pickers
[ 99%] Built target Qt_GUI_Empty
[100%] Built target Qt_MouseInteractionInGraphicsPipeline
The Wt framework server can be installed for headless server environments.
https://redmine.emweb.be/projects/wt/wiki/Installing_Wt_on_Ubuntu
Install uuid for Wt component ID generation:
$ sudo apt install uuid uuid-dev
$ pip install pybind11
Regenerate with CMake
Use:
-DPERIDYNO_WT_GUI:BOOL=ON to compile PeriDyno’s Wt library
-DPERIDYNO_PYTHON_BINDING:BOOL=ON to compile the PyPeridyno library
Compile and Run
After compilation, execute the WtGUI sample:
$ cd bin/Release
$ ./Wt_EmptyGUI
Access via browser at: http://localhost:5000/
Example output: