bernardparent / CFDWARP

Computational Fluid Dynamics, Waves, Reactions, Plasmas
https://overbrace.com/bernardparent/viewforum.php?f=22
45 stars 23 forks source link

no restrict pointer is used in the code #2

Closed aerosayan closed 2 years ago

aerosayan commented 3 years ago

Hello, I don't know if you're still around. I was studying your code, and was really impressed.

However, I do code optimization for a living and I saw that not even one restrict pointer was used in the code base.

That means, the whole code base possibly suffers from performance degradation due to pointer aliasing : https://stackoverflow.com/questions/146159/

I say possibly, since I don't know if you've used some other method to optimize your code, such that it performs as good as an equivalent Fortran code.

Without restrict pointers, it is my understanding that C/C++ codes can't be as efficient as Fortran codes, specifically for operations over large arrays of data.

bernardparent commented 3 years ago

Sayan, thanks for the feedback. I doubt CFDWARP is substantially slower than a fortran code for the same physical model. This has been verified (through the years, many times ..) especially for the Navier-Stokes_perfect module (no chemical reactions). If using restrict pointers leads to a performance gain of a few percent, and if such means significantly more complex coding, we won't do it. If you can demonstrate to us that there is a large advantage in doing so (performance gains of more than 30%), we'll look into it. Otherwise, better to stick to keep the code easier to read and debug.

On Thu, Jul 22, 2021 at 5:32 AM Sayan Bhattacharjee < @.***> wrote:

Hello, I don't know if you're still around. I was studying your code, and was really impressed.

However, I do code optimization for a living and I saw that not even one restrict pointer was used in the code base.

That means, the whole code base possibly suffers from performance degradation due to pointer aliasing : https://stackoverflow.com/questions/146159/

I say possibly, since I don't know if you've used some other method to optimize your code, such that it performs as good as an equivalent Fortran code.

Without restrict pointers, it is my understanding that C/C++ codes can't be as efficient as Fortran codes, specifically for operations over large arrays of data.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bernardparent/CFDWARP/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ4M5DVNJHTUK2TC5WD46TTTZAFXVANCNFSM5AZ5FE3A .