Skip to content

Use torch.det to calculate volumes#130

Merged
janosh merged 1 commit intoCederGroupHub:mainfrom
tsihyoung:volume_by_det
Feb 27, 2024
Merged

Use torch.det to calculate volumes#130
janosh merged 1 commit intoCederGroupHub:mainfrom
tsihyoung:volume_by_det

Conversation

@tsihyoung
Copy link
Copy Markdown
Contributor

Summary

torch.cross without dim is deprecated.

Todos

I'm not sure whether we need a torch.abs here.

`torch.cross` without `dim` is deprecated.
Copy link
Copy Markdown
Collaborator

@janosh janosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

torch.det was the last tensor op in chgnet lacking MPS support which is why we refactored to torch.dot(lattice[0], torch.cross(lattice[1], lattice[2])) to support MPS earlier. based on tests passing on macos-14, looks like torch.det is now implemented in MPS so happy to merge.

@janosh janosh merged commit 5a25b2c into CederGroupHub:main Feb 27, 2024
@tsihyoung tsihyoung deleted the volume_by_det branch February 27, 2024 14:00
@tsihyoung
Copy link
Copy Markdown
Contributor Author

torch.det was the last tensor op in chgnet lacking MPS support which is why we refactored to torch.dot(lattice[0], torch.cross(lattice[1], lattice[2])) to support MPS earlier. based on tests passing on macos-14, looks like torch.det is now implemented in MPS so happy to merge.

I tested torch.det on my Apple Silicon machine with pytorch == 2.2.1. Unfortunately, it still complains thatNotImplementedError: The operator 'aten::_linalg_det.result' is not currently implemented for the MPS device.

Currently, maybe we should change the code to torch.dot(lattice[0], torch.cross(lattice[1], lattice[2], dim=-1)).

@janosh
Copy link
Copy Markdown
Collaborator

janosh commented Feb 27, 2024

interesting, that means the tests on macos-14 aren't actually using MPS. wonder why...

edit: CI logs show CHGNet will run on cpu so indeed MPS is untested

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

Successfully merging this pull request may close these issues.

2 participants