You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One can not call Multiline.configure_beambeam_interactions() if the corresponding collider uses trackers with a GPU context (cupy or opencl). Otherwise, the following error gets triggered.
Full stack trace
File "/home/HPC/cdroin/example_DA_study_dev/master_study/scans/example_HL_tunescan/base_collider/xtrack_0029/2_configure_and_track.py", line 337, in configure_beam_beam
collider.configure_beambeam_interactions(
File "/usr/local/DA_study/miniforge_docker/lib/python3.10/site-packages/xtrack/multiline/multiline.py", line 484, in configure_beambeam_interactions
xf.configure_beam_beam_elements(
File "/usr/local/DA_study/miniforge_docker/lib/python3.10/site-packages/xfields/config_tools/beambeam_config_tools/config_tools.py", line 150, in configure_beam_beam_elements
xf.configure_orbit_dependent_parameters_for_bb(line=line_cw,
File "/usr/local/DA_study/miniforge_docker/lib/python3.10/site-packages/xfields/config_tools/beambeam_config_tools/orbit_dependent_configuration_tools.py", line 81, in configure_orbit_dependent_parameters_for_bb
ee.track(temp_particles)
File "/usr/local/DA_study/miniforge_docker/lib/python3.10/site-packages/xtrack/base_element.py", line 299, in track
_track_kernel(el=self._xobject, particles=particles,
File "/usr/local/DA_study/miniforge_docker/lib/python3.10/site-packages/xobjects/context_pyopencl.py", line 507, in __call__
arg_list.append(self.to_function_arg(arg, vv))
File "/usr/local/DA_study/miniforge_docker/lib/python3.10/site-packages/xobjects/context_pyopencl.py", line 490, in to_function_arg
value._buffer.context is self.context
AssertionError: Incompatible context for argument `particles`
Apparently, a temporary particles object is instantiated in the stack trace with a CPU tracker, even when the collider uses a GPU tracker.
Easy workaround:
Build collider trackers with CPU context
Configure beam-beam
Discard trackers
Build trackers with GPU context
Build particles with GPU context
track
The text was updated successfully, but these errors were encountered:
Thank you! This is in fact how it is intended to be used, since the twiss and survey that you use to configure the bb lenses are significantly slower on GPU (too few particles).
We should check the context when Multiline.configure_beambeam_interactions() is called and give a proper error message suggesting to move to CPU. @ColasDroin could you please make a PR with that modification?
If it is more convenient to generate the particles on CPU, you can do that and then use Particles.move to move them to the GPU memory.
Thank you for the quick answer!
As suggested, I did a PR with the xtrack repo to improve the error message here, and also another PR in the xmask repo to test for the new error message here.
Although the PRs are still open to change, I believe we can close the issue here.
One can not call
Multiline.configure_beambeam_interactions()
if the corresponding collider uses trackers with a GPU context (cupy or opencl). Otherwise, the following error gets triggered.Full stack trace
Apparently, a temporary
particles
object is instantiated in the stack trace with a CPU tracker, even when the collider uses a GPU tracker.Easy workaround:
The text was updated successfully, but these errors were encountered: