Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Multithreading (CVF)

tnn333
Beginner
683 Views
I was wondering if anyone has been able to get multithreading to work in CVF. I have a piece of test code that uses a CreateThread call to do multithreading. This seems to work and the debug version shows about 18% timing improvements (over single-threaded execution), but the release version shows slower timings for a multi-threaded execution. No special compiler settings are specified for release (other than /threads which I also use in debug).

Are there issues that would arise in the release version that would make the execution so much slower?
0 Kudos
2 Replies
paulwdent
Beginner
683 Views

I have got it to work - sort of. But there is a quirk I would like to find an answer to.

I have a main program that interacts by dialog with the user. The main program was made to create three new threads. One is a continuous audio input thread, another is a continuous audio output thread, and the third is a graphical display thread. The graphical display thread can continually display chracteristics of the audio input or output or both, such as waveform (scope) or spectrum. The user controls what to display and how by vlaues passed in a named common block from the user dialog thread to the graph plotting thread

The problem is, I cannot open Quickwin windows properly from a sub-thread that is created by the main program thread. Not all windows open  - only one does - and it is the wrong size. If I write to the windows that have not opened, they then open, but are the same size as the one opened window, and not the size they should be.

On the other hand, the windows will open fine from the main thread.

Therefore I had to make the main program the graph-displaying thread, and have it open a sub-thread to be the user dialog thread. Apparently the Fortran unit numbers that I create for open windows are good across all threads.

Does anybody have a clue why Quickwin (multiple windows) would not open correctly from a sub-thread?

0 Kudos
Paul_Curtis
Valued Contributor I
683 Views

I create extensively multi-threaded Win-API programs, but not in Quickwin.  However, I will observe that the GUI, containing all user interactions (dialogs, etc.), must always be the "main" program thread, from which (multiple) worker threads may be launched for computational or communications tasks.  Suggestion:replace the common blocks with a modulewhich can be included for access by the thread routines (in their own modules, of course) as needed.  I would also suggest putting the graphics output, and everything which writes to the display, in the main thread, and use some form of signalling (send a WM_ to the graphics window's proc) to indicate when new/updated data is available for display.  I have been doing this since long before CVF, and migrated this approach to IVF, without any problems.

0 Kudos
Reply