Skip to content

Evaluate need for set_openmm_threads_1 in simulation tests #1295

@IAlibay

Description

@IAlibay

We now restrict the CPU count in vacuum simulations:

restrict_cpu = forcefield_settings.nonbonded_method.lower() == 'nocutoff'
platform = omm_compute.get_openmm_platform(
platform_name=protocol_settings.engine_settings.compute_platform,
gpu_device_index=protocol_settings.engine_settings.gpu_device_index,
restrict_cpu_count=restrict_cpu
)

and

# Restrict CPU count if running vacuum simulation
restrict_cpu = settings['forcefield_settings'].nonbonded_method.lower() == 'nocutoff'
platform = omm_compute.get_openmm_platform(
platform_name=settings['engine_settings'].compute_platform,
gpu_device_index=settings['engine_settings'].gpu_device_index,
restrict_cpu_count=restrict_cpu
)

We shouldn't have to do this in the tests anymore:

@pytest.fixture
def set_openmm_threads_1():
# for vacuum sims, we want to limit threads to one
# this fixture sets OPENMM_CPU_THREADS='1' for a single test, then reverts to previously held value
previous: str | None = os.environ.get('OPENMM_CPU_THREADS')
try:
os.environ['OPENMM_CPU_THREADS'] = '1'
yield
finally:
if previous is None:
del os.environ['OPENMM_CPU_THREADS']
else:
os.environ['OPENMM_CPU_THREADS'] = previous

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions