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

Support CUDA Graphs #68

Closed
wants to merge 25 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Enable the testing of CUDA Graph
Raimondas Galvelis committed Feb 25, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 41eb4398577bede4a716924341cace2cd6789e94
10 changes: 7 additions & 3 deletions python/tests/TestTorchForce.py
Original file line number Diff line number Diff line change
@@ -6,12 +6,12 @@
import torch as pt
from tempfile import NamedTemporaryFile

@pytest.mark.parametrize('model_file, output_forces,',
@pytest.mark.parametrize('model_file, output_forces',
[('../../tests/central.pt', False),
('../../tests/forces.pt', True)])
@pytest.mark.parametrize('platform', ['Reference', 'CPU', 'CUDA'])
@pytest.mark.parametrize('platform, use_graph', [('Reference', False), ('CPU', False), ('CUDA', False), ('CUDA', True)])
@pytest.mark.parametrize('precision', ['single', 'mixed', 'double'])
def testEnergyForce(model_file, output_forces, platform, precision):
def testEnergyForce(model_file, output_forces, platform, precision, use_graph):

if pt.cuda.device_count() < 1 and platform == 'CUDA':
pytest.skip('A CUDA device is not available')
@@ -28,6 +28,10 @@ def testEnergyForce(model_file, output_forces, platform, precision):
assert not force.getOutputsForces() # Check the default
force.setOutputsForces(output_forces)
assert force.getOutputsForces() == output_forces
assert force.getPlatformProperty('CUDAGraph') == ''
if use_graph:
force.setPlatformProperty('CUDAGraph', 'true')
assert force.getPlatformProperty('CUDAGraph') == 'true'
system.addForce(force)

# Set up a simulation