LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CLAD exam question: Coercion dots and memory usage

Hello,

 

I was trying the sample exam at http://download.ni.com/pub/devzone/epd/clad_sample_exam2.pdf . Question 21 asks,

 

Which of the following statements is true regarding the use of Coercion Dots?

a. Coercion Dots improve program performance.
b. Coercion Dots represent a conversion from one data type to another.
c. Coercion Dots increases memory usage
d. Both A. and B.
e. Both B. and C.

 

I thought the answer is (b), but the given solution is (e).

 

Is (c) always true? I would've thought that coercing an integer to an enum would be inconsequential, from a code execution point of view.

 

Furthermore, I found an experiment at http://labviewartisan.blogspot.com.au/2012/08/whats-deal-with-coercion-dots.html which suggests that coercion dots are more memory-efficient than any manual conversion (at least in the tested case)

Certified LabVIEW Developer
0 Kudos
Message 1 of 5
(4,466 Views)

The CLAD sample questions are considered by many people to be problematic and sometimes downright wrong. I'm pretty sure that you're right and that a memory allocation is not required (for example, if you convert a typedef of a U32 to a U32 I expect you won't get a new allocation, but I can't say for sure. Personally, I think that such a question does not have a place in the CLAD exam because of these issues and because memory allocation is in implementation detail, but if you want to be successful in the exam, you will probably want to learn what kind of answers NI expects. In this case, I'm assuming that there reason for having the question there was so that CLADs will be aware that a coercion means a type conversion, which could often mean lost data and memory allocations. I would suggest doing a search to find out some of the other times when people had problems with the questions.


___________________
Try to take over the world!
Message 2 of 5
(4,452 Views)

Hi,

 

Check this.

In the sixth point, they have mentioned about the coersion dots which states that when LabVIEW changes datatypes, the output is a new buffer.

 

 

Kudos always welcome

 

Gogineni

CLAD

 

 

 

______________________________________________
Kudos are welcome
0 Kudos
Message 3 of 5
(4,445 Views)

@Gogineni wrote:

 

In the sixth point, they have mentioned about the coersion dots which states that when LabVIEW changes datatypes, the output is a new buffer.


My question was what happens when there's a coercion dot, but the underlying data type is the same.

 

For example, if I single step through this and look at the memory monitor, it looks like I see one allocation at the init array function (8MB for the 1M element array) and another one at the end where the data goes into the indicator. The memory usage for the VI also says we're using 16MB, which would support the same two allocations. That means that there is no additional allocation at the coercion in the subVI:

 

Allocation.png

 

The subVI is inlined and only passes the DBL input to the DBL output. It's only there to force the typedef to coerce to DBL.

 

I don't know if this says for certain that there's no allocation when the underlying type is the same (although I would think that it suggests that there isn't), but frankly, I don't really care either.


___________________
Try to take over the world!
0 Kudos
Message 4 of 5
(4,435 Views)

@tst wrote:

but if you want to be successful in the exam, you will probably want to learn what kind of answers NI expects. In this case, I'm assuming that there reason for having the question there was so that CLADs will be aware that a coercion means a type conversion, which could often mean lost data and memory allocations. I would suggest doing a search to find out some of the other times when people had problems with the questions.


Think like NI, eh? That's street smart 🙂 Thanks for the tip!

Certified LabVIEW Developer
0 Kudos
Message 5 of 5
(4,404 Views)