百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

StellarSolver

> 编程语言
开源

高性能的 N-Body 模拟,采用 CUDA 和 Barnes-Hut 算法。这是一个艰难的任务,也是一个持续了近两百个文明的努力,解决三体问题的努力,寻找太阳运行规律的努力。

362 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

高性能的 N-Body 模拟,采用 CUDA 和 Barnes-Hut 算法。这是一个艰难的任务,也是一个持续了近两百个文明的努力,解决三体问题的努力,寻找太阳运行规律的努力。

StellarSolver: High-Performance N-Body Simulation with CUDA and Barnes-Hut Algorithm

Overview

StellarSolver is a comprehensive tool designed for simulating the n-body problem, utilizing the Barnes-Hut algorithm powered by CUDA. The project provides visualization through OpenGL, following Nvidia's CUDA toolkit examples. Currently, the visualization process is executed by the host, transferring data back at each time-step without utilizing CUDA-OpenGL interoperability due to system restrictions during development.

Prerequisites

StellarSolver necessitates the installation of Nvidia's CUDA toolkit on a system with a CUDA-capable device and a GCC compiler. The visualization component uses OpenGL, SFML, GLEW (OpenGL Extension Wrangler Library), and GLM (OpenGL Mathematics).

For CUDA installation, refer to the Nvidia CUDA download page and the CUDA Quick Start Guide. On Ubuntu, install SFML and GLEW by executing the following commands:

bash
sudo apt-get install libsfml-dev
sudo apt-get install libglew-dev

GLM, a collection of header files, can be acquired here. Ensure to update the makefile INCLUDE variable to set the path to the GLM directory.

Compilation

To compile the code, execute the following commands:

bash
make clean
make build

Execution

StellarSolver offers multiple command-line arguments for customization.

The standard execution of the Barnes-Hut algorithm with OpenGL visualization:

bash
./app -barnes-hut -opengl

Execution with benchmark statistics for 500 iterations:

bash
./app -barnes-hut -benchmark -iterations=500

Additional command-line options are detailed below:

  • -disk : Use a simple disk model (default).
  • -plummer : Use a Plummer model.
  • -colliding-disks : Use two colliding disks.
  • -opengl : Enable OpenGL visualization.
  • -benchmark : Output time statistics.
  • -debug : Run debug tests.
  • -iterations= : Define the number of iterations (defaults to 50).
  • -gravity= : Adjust the gravity parameter (defaults to 1.0).
  • -dampening= : Adjust the velocity dampening parameter (defaults to 1.0).

Additional Notes

Ensure to manually match the 'numbodies' variable in main.cpp and the 'blockSize' variables in kernels.cu and particle_cuda.cu. For instance, if you set numbodies = 64*64 in main.cpp, also set blockSize = 64 in kernels.cu, and blockSize = 64, gridSize = 64 in particle_cuda.cu.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言