Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible fix to hippynn via mliap interface CPU failure #60

Open
Montana opened this issue Feb 5, 2024 · 0 comments
Open

Possible fix to hippynn via mliap interface CPU failure #60

Montana opened this issue Feb 5, 2024 · 0 comments

Comments

@Montana
Copy link

Montana commented Feb 5, 2024

For reference:

# Assuming fij and atom_energy are tensors and data is an object with an eatoms attribute
if return_device == "cpu":
    # Convert tensors to numpy arrays if we're moving them to CPU
    fij = fij.cpu().numpy()  # Ensure fij is moved to CPU before converting to numpy array
    data.eatoms = atom_energy.cpu().numpy().astype(np.double)  # Move atom_energy to CPU, then convert
else:
    # Ensure eatoms is a tensor on the target device, and copy atom_energy to it
    # The .to() method ensures the tensor is moved to the specified device and converted to the desired dtype
    eatoms = atom_energy.to(device=return_device, dtype=torch.double)
    data.eatoms = eatoms  # Update data.eatoms with the new tensor

    # If you need to preserve the original eatoms tensor and only copy values from atom_energy, use the following:
    data.eatoms = torch.empty_like(atom_energy, device=return_device, dtype=torch.double)
    data.eatoms.copy_(atom_energy.to(device=return_device, dtype=torch.double))

I've also tried to run it without the kokkos package, you can adjust the command by simply omitting the options related to kokkos. Some of the options offered like -sf kk, -k on, and -pk kokkos are specific to enabling and configuring the kokkos package for parallel execution on various architectures.

If your original command line call to LAMMPS includes these options, such as:

lmp -sf kk -k on -pk kokkos

To run LAMMPS without Kokkos, you would remove -sf kk, -k on, and -pk kokkos options, leaving you with:

lmp 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant