Skip to content

Commit cf1531c

Browse files
committed
Raise appropriate error if the context in which the trackers are built is not on CPU
1 parent b232ed2 commit cf1531c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

xtrack/multiline/multiline.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,17 @@ def configure_beambeam_interactions(self, num_particles,
470470
471471
'''
472472

473+
# Check that the context in which the trackers are built is on CPU
474+
for nn in ["clockwise", "anticlockwise"]:
475+
if self._bb_config[f"{nn}_line"] is None:
476+
continue
477+
line = self.lines[self._bb_config[f"{nn}_line"]]
478+
if not isinstance(line.tracker._context, xo.ContextCpu):
479+
raise ValueError(
480+
"The trackers need to be built on CPU before "
481+
"configuring the beam-beam elements."
482+
)
483+
473484
if self._bb_config['dataframes']['clockwise'] is not None:
474485
bb_df_cw = self._bb_config['dataframes']['clockwise'].copy()
475486
else:

0 commit comments

Comments
 (0)