OpenCL based GPU accelerated SPH fluid simulation library

Overview

libclsph

An OpenCL based GPU accelerated SPH fluid simulation library

Can I see it in action?

Demo #1
Demo #2

Why?

Libclsph was created to explore the possibilty of using the power of OpenCL to speed up the simulation of SPH fluid mechanics.

Smoothed particle hydrodynamics is a fluid simulation technique that can be used to produce realistic simulations for animation,CGI or videogames.

How ?

Libclsph uses C++11 and OpenCL to run simulations. Results are exported using industry standards and can then be used in programs like houdini. Simulation properties can be easily modified by the user.

Getting started

Be sure to visit the wiki for more information and detailed instructions on how to get started.

Libraries used

  • picojson is used to load simulation properties from files.
  • cereal is used for all serialization needs.
  • partio is used to import/export particle data.
  • tinyobjloader is used to load geometry in obj format.
Comments
  • Improve build system

    Improve build system

    Ideally, the build system would include the following:

    1. configure script
    2. separate Makefile for example
    3. conditional compilation of certain features (goes along point 1.)
    enhancement 
    opened by anthonyvd 1
  • Introduce an adaptable grid

    Introduce an adaptable grid

    The grid fitted to the particles must be adaptable, otherwise we would need to allocate an impossibly large amount of memory when dealing with a high amount of low mass particles.

    opened by anthonyvd 1
  • Integrate Partio

    Integrate Partio

    Write files in bgeo format to save time.

    Example program that uses partio : https://gist.github.com/OlivierLi/9043673

    How to compile a program and link with partio :

    g++ test.cpp libpartio.a -lz

    enhancement 
    opened by OlivierLi 0
  • More input validation

    More input validation

    The user should be notified it he starts a simulation using suboptimal parameters.

    Optimal settings are detailed here : https://github.com/libclsph/libclsph/wiki/Getting-the-best-performance.

    enhancement 
    opened by OlivierLi 0
  • Partition work groups in a more efficient way.

    Partition work groups in a more efficient way.

    Local memory is declared as a kernel argument like so : kernel void myKernel(const int length, const int height, local float* LP,local float* LT,...)

    Then async_work_group_copy is used to copy the particles frome global memory to local memory.

    __kernel void test( __local float* local_data,__global float *global_data,int group_size) {
    
    .
    .
    .
    
      event_t e = async_work_group_copy(LF, global_data+group_id*group_size, group_size, 0);
      wait_group_events(1, &e);
    
      //Now calls are made using local memory only
    }
    
    
    opened by OlivierLi 0
  • Use an adaptive time step

    Use an adaptive time step

    The largest time-step possible should be used to increase the speed of the simulation.

    This means the time step should have a reasonably high starting value, for example 0.1.

    Then during each frame we check if the CFL was broken.

    If it was then we need to simulate the frame again with a smaller time step.

    opened by OlivierLi 0
  • Add OpenGL Output

    Add OpenGL Output

    Hi, I am playing with your lib on OSX, and I am curious if it will be possible to add a basic 3D rendering.

    I am translating the library into Javascript using WebCL, and a 3D output in WebGL will be really nice.

    What do you think ? Seems possible to add it ?

    enhancement 
    opened by wolfviking0 2
  • Simulation Parameters structure might be becoming too large

    Simulation Parameters structure might be becoming too large

    Encountered a bug where merely adding a member to the simulation parameters struct broke only parts of the simulation (collisions in this case). I suspect the struct might be becoming too large to be passed at that point in the sim and therefore suggest moving all parameters that aren't needed on the GPU directly to the sph_simulation class.

    More diagnostics would be required to try and pinpoint the exact cause of this issue.

    bug 
    opened by anthonyvd 0
Owner
null
A C++ GPU Computing Library for OpenCL

Boost.Compute Boost.Compute is a GPU/parallel-computing library for C++ based on OpenCL. The core library is a thin C++ wrapper over the OpenCL API an

Boost.org 1.3k Dec 30, 2022
VexCL is a C++ vector expression template library for OpenCL/CUDA/OpenMP

VexCL VexCL is a vector expression template library for OpenCL/CUDA. It has been created for ease of GPGPU development with C++. VexCL strives to redu

Denis Demidov 683 Nov 27, 2022
A small C OpenCL wrapper

oclkit, plain and stupid OpenCL helper oclkit is a small set of C functions, to avoid writing the same OpenCL boiler plate over and over again, yet ke

Matthias Vogelgesang 15 Jul 22, 2022
ArrayFire: a general purpose GPU library.

ArrayFire is a general-purpose library that simplifies the process of developing software that targets parallel and massively-parallel architectures i

ArrayFire 4k Dec 27, 2022
Sqrt OS is a simulation of an OS scheduler and memory manager using different scheduling algorithms including Highest Priority First (non-preemptive), Shortest Remaining Time Next, and Round Robin

A CPU scheduler determines an order for the execution of its scheduled processes; it decides which process will run according to a certain data structure that keeps track of the processes in the system and their status.

null 10 Sep 7, 2022
Discrete-event simulation in C++20 using coroutines

SimCpp20 SimCpp20 is a discrete-event simulation framework for C++20. It is similar to SimPy and aims to be easy to set up and use. Processes are defi

Felix Schütz 34 Nov 15, 2022
KRATOS Multiphysics ("Kratos") is a framework for building parallel, multi-disciplinary simulation software

KRATOS Multiphysics ("Kratos") is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.

KratosMultiphysics 774 Dec 29, 2022
Patterns and behaviors for GPU computing

moderngpu 2.0 (c) 2016 Sean Baxter You can drop me a line here Full documentation with github wiki under heavy construction. Latest update: 2.12 2016

null 1.4k Jan 5, 2023
Optimized primitives for collective multi-GPU communication

NCCL Optimized primitives for inter-GPU communication. Introduction NCCL (pronounced "Nickel") is a stand-alone library of standard communication rout

NVIDIA Corporation 1.9k Dec 30, 2022
stdgpu: Efficient STL-like Data Structures on the GPU

stdgpu: Efficient STL-like Data Structures on the GPU Features | Examples | Documentation | Building | Integration | Contributing | License | Contact

Patrick Stotko 777 Jan 8, 2023
ParallelComputingPlayground - Shows different programming techniques for parallel computing on CPU and GPU

ParallelComputingPlayground Shows different programming techniques for parallel computing on CPU and GPU. Purpose The idea here is to compute a Mandel

Morten Nobel-Jørgensen 2 May 16, 2020
Termite-jobs - Fast, multiplatform fiber based job dispatcher based on Naughty Dogs' GDC2015 talk.

NOTE This library is obsolete and may contain bugs. For maintained version checkout sx library. until I rip it from there and make a proper single-hea

Sepehr Taghdisian 35 Jan 9, 2022
A library for enabling task-based multi-threading. It allows execution of task graphs with arbitrary dependencies.

Fiber Tasking Lib This is a library for enabling task-based multi-threading. It allows execution of task graphs with arbitrary dependencies. Dependenc

RichieSams 796 Dec 30, 2022
C++20 coroutines-based cooperative multitasking library

?? Coop Coop is a C++20 coroutines-based library to support cooperative multitasking in the context of a multithreaded application. The syntax will be

Jeremy Ong 81 Dec 9, 2022
A C++20 coroutine library based off asyncio

kuro A C++20 coroutine library, somewhat modelled on Python's asyncio Requirements Kuro requires a C++20 compliant compiler and a Linux OS. Tested on

null 19 Nov 9, 2022
C++20 Coroutine-Based Synchronous Parser Combinator Library

This library contains a monadic parser type and associated combinators that can be composed to create parsers using C++20 Coroutines.

null 46 Dec 17, 2022
A C++17 message passing library based on MPI

MPL - A message passing library MPL is a message passing library written in C++17 based on the Message Passing Interface (MPI) standard. Since the C++

Heiko Bauke 115 Dec 28, 2022
DwThreadPool - A simple, header-only, dependency-free, C++ 11 based ThreadPool library.

dwThreadPool A simple, header-only, dependency-free, C++ 11 based ThreadPool library. Features C++ 11 Minimal Source Code Header-only No external depe

Dihara Wijetunga 27 Oct 28, 2022
C++14 coroutine-based task library for games

SquidTasks Squid::Tasks is a header-only C++14 coroutine-based task library for games. Full project and source code available at https://github.com/we

Tim Ambrogi Saxon 74 Nov 30, 2022