Are you running on a GPU? If so, then atom variables like positions, forces, velocities, etc. may not be in sync between GPU and CPU. Otherwise it should work
in theory, but I haven’t tested it. If you have a small case that reproduces the issue I can take a look.
From: Steve Plimpton [mailto:sjplimp@...24...]
Sent: Tuesday, July 11, 2017 7:51 AM
To: Axel Kohlmeyer <akohlmey@...24...>; Moore, Stan <stamoor@...3...>
Cc: Duan, Zhiyao <zhiyao.duan@...6975...>; firstname.lastname@example.org
Subject: [EXTERNAL] Re: [lammps-users] use kokkos in lammps library
It might depend on what the variable you
are extracting calculates. When Kokkos is
run with GPUs, then some per-atom data lives
on the GPU, and just a copy on the CPU. If
the variable is using per-atom values, it would
only be accessing the CPU values. Which may
not be up to date with the GPU. In LAMMPS
runs, there is logic in the code to insure the
CPU and GPU values are in-sync when needed.
That logic may not be present when just accessing
a variable via a library method.
Stan (CCd) can probably comment.
On Tue, Jul 11, 2017 at 6:43 AM, Axel Kohlmeyer <akohlmey@...24...> wrote:
On Tue, Jul 11, 2017 at 3:12 AM, Duan, Zhiyao <zhiyao.duan@...6975...> wrote:
> Dear all,
> I wonder if kokkos is compatible with lammps library mode?
there are no provisions for KOKKOS in the library interface. so for as
long as you are doing operations, that are compatible with normal
input scripts, it should function like a regular LAMMPS executable.
however, if you are modifying data directly, that needs to be managed
special with KOKKOS, then it is not likely to work.
> I tried to extract energy and forces using lammps_extract_variable, but all returned values are 0.
> The code works well in non-kokkos mode.
there is no special treatment of variables by KOKKOS and no KOKKOS
related operations in the lammps_extract_variable() function, so
reading of variables should work as well with the library interface
(or not) as in a standalone executable.
> Any ideas? Thank you in advance.
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org!
> lammps-users mailing list
Dr. Axel Kohlmeyer akohlmey@...24...
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.