07-29-2022 08:05 AM
Hi,
I am a beginner in the use of malleable VIs and I can't understand how I should proceed in order to obtain malleability with regard to the output of the VI.
Explanation of my problem:
In this case, I use the CUDA library and I try to read a pointer located on my Device and to copy its contents in a labview array of adequate dimensions.
However, my malleable VI does not accept to output several array dimensions on the same output.
According to my tests it seems that it is because my input does not vary.
Indeed, if I separate my input cluster in two and I define the output dimension in an initialized array, it works.
So my question is: "Is it possible to have a malleable output (array with a variable number of dimensions) without having a "malleable" input?"
Working Malleable VI :
Not Working Malleable :
Main VI :
If you have CUDA Toolkit installed, you can run the VIs, I have provided a zip file with the differents VI.
Thanks
Solved! Go to Solution.
07-29-2022 09:28 AM
A malleable VI exclusively adapts to the inputs. Maybe all you need is an input where you define the output type, e.g. an empty DBL array with the desired number of dimension. (not sure what you mean by an "initialized array", it can just be a diagram constant).
07-29-2022 10:07 AM - edited 07-29-2022 10:08 AM
Maybe you could wrap the "type" (i.e. empty array of the desire dimensionality) into the data cluster?
07-29-2022 11:07 AM
Thank you for your answer.
It is a possibility, however my goal was to avoid it.
However, if this is not possible, then I have no choice but to use such a method.
07-29-2022 12:04 PM
Type specialization happens at compile time and thus can only depend on type, not on value.
07-29-2022 12:16 PM - edited 07-29-2022 12:19 PM
BTW:
My suggestion of course needs some tweaks, because the multidimensional type array is empty. You need to get the size from the "actual_datatype" of the cluster of course.
I am not sure if the "dst" input of your code node needs the full size or just the type, so you might still have to initialize accordingly.
Not sure what your typical sizes are, but note that 4x the product of all sizes can exceed I32, so I would probably do the toU64 before if this is a concern.