Debugging Numerical Instability in AVX512-Optimized 2D Fluid Simulation on x86-64 CPU

In the process of me optimizing a 2D fluid simulation for x86-64 CPU using AVX512 instructions, Intel Xeon architecture , scalable processor with AVX512 support, GCC 12 compiler with -O3 optimization flags having periodic boundary conditions using explicit euler time stepping s heme I've implemented a staggered grid-based approach with a finite difference method for calculating fluid forces, but I'm encountering numerical instability issues when simulating large-scale fluid dynamics. Here is my AVX512 optimized force calculation kernel
attachment 0
Solution:
@Marvee Amasi It sounds like you're running into stability issues with your fluid simulation, especially with the explicit Euler scheme on a large grids, to address the numerical instability, try reducing the time step or switching to a more stable method like implicit Euler. Make sure your time step meets the CFL condition to avoid instability. r-check your periodic boundary conditions for errors, and be cautious with AVX512 optimizations, as they can amplify floating-point precision issues. The Floating point exception could indicate division by zero or overflow, so make sure your calculations are well-guarded. To debug, simplify your simulation or use tools like valgrind and gdb to catch errors. These steps should help stabilize your simulation....
Jump to solution
4 Replies
Marvee Amasi
Marvee Amasi5mo ago
I've tried various optimization techniques like loop unrolling, data alignment, even fused multiply-add instructions, but the numerical instability persists. I'm getting inaccurate results and the simulation becomes unstable after a few time steps. I'm encountering the following error message when running the simulation with a large number of particles:
Floating point exception (core dumped)
Floating point exception (core dumped)
I suspect it might be related to numerical instability, boundary conditions, or potential issues with the staggered grid implementation. I've tried using different time stepping schemes and boundary conditions, but the problem persists. I'm wondering if there are any known pitfalls or optimization techniques for staggered grid-based fluid simulations using AVX512. Any insights or suggestions on debugging the numerical instability or improving performance would be greatly appreciated
Solution
Renuel Roberts
Renuel Roberts4mo ago
@Marvee Amasi It sounds like you're running into stability issues with your fluid simulation, especially with the explicit Euler scheme on a large grids, to address the numerical instability, try reducing the time step or switching to a more stable method like implicit Euler. Make sure your time step meets the CFL condition to avoid instability. r-check your periodic boundary conditions for errors, and be cautious with AVX512 optimizations, as they can amplify floating-point precision issues. The Floating point exception could indicate division by zero or overflow, so make sure your calculations are well-guarded. To debug, simplify your simulation or use tools like valgrind and gdb to catch errors. These steps should help stabilize your simulation.
techielew
techielew4mo ago
@Marvee Amasi
Marvee Amasi
Marvee Amasi3mo ago
Yh I started using gdb for this and most projects with disturbing issues My time step was out of line with CFL condition, that's where the instability startrd from Thanks @Enthernet Code
Want results from more Discord servers?
Add your server