11#!/usr/bin/env python3
22
3+ ################################################################################
4+ # Copyright (c) 2022, 2024, National Research Foundation (SARAO)
5+ #
6+ # Licensed under the BSD 3-Clause License (the "License"); you may not use
7+ # this file except in compliance with the License. You may obtain a copy
8+ # of the License at
9+ #
10+ # https://opensource.org/licenses/BSD-3-Clause
11+ #
12+ # Unless required by applicable law or agreed to in writing, software
13+ # distributed under the License is distributed on an "AS IS" BASIS,
14+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+ # See the License for the specific language governing permissions and
16+ # limitations under the License.
17+ ################################################################################
18+
319"""Compare output of two F-engines.
420
521This can be used to ensure that a change to F-engine code produces
2238
2339import katgpucbf .recv
2440import katgpucbf .xbgpu .recv
25- from katgpucbf import COMPLEX , N_POLS
41+ from katgpucbf import COMPLEX , DEFAULT_JONES_PER_BATCH , N_POLS
2642
2743
2844def parse_args () -> argparse .Namespace :
@@ -31,21 +47,25 @@ def parse_args() -> argparse.Namespace:
3147 parser .add_argument ("--interface" , type = get_interface_address , help = "Interface on which to listen" )
3248 parser .add_argument ("--ibv" , action = "store_true" , help = "Use ibverbs" )
3349 parser .add_argument ("--array-size" , type = int , required = True )
34- parser .add_argument ("--channels-per-stream" , type = int , required = True )
35- parser .add_argument ("--spectra-per-heap" , type = int , default = 256 )
50+ parser .add_argument ("--channels" , type = int , required = True )
51+ parser .add_argument ("--channels-per-substream" , type = int , required = True )
52+ parser .add_argument ("--jones-per-batch" , type = int , default = DEFAULT_JONES_PER_BATCH )
3653 parser .add_argument ("--samples-between-spectra" , type = int , required = True )
37- parser .add_argument ("--heaps-per-fengine-per-chunk" , type = int , default = 16 )
54+ parser .add_argument ("--heaps-per-fengine-per-chunk" , type = int , default = 32 )
3855 args = parser .parse_args ()
56+ if args .jones_per_batch % args .channels != 0 :
57+ parser .error ("--jones-per-batch must be a multiple of --channels" )
3958 return args
4059
4160
4261async def main () -> None :
4362 args = parse_args ()
63+ spectra_per_heap = args .jones_per_batch // args .channels
4464 layout = katgpucbf .xbgpu .recv .Layout (
4565 n_ants = args .array_size ,
46- n_channels_per_stream = args .channels_per_stream ,
47- n_spectra_per_heap = args . spectra_per_heap ,
48- timestamp_step = args .samples_between_spectra * args . spectra_per_heap ,
66+ n_channels_per_substream = args .channels_per_substream ,
67+ n_spectra_per_heap = spectra_per_heap ,
68+ timestamp_step = args .samples_between_spectra * spectra_per_heap ,
4969 sample_bits = 8 ,
5070 heaps_per_fengine_per_chunk = args .heaps_per_fengine_per_chunk ,
5171 )
@@ -56,14 +76,14 @@ async def main() -> None:
5676 shape = (
5777 layout .heaps_per_fengine_per_chunk ,
5878 layout .n_ants ,
59- layout .n_channels_per_stream ,
79+ layout .n_channels_per_substream ,
6080 layout .n_spectra_per_heap ,
6181 N_POLS ,
6282 COMPLEX ,
6383 )
6484 data = np .ones (shape , np .int8 )
6585 present = np .zeros (shape [:2 ], np .uint8 )
66- chunk = katgpucbf .recv .Chunk (data = data , present = present , stream = stream )
86+ chunk = katgpucbf .recv .Chunk (data = data , present = present , sink = stream )
6787 chunk .recycle ()
6888
6989 srcs = [(ep .host , ep .port ) for ep in args .src ]
0 commit comments