<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Hi Hugh,</p>
<p><br>
</p>
<p>I see now that you are working with "vdifnetwork.cpp" which is a
somewhat neglected bit of code as I think no one is actually using
it. Maybe you are and are providing valuable feedback as a result
:)</p>
<p><br>
</p>
<p>You can look at vdiffile.cpp and you will see how that handles
the channel counting. Look for the logic starting at
"configurevdifmux" and the next 30 or so lines. Can you try
creating a diff that is based on this logic?</p>
<p><br>
</p>
<p>Hope this helps!</p>
<p><br>
</p>
<p>-Walter<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 5/30/25 13:57, Walter Brisken via
Difx-users wrote:<br>
</div>
<blockquote type="cite" cite="mid:6f5d4488-05fe-42c5-a485-e37c42914542@nrao.edu">
<p><br>
</p>
<p>Hi Hugh,</p>
<p><br>
</p>
<p>My guess is that this patch will work for simple cases, but
would break correlation in cases where different antennas have
different numbers of channels or when zoom bands are used or
when multiple datastreams are used for an antenna. I think you
will need to find a different way to get the number of channels
appropriate for the particular datastream. I don't know which
function that would be (if it exists). Maybe Adam happens to
know?</p>
<p><br>
</p>
<p>-Walter<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 5/30/25 08:53, Hugh Garsden via
Difx-users wrote:<br>
</div>
<blockquote type="cite" cite="mid:LO0P265MB57638DA01318F7DFB5926593AE61A@LO0P265MB5763.GBRP265.PROD.OUTLOOK.COM">
<style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Walter,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;">
<span style="color: rgb(0, 0, 0);">The fix is simple but I had
to figure out how to get the inputChannelsPerThread, which </span><span style="color: black;">setvdifmuxinputchannels() needs. I
decided to get it from the VEX file not the VDIF file
because (I think) we want to check the VDIF file against
what is specified in the VEX. </span></div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">
The file mpifxcorr/src/vdifnetwork.cpp is where the vmux is
configured for VDIF using configurevdifmux(). I added the call
to setvdifmuxinputchannels() immediately after that. Here is
the diff:</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: black;">
<br>
</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof">
===================================================================</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> ---
mpifxcorr/src/vdifnetwork.cpp (revision 11112)</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> +++
mpifxcorr/src/vdifnetwork.cpp (working copy)</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> @@ -344,7 +344,11 @@</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> cfatal << startl
<< "configurevmux failed with return code " << rv
<< endl;</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> MPI_Abort(MPI_COMM_WORLD,
1);</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> }</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> + if (
setvdifmuxinputchannels(&vm,
config->getFreqTableLength()) != 0 ) {</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> + cfatal << startl
<< "setvdifmuxinputchannels failed" << endl;</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> </div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> +
MPI_Abort(MPI_COMM_WORLD, 1);</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> + }</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> fanout =
config->genMk5FormatName(format, nrecordedbands, bw, nbits,
sampling, vm.outputFrameSize,
config->getDDecimationFactor(configindex, streamnum),
config->getDAlignmentSeconds(configindex, streamnum),
config->getDNumMuxThreads(configindex, streamnum),
formatname);</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> if(fanout != 1)</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> {</div>
<div style="margin-left: 40px; font-family: "Courier New", monospace; font-size: 10pt; color: black;" class="elementToProof"> <br>
</div>
<div style="margin-left: 0px; font-family: "Aptos", "Aptos_EmbeddedFont", "Aptos_MSFontService", "Calibri", "Helvetica", sans-serif; font-size: 12pt; color: black;" class="elementToProof"> Note I am using DiFX-2.8.1 downloaded
via SVN not git.</div>
<div style="margin-left: 0px; font-family: "Aptos", "Aptos_EmbeddedFont", "Aptos_MSFontService", "Calibri", "Helvetica", sans-serif; font-size: 12pt; color: black;" class="elementToProof"> <br>
</div>
<div style="margin-left: 0px; font-family: "Aptos", "Aptos_EmbeddedFont", "Aptos_MSFontService", "Calibri", "Helvetica", sans-serif; font-size: 12pt; color: black;" class="elementToProof"> <br>
</div>
<div style="margin-left: 0px; font-family: "Aptos", "Aptos_EmbeddedFont", "Aptos_MSFontService", "Calibri", "Helvetica", sans-serif; font-size: 12pt; color: black;" class="elementToProof"> Hugh</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b>
Difx-users <a class="moz-txt-link-rfc2396E" href="mailto:difx-users-bounces@listmgr.nrao.edu" moz-do-not-send="true"><difx-users-bounces@listmgr.nrao.edu></a>
on behalf of Walter Brisken via Difx-users <a class="moz-txt-link-rfc2396E" href="mailto:difx-users@listmgr.nrao.edu" moz-do-not-send="true"><difx-users@listmgr.nrao.edu></a><br>
<b>Sent:</b> 21 May 2025 16:11<br>
<b>To:</b> <a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:difx-users@listmgr.nrao.edu" moz-do-not-send="true">difx-users@listmgr.nrao.edu</a> <a class="moz-txt-link-rfc2396E" href="mailto:difx-users@listmgr.nrao.edu" moz-do-not-send="true"><difx-users@listmgr.nrao.edu></a><br>
<b>Subject:</b> Re: [Difx-users] Multi-thread 4-bit VDIF
fails with 'vdifmux() failed with return code -2014'
{External} {External} {External}</font>
<div> </div>
</div>
<div>
<p>Hi Hugh,</p>
<p><br>
</p>
<p>It may have been oversight that led to the current code and
lack of support for your mode. Can you create a branch with
the implementation of your fix, or just sent a diff to the
list, and I can take a look?</p>
<p><br>
</p>
<p>I am pretty sure no one has actually ever used DiFX with
VDIF streams that are both multi-channel per thread and
multi-thread, so this may be new ground you are covering.
In theory it should be supported.<br>
</p>
<p><br>
</p>
<p>Thanks,</p>
<p><br>
</p>
<p>Walter<br>
</p>
<p><br>
</p>
<div class="x_moz-cite-prefix">On 5/21/25 08:57, Hugh Garsden
via Difx-users wrote:<br>
</div>
<blockquote type="cite">
<style type="text/css" style="display:none">p
{margin-top:0;
margin-bottom:0}</style>
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi all,</div>
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Regarding Jake's message below, difx is using multiplexing
to combine multiple threads into a single thread. However
it can only deal with 1 channel per input thread because
that is hardwired in the code. Here: <a href="https://urldefense.com/v3/__https://github.com/difx/difx/blob/c2ac995454fa96de38c651f6eea484b4a5db73ca/libraries/vdifio/src/vdifmux.c*L150__;Iw!!PDiH4ENfjr2_Jw!GKpKkvu39hHk0v0fSLpyefSUwep7WvZzidPuv9nndJiLPv2q5yJE6hIh9yBgvCN-tErCoIU8vbAh3zs19yNSkb6EJWWsrDXxwg5o$" id="OWAc5ea3557-12e4-1262-23d6-bd219c0c32b0" class="x_OWAAutoLink x_moz-txt-link-freetext" moz-do-not-send="true"><font color="red"><b>MailScanner has detected a possible fraud attempt from "urldefense.com" claiming to be</b></font> <font color="red"><b>MailScanner
has detected a possible fraud attempt from
"urldefense.com" claiming to be</b></font> <font color="red"><b>MailScanner has detected a possible
fraud attempt from "urldefense.com" claiming to be</b></font>
<font color="red"><b>MailScanner has detected a possible
fraud attempt from "urldefense.com" claiming to be</b></font>
<font color="red"><b>MailScanner has detected a possible
fraud attempt from "urldefense.com" claiming to be</b></font>
https://github.com/difx/difx/blob/c2ac995454fa96de38c651f6eea484b4a5db73ca/libraries/vdifio/src/vdifmux.c#L150
[github.com]</a>. The way to change that is mentioned in
comment, which is to call setvdifmuxinputchannels().
That's what the vmux program does, and it works ok. I'm
wondering why difx doesn't do that, and maybe there should
be a warning about it not doing that. Anyway, that line of
code is in configurevdifmux() so I've added a call to
setvdifmuxinputchannels() after configurevdifmux() is
called in difx, and now the multiplexing is working with
more than 1 channel.</div>
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hugh</div>
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Difx-users <a class="x_moz-txt-link-rfc2396E" href="mailto:difx-users-bounces@listmgr.nrao.edu" moz-do-not-send="true">
<difx-users-bounces@listmgr.nrao.edu></a> on
behalf of Jacob Brooks via Difx-users <a class="x_moz-txt-link-rfc2396E" href="mailto:difx-users@listmgr.nrao.edu" moz-do-not-send="true"><difx-users@listmgr.nrao.edu></a><br>
<b>Sent:</b> 20 February 2025 12:12<br>
<b>To:</b> <a class="x_moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:difx-users@listmgr.nrao.edu" moz-do-not-send="true"> difx-users@listmgr.nrao.edu</a>
<a class="x_moz-txt-link-rfc2396E" href="mailto:difx-users@listmgr.nrao.edu" moz-do-not-send="true">
<difx-users@listmgr.nrao.edu></a><br>
<b>Subject:</b> [Difx-users] Multi-thread 4-bit VDIF
fails with 'vdifmux() failed with return code -2014'
{External}</font>
<div> </div>
</div>
<style type="text/css" style="display:none">p
{margin-top:0;
margin-bottom:0}</style>
<div dir="ltr">
<div class="x_x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi all,</div>
<div class="x_x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
We're currently trying to get DiFX working with the
following setup: 4-bit, 2 channel (L + R pols), 2
threads (2 subbands), delivered in real time via UDP. It
has been working fine up until the point where we tried
adding a second thread - single-thread VDIF has been
working for us.<br>
<br>
When running in multi-threaded mode, the datastream
processes crash with the following message:<br>
<br>
'vdifmux() failed with return code -2014, likely input
buffer is too small!'<br>
<br>
I have managed to trace the problem to a check in
'getLowestFrameNumber' in vdifio/src/vdifmux.c. The
inequality check in that function:<br>
<br>
'getVDIFNumChannels(vh) !=
vm->inputChannelsPerThread'</div>
<div class="x_x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
succeeds as the function returns a value of 2 while
'inputChannelsPerThread' has a value of 1. This happens
for every iteration so vdifmux() fails and returns a
-2014 error code.</div>
<div class="x_x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I'm not sure where to go from here and was hoping
someone more familiar with DiFX could help out.
Hopefully I'm not missing something obvious! If you need
any more information I haven't provided please do ask.</div>
<div class="x_x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Cheers,</div>
<div class="x_x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Jake</div>
</div>
<br>
<fieldset class="x_moz-mime-attachment-header"></fieldset>
<pre class="x_moz-quote-pre">_______________________________________________
Difx-users mailing list
<a class="x_moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:Difx-users@listmgr.nrao.edu" moz-do-not-send="true">Difx-users@listmgr.nrao.edu</a>
<a class="x_moz-txt-link-freetext" href="https://urldefense.com/v3/__https://listmgr.nrao.edu/mailman/listinfo/difx-users__;!!PDiH4ENfjr2_Jw!GKpKkvu39hHk0v0fSLpyefSUwep7WvZzidPuv9nndJiLPv2q5yJE6hIh9yBgvCN-tErCoIU8vbAh3zs19yNSkb6EJWWsrHokJHvn$" moz-do-not-send="true">https://listmgr.nrao.edu/mailman/listinfo/difx-users [listmgr.nrao.edu]</a>
</pre>
</blockquote>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Difx-users mailing list
<a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:Difx-users@listmgr.nrao.edu" moz-do-not-send="true">Difx-users@listmgr.nrao.edu</a>
<a class="moz-txt-link-freetext" href="https://listmgr.nrao.edu/mailman/listinfo/difx-users" moz-do-not-send="true">https://listmgr.nrao.edu/mailman/listinfo/difx-users</a>
</pre>
</blockquote>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Difx-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Difx-users@listmgr.nrao.edu">Difx-users@listmgr.nrao.edu</a>
<a class="moz-txt-link-freetext" href="https://listmgr.nrao.edu/mailman/listinfo/difx-users">https://listmgr.nrao.edu/mailman/listinfo/difx-users</a>
</pre>
</blockquote>
</body>
</html>