Phoenix LabVIEW User Group (PLUG)

cancel
Showing results for 
Search instead for 
Did you mean: 

PLUG Coding Challenge 2012

PLUG LabVIEW Coding Challenge, 2012

I want to make you aware of an exciting opportunity to show-off your LabVIEW skills and a chance to win a NI-USB-6009 which retails for $280.  Your name will also be featured on the PLUG website, giving you adequate bragging rights that you are one of the best LabVIEW developers in Arizona!

Problem Statement

Develop a Write Once Read Many (WORM) architecture for a large database. The WORM should be optimized for low latency, highly parallelized access to global channel meta-data, and preferably non-blocking for minimal interaction of independent threads.

WORM’s scope should be global and persistent throughout life of application.  Developer may use any data structure(s) and means of data sharing they wish.  The solution must be able to return a channel’s meta-data as a single cluster, and you may also wish to provide more direct access to frequently used elements of meta-data to achieve faster performance.  Subsets of meta-data can either be returned as a smaller cluster, individual elements, or combination thereof in any number of subVIs.  Frequently used subset includes elements: Mnemonic, Symbol Type, Num Bits, Units, Discrete States, Application Id, FP Format, Format, and Precision.  If, in your implementation, returning the subset actually requires more processing time than simply returning the entire channel’s meta-data, then there is no need to return a subset of the meta-data, just return the entire set of meta-data for that channel.

Channel meta-data shall be accessible by numerical index or Mnemonic for random access.  Note that numerical index is not the same as the Application Id.

Because consumers of this data can be created dynamically, a simple wire is not a sufficient means for sharing this channel meta-data.  Consumers should be able to start asynchronously and retrieve access to the WORM global without any inputs.  The Test Executive will ensure that the Initialize subVI has completed before the accessor subVIs are loaded into memory or called.

Considerations should also be given to the load time of the application and the total memory use, as these metrics will also be incorporated into the overall score.  Ideas for memory reduction might include compression, choice of complex data types, and data reduction through referential relationships.

Instructions

You have been provided 5 subVIs that serve as the interface to your solution.  Do not change the connector pane of these VIs because they will be called dynamically by the Code Challenge Test Executive.  The Test Executive will spawn clones for VIs 2 thru 5.  All 5 VIs will be held in memory by the Test Executive throughout the life of the test.  Implement the 5 VIs as follows:

1.       Process the provided array of clusters (contained in Test VIs\Random AoC Database.vi) into your WORM’s data structure.  The array of clusters will be provided on an input terminal to your initialization VI so that disk load time variability does not play into the execution time scoring.  The Initialize subVI may also be responsible for spinning up any background VIs utilized by your solution.

2.       Return all meta-data for the channel requested by index.

3.       Return meta-data subset for the channel requested by index.

4.       Return all meta-data for the channel requested by mnemonic.

5.       Return meta-data subset for the channel requested by mnemonic.

VIs 3 and 5 do not need to populate a return cluster IF the times to access individual elements is fast enough that the constituent data can be retrieved as needed at their point of use.  In other words, I will not be verifying the output values of VIs 3 and 5 because I do not want to impose a return format or access methodology.  VIs 3 and 5 will only be evaluated based on their performance, but a manual inspection will be performed to verify they are internally accessing all 9 pieces of frequently used meta-data.  This allows greater flexibility on what these VIs can output and how they might be used in actual application context.  VIs 3 and 5 are about speed.  Only VIs 2 and 4 will have their return data verified.

Static code analysis will also be performed using VI Analyzer’s default suite of tests.

Target Environment

Scoring will be performed in LabVIEW 2012 for Win XP SP3 running on a 32 bit Core2 Duo T9800 2.93GHz with 3.5GB of RAM.  LabVIEW will be closed and reopened between tests of each submission.

Scoring

·         Functionality: 25%

·         Total time for all meta-data requests to complete: 25%

·         Minimize memory use: 35%

·         VI Analyzer results: 10%

·         Initialization time: 5%

Scoring details are subject to change.  Obviously the solution must return the correct values, and it must do so as fast as possible.  Minimizing memory use is important for large complex data sets.  Good coding style is expected.  Time required to initialize the WORM is of some consideration.

No test will be performed to verify that the WORM enforces a single initialization.  The use of the term WORM here is meant to reflect the global data’s intended use: to be initialized by one source, typically one time, and read repeatedly throughout the application.

Submissions

Multiple submissions from a single developer/team will be accepted.

Submission may contain as many supporting files and file-types as needed for the solution.  However submission should not require any dependencies outside of vi.lib or subVIs provided with the solution. 

Zip up the contents of your submission.  To reduce the size of the submission for emailing, please do not include the Test VIs folder.  Do not change the names of the template subVIs.  The filename of the zip file should be your name, and if submitting multiple solutions, also include a brief description of the solution.

Zip should also include a readme.txt file containing your name, email address, company, years of LabVIEW experience, current level of LabVIEW certification, and LinkedIn URL.

Email submissions to nate@themoehrings.com no later than 6pm on 10/21/2012.  Your submission will be posted to the PLUG website after the Phoenix NI Technical Symposium (NITS), unless you request your solution not be posted on the web.

Submissions will be scored live during the NITS lunch break.  Authors of the top 2 or 3 solutions will be asked to walk through their code during the NITS lunch break, time permitting.

Conclusion

Thank you for participating in the PLUG Coding Challenge!  I hope this experience will be enjoyable, rewarding, and educational for all of us.  Your participation makes that possible.  Please post questions about the challenge problem on the ni.com/plug discussion board.

Thanks!

Nate Moehring

Test Executive

NITS is almost here!  So far I expect to have at least 3 contestants, but I would love to get more people involved.  To that end, I'm attaching the newly completed Test Executive for this coding challenge to this discussion.

Although I intend to run the tests in LV2012, I saved it back to LV2010SP1 so that more people can take advantage of it.  It uses the VI Analyzer toolkit, so if you don't have VIA installed you can simply take it out of the tester.  Unzip the tester into the same folder that you unzipped the Coding Challenge zip file, because the tester will reuse the controls and sample database

The score that it produces is based on your solution's performance compared to the average scores of the Baseline Solution also distributed with the Coding Challenge, as it ran on my computer using LV2012.  However, remember what's really important is your score relative to other submissions!

Continue to post here or contact me directly if you have any questions or concerns, and happy wiring!

Nate Moehring

10/15/2012

Nate Moehring

SDG
0 Kudos
Message 1 of 11
(10,864 Views)

Could be a serious chunk of work to make it really fast and efficient. Of course it took some work to put the challenge together, so thanks Nate.

I have something that might be adaptible, something I have called the Smart VIG, but a concern of IP comes to play, not just because of the website posting, which you let us opt out of, but of evaluators. Fortunately your word is good with me, Nate, so as long as any submitted solutions do not end up being used anywhere, then I might submit, assuming I can carve out time.

0 Kudos
Message 2 of 11
(5,040 Views)

Sorry for my delay in response Michael.  I've had to think about this a bit, and I've been busy with work/life.

The goal of this coding challenge is knowledge sharing.  I was planning to have the top solutions walk through their code during the NITS lunch and explain in some detail how they implemented such a fast and light weight solution.  In my mind, if you're willing to show and talk about your code to anybody outside your company, you've already exposed your IP.  I can see some distinction between merely showing the code and allowing anyone to freely download it (particularly the larger the code base or more complex the solution), which is why I gave an option to not have your solution posted on the web, but for the most part once you've shown your code, you've already exposed your IP.

I promise that I won't copy and paste anything that anybody submits, but we're here to learn concepts and techniques that can be applied to other applications.  So if your solution requires company IP, I think you have two options.  Either don't submit it, or submit it in such a way that the IP is protected via diagram passwords, lvlibp, dll, etc...  In this case we would essentially be creating a new class of competitors.  The winner of this class of competitors would not be eligible for the USB DAQ, but instead would receive a t-shirt.  Obviously they don't need to post anything to the website, but regarding their explanation at NITS, we might want to work together to decide who will present.  If you are able to share enough information about the IP such that one would have a reasonable idea of what's happening under the hood, then I might still ask you to present at NITS.  If the solution is too black box, we'll just announce your scores and have someone else present.

Sound fair?

Nate Moehring

SDG
0 Kudos
Message 3 of 11
(5,040 Views)

Nate,

So do you require us to keep the access vi's with reentrant preallocate settings?

My solution doesn't require them to be reentrant so it will increase memory useage (although only slightly).

0 Kudos
Message 4 of 11
(5,040 Views)

Yes, reentrancy is required because the objective is to provide highly parallel access to the data.  If they aren't reentrant, then you'll have one caller waiting for an unrelated caller to complete.  You can change it to Shared Clone Reentrancy if you like.

thanks for the question Michael,

Nate

Nate Moehring

SDG
0 Kudos
Message 5 of 11
(5,040 Views)

My main vi is blocking so it doesn't make much sense to change it to even shared cloned.  The solution is fairly simplistic as I only wanted to set aside one day for development (while trying to watch football ). The only code I'd be performing in parallel would be an error case check...and if the "tester" is launching many in parallel which I would guess you'd be doing then it may actaully take longer to execute as it has to launch that many copies of the VI.  If your tester doesn't require reentracy (VI server option) then I'd rather leave it not reentrant at all.

I might be able to get away with the blocking VI because the lookup and return of data doesn't take too much time.  I can sequentially read each of the channel items by mnemonic in ~300ms and by index in ~100ms.  Unless you are reading most of the channels at the exact same time you are probably not going to be blocked for long.

It'll be fun to see if anyone comes up with a non-blocking solution.  And possibly some compression techniques.  I can think of some to save memory, but I think it might increase lookup time and would take some time to implement.

Just in case I'll send you a "shared clones" version and a "non-reentrant" version.

Thanks,

Michael

0 Kudos
Message 6 of 11
(5,040 Views)

If you remove reentrancy your solution won't even run in my tester because I'm opening references to the accessor VIs with option 8, expecting them to be reentrant, and calling many instances of your accessor in parallel.  You may have a main.vi for your own testing purposes, but I will not be calling your main VI, I will be calling your accessors directly.

My tester doesn't include the time to open VI references in the run time metric.  It opens references to everything, starts the timer, and then it calls everything.  So don't worry about the time it takes to create accessor clones of the reentrant VIs, it won't be factored into the score.

Nate Moehring

SDG
0 Kudos
Message 7 of 11
(5,040 Views)

I figured you might be doing that.  I will change back to preallocate then. Thanks.

0 Kudos
Message 8 of 11
(5,040 Views)

NITS is almost here!  So far I expect to have at least 3 contestants, but I would love to get more people involved.  To that end, I'm attaching the newly completed Test Executive for this coding challenge to this discussion.

Although I intend to run the tests in LV2012, I saved it back to LV2010SP1 so that more people can take advantage of it.  It uses the VI Analyzer toolkit, so if you don't have VIA installed you can simply take it out of the tester.  Unzip the tester into the same folder that you unzipped the Coding Challenge zip file, because the tester will reuse the controls and sample database

The score that it produces is based on your solution's performance compared to the average scores of the Baseline Solution also distributed with the Coding Challenge, as it ran on my computer using LV2012.  However, remember what's really important is your score relative to other submissions!

Continue to post here or contact me directly if you have any questions or concerns, and happy wiring!

Nate Moehring

10/15/2012

Nate Moehring

SDG
0 Kudos
Message 9 of 11
(5,040 Views)

Only a few days left for the PLUG Coding Challenge.  Please remember to email your solution to nate@themoehrings.com by 6pm on Sunday 10/21 so I have time to install, review, and score them prior to NITS on Tuesday.  Hope to see you there!

Nate Moehring

SDG
0 Kudos
Message 10 of 11
(5,040 Views)