Example Code

Example DLL that uses Concurrency:parallel_for and returns results via User Events

Code and Documents

Attachment

Download All

Overview

I use ensemble empiric mode decomposition (EEMD) to analyze respiratory signals I acquire in LV. This technique is amenable to parallel execution,

but is very time consuming. To speed up the code, I moved it into Visual C++ 2015 using Concurrency::parallel_for. (E)EMD decomposes a signal into independent modes,

and the number of modes is unknown prior to completion. Rather than allocating an enormous array to hold the result, the DLL returns each mode

in a User Event. The DLL illustrates a number of useful points on coding DLLs, particularly how to deal with clusters containing strings and arrays, and how to pass

structures to User Events. I have not included the EEMD code.

 

Description

 1) EEMD.cpp - a Visual Studio 2015 C++ program

2) pEEMD.vi - VI that invokes the DLL

3) test EEMD.vi - VI that demonstrates how to do this asynchronously so that each mode is displayed when calculated

Hardware and Software Requirements

Visual Studio 2015

LabVIEW 2016 (64 bit is required for larger data sets)

A multicore Windows machine

 

I used a Dell T5600 with 24 cores, which came close to real-time performance, with all 24 cores averaging 90% processor load.

Steps to Implement or Execute Code

The EEMD.cpp code calls a class called CEMD2, which is not included. It is assumed that the user will use the framework to call their own processor-intensive

parallel routines

Additional Information or References

 Some familiarity with compiling DLLs is assumed.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.