Skip to content

SuperLatticePhysHeatFlux3D Different Results on GPU vs CPU

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB Bug Reports SuperLatticePhysHeatFlux3D Different Results on GPU vs CPU

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #7812

    Dear OpenLB Developers,

    I have figured out that SuperLatticePhysHeatFlux3D gives different results when ran on GPU. I believe, CPU gives the correct results. For the CPU, I have tested on both mpirun 6 cores and 1 core (Gives the same results). For the GPU, no parallelization.

    I couldn`t really understand the reason. You could easily check by looking at a randomly selected 2D plane (Please check point-wise values).



    SuperLatticePhysHeatFlux3D is a functor which means that it operates only on CPU side data. Any difference in results between CPU and GPU would have to come from the model side (be it a bug or FPT implementation differences).

    Just to make sure: You are synchronizing the relevant data from GPU to CPU (setProcessingContext) prior to evaluating the functor in your case?


    Hi Adrian,

    Thank you for your answer. It works now!

    Just as a hint for the other users, you have to setProcessingContext before and after the steps of setting boundary values when you are updating the values during run-time.



    Glad to hear it.

    Just adding to your hint: While it makes sense to synchronize the entire state to CPU for post processing results (i.e. call sLattice.setProcessingContext(ProcessingContext::Evaluation)), doing the “copy-to-CPU-update-copy-to-GPU” roundtrip is often not necessary and can reduce performance.
    E.g. if you only update the inflow velocity it can be sufficient to update the data on CPU and copy only the relevant field to GPU. There also is the option of using background processing to hide IO while the simulation continues. See e.g. the turbulence/nozzle3d case for an application of these concepts.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.