Skip to content

Commit

Permalink
Move initialization of the io_buffer to separate method
Browse files Browse the repository at this point in the history
  • Loading branch information
giadarol committed Jul 18, 2023
1 parent 951db23 commit 582f02a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions xtrack/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ def __init__(

_buffer = tracker_data_base._buffer

if io_buffer is None:
io_buffer = new_io_buffer(_context=_buffer.context)
self.io_buffer = io_buffer

# Make a "marker" element to increase at_element
if self.iscollective:
self._zerodrift = Drift(_context=_buffer.context, length=0)
Expand All @@ -143,12 +139,19 @@ def __init__(
self._tracker_data_cache = {}
self._tracker_data_cache[None] = tracker_data_base

self._init_io_buffer(io_buffer)

self.line = line
self.line.tracker = self

if compile:
_ = self.get_track_kernel_and_data_for_present_config() # This triggers compilation

def _init_io_buffer(self, io_buffer=None):
if io_buffer is None:
io_buffer = new_io_buffer(_context=self._context)
self.io_buffer = io_buffer

def _split_parts_for_collective_mode(self, line, _buffer):

# Split the sequence
Expand Down

0 comments on commit 582f02a

Please sign in to comment.