🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

USE CPU calculation in CUDA GPU API

User: "Yang_QI1"
Altair Community Member
Updated by Yang_QI1

Hi,

When I write an API code in CUDA GPU, for example, calculate contact force with calculateForce(). I noticed that I need to define the main function for both CPU cpp and GPU cu files. Do both of the main functions calculate contact force or only GPU code is calculating? Besides, what shall I do if I want only my CPU code to run for a certain timestep and GPU code keep sleeping for that timestep?

Kindly regards,

Qi

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "Stephen Cole"
    Altair Employee
    Updated by Stephen Cole

    Hi Qi,

    If you are using the CUDA GPU solver (which you would be if it's a .cu file) then the physics model is run 100% on the GPU.  You can leave the physics section of the CPU blank if you like, all this would mean is that it would be GPU compatible only, not able to run on CPU.

     

    You do still need the 'extras' in the CPU code, not for the physics but some of the main things the CPU code does is:

    Passes the name of the .cu file to EDEM

    Passes the version of the code to EDEM

    Reads in any parameters from a .txt file in and passes these to the GPU

     

    It is a lot easier to debug in CPU with something like Visual Studio, so often code is written in the CPU and then any debugging/testing can be done on the CPU and the code the copied/ported to the GPU.  Not necessary but if you just write it for the GPU and have any problems with the physics you'd have to debug using printf.

     

    Regards

    Stephen