Skip to content

Lecrapouille/Janus

 
 

Repository files navigation

Janus

Project-based on Angel Uriot's Galaxy_simulation in which we add negative masses and apply either Newton (m gamma = mM/d^2) or anti-Newton law (|m| gamma = mM/d^2). More information on this model: https://www.januscosmologicalmodel.fr/post/janus

Compilation Linux

sudo apt-get install pkg-config ocl-icd-opencl-dev opencl-clhpp-headers libsfml-dev libglm-dev libglew-dev libglfw3-dev libdw-dev

git clone https://github.com/Lecrapouille/Janus.git --recursive
cd Janus
make download-external-libs

make download-external-libs reads external/manifest: Dimension3D, Dear ImGui (docking, required by Dimension3D), imgui-sfml 2.6.x (plus patches/imgui-sfml-imgui192.patch for ImGui ≥ 1.92 texture API), Khronos OpenCL-Headers, Khronos OpenCL-CLHPP. You still need an OpenCL ICD (ocl-icd, GPU driver, or CPU runtime) to link and run.

make -j`nproc --all`

./build/Janus

Fedora / RHEL (RPM)

Pour libOpenCL (liaison -lOpenCL), Fedora utilise les paquets Khronos sous ces noms (pas toujours ocl-icd seuls) :

# Chargeur ICD + lien /usr/lib64/libOpenCL.so + OpenCL.pc (pkg-config)
sudo dnf install OpenCL-ICD-Loader-devel

Sur certaines versions on peut encore avoir ocl-icd / ocl-icd-devel à la place ou en doublon ; dans tous les cas il faut le paquet -devel qui fournit la bibliothèque pour le linker.

Ensuite installez au moins une implémentation OpenCL (sinon le programme peut linker mais ne voir aucun appareil) :

  • GPU AMD / pilote Mesa : sudo dnf install mesa-libOpenCL
  • Intel GPU : sudo dnf install intel-compute-runtime (ou intel-opencl selon dépôts)
  • CPU / essais : sudo dnf install pocl

Dépendances de build du projet (exemple) :

sudo dnf install pkgconf-pkg-config glm-devel SFML-devel glew-devel glfw-devel libdw-devel OpenCL-ICD-Loader-devel

(glm-devel n’expose pas de glm.pc sur Fedora : ce n’est pas un problème, GLM est en-têtes seuls et le Makefile ne le passe plus à pkg-config.)

Note: You need SFML v2.6 (not the v 3.0).

Possible issue

  • Depending on whether you are using Ubuntu 20, Ubuntu 22, or Debian 11, you may need to modify the OpenCL header in libraries.hpp. Choose between #include <CL/opencl.hpp> and #include <CL/cl2.hpp>.
  • Fedora : installer OpenCL-ICD-Loader-devel (ou ocl-icd-devel) pour -lOpenCL ; voir section Fedora ci‑dessus. Avec ce paquet, pkg-config OpenCL fonctionne en général.
  • Not working for MacOS because OpenCL cannot be used because Apple no longer supports OpenGL 4.x used by OpenCL.

Some screenshots

Two colors: red for positive masses, green for negative masses.

unnamed

collision_newton_30p

unnamed2

Videos

https://www.youtube.com/watch?v=DqYU1c410II

About

An n-body type simulation using GPU acceleration to simulate galaxies, galaxy collisions and expanding universes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C++ 82.3%
  • Makefile 8.8%
  • C 5.3%
  • GLSL 3.6%