Porting fixes/pairs/computes/... to KOKKOS


You can look at the Kokkos programming guide: /lib/kokkos/doc/Kokkos_PG.pdf and Kokkos tutorials: lib/kokkos/example/tutorial. But for LAMMPS specific, at this point, the best thing to do is to look at existing fixes/pair styles/compute that have already been ported to Kokkos. If you have specific questions about Kokkos programming I'd be happy to answer them.


I agree that a short tutorial section added to the
LAMMPS docs would be useful: e.g. how to
Kokkos-ize a pair/fix/compute style. If Stan
or others want to write it up, we would add it.


I think I have just managed to port the morse potential to a
KOKKOS-enabled style. Two-pair potentials are relatively
straightforward I think, most of it is just replacing the one base
class with the other.
I don't have time right now but I can write down the steps later (end
of the month or so). For now I will just file a pull request for this
one pair style.

One important thing is that the allocate member function of the
inherited pair style, if any, needs to be virtual.
This was the case for lj/cut, but not for morse. Forgetting this leads
to a segfault at the time init_one is called, but only when running on
GPU, not on OMP. :confused:

I think this can be kludged around by defining a virtual allocate
member function in pair.h that does nothing, but I am not sure if that
is a desired solution.