Neighbour Lists seemingly not created on the GPU

Good afternoon! I’m having trouble with creating neihbour lists on the GPU (CUDA/Quadro).

I was suspecting that due to “neigh yes” and “neigh no” simulations outputting essentially the same time and results, started tracking the gpu_mode and gpu_nbor constants and arrived at the fact that gpu_mode keeps being 1 within init_device (lib/gpu/lal_device.cpp:71), however when creating a potential and checking the constant from BaseAtomic (lib/gpu/lal_base_atomic.cpp) it returns 0 and thus builds the lists on the CPU.

Originally I thought it might be due to the potentials hard-coding GPU_FORCE = 0 in the initialisation list, but changing that doesn’t seem to affect anything.

It might be some issue with my lammps build, but considering it hasn’t thrown any errors and seems to work fine in a CPU neighbour lists + GPU simulation calc, I’m not certain what is the issue. However, considering that the long-term goal is adapting one of our lab’s potentials for GPU use, I could have messed something up.

So, the question is, where is the gpu_mode constant controlled from? Or maybe there is some other way to figure out the reason for this behaviour?

Thank you.

The choice of whether the neighbor list is constructed on the GPU or not is controlled via the “package gpu” program which passes its arguments to the constructor of the internal fix GPU command.
This will then call the device initialization function.

The best way to get started with a new potential is to look at the existing ones and pick the one that is the most similar to the new potential (in terms of parameters and flow of control) and then make a copy and rename the functions and classes accordingly. The you can replace the evaluation of the potential with your new potential.

All existing GPU package potentials are based on a corresponding CPU based implementation and only offload the compute method to the GPU.