Defination of the variables for DEM in GPU

I have a confusion about the defination of the variables for DEM in GPU. In file JSphGpu.h, the variables for DEM were defined using "float4 *DemDatag". But the there are only 4 variables, mass, (1-poisson^2)/young, kfric, restitu, respectively. If I wanted to add 2 variables or more variables, how can I realize it? Looking forward to your aid.

Comments

  • firstly you should make sure you got no problems with rebuilding the project.

    I'll tell you what is simpler but not the smarter:
    - define your new variables in JSph class and so they are now readable in JSphCpuSingle and JSphGpuSingle.
    - the both previous classes have a function called Run, make a direct entry of your variables inside it. you can use cin after including iostream.
    - for Cpu now you might can use your variables now
    - for Gpu you should make sure that the variables are transferred from host memory (CPU processor) to device memory (GPU card). this id done by: 1- allocating memory on host 2- making corresponding variables on device 3- copying from host to device

    for the last step on GPU you may find the subroutines that do this already exist, and insert your variables beside the original ones

    also if your variables are constants you may define them inside the CUDA kernel to avoid these steps and save the budget of memory transfer.

    CUDA is somehow complex and the best guide is the official one which can be downloaded from Nvidia "CUDA_C_Programming_Guide Nvidia". I think you should practice some direct examples on CUDA before you open DualSPHysics (GPU) for editing.

    I hope that helped - If I made any mistakes please forgive me
    Sincerely .
  • Many thanks to you, Ahsry.
Sign In or Register to comment.