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

Add test to check platform precision using a string + fix error #551

Merged
merged 2 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions openmmtools/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ def test_platform_supports_precision():
if supported_precisions != set(['mixed']):
raise Exception(f"'CPU' platform should support 'mixed' precision, but platform_supports_precision reports {supported_precisions}")


def test_string_platform_supports_precision():
"""Test that if we use a string for the platform name, it works"""
assert platform_supports_precision("CPU", "mixed")

# =============================================================================
# TEST STRING MATHEMATICAL EXPRESSION PARSING UTILITIES
# =============================================================================
Expand Down
4 changes: 0 additions & 4 deletions openmmtools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,6 @@ def platform_supports_precision(platform, precision):
return precision in ['mixed']

if platform.getName() in ['CUDA', 'OpenCL']:
try:
import openmm
except ImportError: # OpenMM < 7.6
from simtk import openmm
properties = { 'Precision' : precision }
system = openmm.System()
system.addParticle(1.0) # Cannot create Context on a system with no particles
Expand Down