Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1398 from DiamondLightSource/1372_enable_dev_shm_…
Browse files Browse the repository at this point in the history
…on_gda_property

Set dev shm on Eiger based on using GPU
  • Loading branch information
DominicOram authored May 22, 2024
2 parents 17bfb87 + 1cd023d commit 9739673
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ install_requires =
ophyd-async >= 0.3a5
bluesky >= 1.13.0a3
blueapi >= 0.4.3-a1
dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git
dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@ba2e0da424cf7a82e724f278b668987575cf8a52

[options.entry_points]
console_scripts =
Expand Down
4 changes: 4 additions & 0 deletions src/hyperion/experiment_plans/flyscan_xray_centre_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ def run_gridscan_and_move(
fgs_composite.sample_motors.stub_offsets, StubPosition.CURRENT_AS_CENTER
)

# Turn off dev/shm streaming to avoid filling disk, see https://github.com/DiamondLightSource/hyperion/issues/1395
LOGGER.info("Turning off Eiger dev/shm streaming")
yield from bps.abs_set(fgs_composite.eiger.odin.fan.dev_shm_enable, 0)

# Wait on everything before returning to GDA (particularly apertures), can be removed
# when we do not return to GDA here
yield from bps.wait()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ def run_gridscan_and_move(
fgs_composite.sample_motors.stub_offsets, StubPosition.CURRENT_AS_CENTER
)

# Turn off dev/shm streaming to avoid filling disk, see https://github.com/DiamondLightSource/hyperion/issues/1395
LOGGER.info("Turning off Eiger dev/shm streaming")
yield from bps.abs_set(fgs_composite.eiger.odin.fan.dev_shm_enable, 0)

# Wait on everything before returning to GDA (particularly apertures), can be removed
# when we do not return to GDA here
yield from bps.wait()
Expand Down
1 change: 1 addition & 0 deletions src/hyperion/parameters/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class I03Constants:
OAV_CENTRING_FILE = _test_oav_file if TEST_MODE else _live_oav_file
SHUTTER_TIME_S = 0.06
USE_PANDA_FOR_GRIDSCAN = False
USE_GPU_FOR_GRIDSCAN_ANALYSIS = False


@dataclass(frozen=True)
Expand Down
2 changes: 2 additions & 0 deletions src/hyperion/parameters/gridscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class GridCommon(
)
set_stub_offsets: bool = Field(default=False)
use_panda: bool = Field(default=CONST.I03.USE_PANDA_FOR_GRIDSCAN)
use_gpu: bool = Field(default=CONST.I03.USE_GPU_FOR_GRIDSCAN_ANALYSIS)
ispyb_experiment_type: IspybExperimentType = Field(
default=IspybExperimentType.GRIDSCAN_3D
)
Expand Down Expand Up @@ -90,6 +91,7 @@ def detector_params(self):
beam_xy_converter=DetectorDistanceToBeamXYConverter(
self.det_dist_to_beam_converter_path
),
enable_dev_shm=self.use_gpu,
**optional_args,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def wrapped_gridscan_and_move():
@patch(
"hyperion.experiment_plans.flyscan_xray_centre_plan.move_x_y_z", autospec=True
)
def test_when_gridscan_finished_then_smargon_stub_offsets_are_set(
def test_when_gridscan_finished_then_smargon_stub_offsets_are_set_and_dev_shm_disabled(
self,
move_xyz: MagicMock,
run_gridscan: MagicMock,
Expand All @@ -429,6 +429,8 @@ def test_when_gridscan_finished_then_smargon_stub_offsets_are_set(
test_fgs_params.set_stub_offsets = True
RE, (nexus_cb, ispyb_cb) = RE_with_subs

fake_fgs_composite.eiger.odin.fan.dev_shm_enable.sim_put(1) # type: ignore

def wrapped_gridscan_and_move():
run_generic_ispyb_handler_setup(ispyb_cb, test_fgs_params)
yield from run_gridscan_and_move(
Expand All @@ -441,6 +443,7 @@ def wrapped_gridscan_and_move():
fake_fgs_composite.smargon.stub_offsets.center_at_current_position.proc.get()
== 1
)
assert fake_fgs_composite.eiger.odin.fan.dev_shm_enable.get() == 0

@patch(
"dodal.devices.aperturescatterguard.ApertureScatterguard.set",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def wrapped_run_gridscan_and_move():
"hyperion.experiment_plans.panda_flyscan_xray_centre_plan.setup_panda_for_flyscan",
autospec=True,
)
def test_when_gridscan_finished_then_smargon_stub_offsets_are_set(
def test_when_gridscan_finished_then_smargon_stub_offsets_are_set_and_dev_shm_disabled(
self,
setup_panda_for_flyscan: MagicMock,
move_xyz: MagicMock,
Expand All @@ -395,6 +395,8 @@ def test_when_gridscan_finished_then_smargon_stub_offsets_are_set(
):
test_panda_fgs_params.set_stub_offsets = True

fake_fgs_composite.eiger.odin.fan.dev_shm_enable.sim_put(1) # type: ignore

def wrapped_run_gridscan_and_move():
run_generic_ispyb_handler_setup(
mock_subscriptions[1], test_panda_fgs_params
Expand All @@ -414,6 +416,8 @@ def wrapped_run_gridscan_and_move():
== 1
)

assert fake_fgs_composite.eiger.odin.fan.dev_shm_enable.get() == 0

@patch(
"dodal.devices.aperturescatterguard.ApertureScatterguard.set",
return_value=Status(done=True, success=True),
Expand Down

0 comments on commit 9739673

Please sign in to comment.