Click here to Skip to main content
15,897,291 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: Managed C++/CLI calling native C++ class: GC? Wrapper recommended? Pin
N a v a n e e t h23-May-09 5:27
N a v a n e e t h23-May-09 5:27 
QuestionUse native C++-DLLs with managed C++ or C#? Pin
Unbe Kant22-May-09 13:26
Unbe Kant22-May-09 13:26 
AnswerRe: Use native C++-DLLs with managed C++ or C#? Pin
N a v a n e e t h23-May-09 5:53
N a v a n e e t h23-May-09 5:53 
GeneralRe: Use native C++-DLLs with managed C++ or C#? Pin
Unbe Kant23-May-09 8:09
Unbe Kant23-May-09 8:09 
AnswerRe: Use native C++-DLLs with managed C++ or C#? Pin
Luc Pattyn23-May-09 6:17
sitebuilderLuc Pattyn23-May-09 6:17 
GeneralRe: Use native C++-DLLs with managed C++ or C#? Pin
Unbe Kant23-May-09 8:24
Unbe Kant23-May-09 8:24 
GeneralRe: Use native C++-DLLs with managed C++ or C#? Pin
Luc Pattyn23-May-09 8:57
sitebuilderLuc Pattyn23-May-09 8:57 
GeneralRe: Use native C++-DLLs with managed C++ or C#? Pin
Unbe Kant23-May-09 12:07
Unbe Kant23-May-09 12:07 
Hi Luc

Thank you again for your input. I will do as you say, since I believe that your experience is much bigger than mine. Actually, I am more familiar with Linux coding in C/C++.

Here is some more info about our app:

- It is a scientific programm solving integral equations numerically

- One single matrix: 128^3 double precision float (64bit) (Not that big, I know. It's not one single calculation, but the number of iterations that consumes time. Furthermore, future goal is to increase the precision AND dimensionality i.e. 128*x^(3*y) ... as soon as RAM becomes as cheap as a grain of sand Wink | ;-) )

- Need some 10 matrices simultaniously in RAM

- The current command-line based implementation is pure C++, however, even here the matrices are stored in arrays rather than STL stuff, because matrix-operations are carried out by C style Intel Math Kernel Libraries

- Intel C/C++ Compiler

- Time consumption per iteration on a single CPU 3GHz Intel CPU: 0.5s

- Still: We need a couple of thousand iterations until the calculation converges, which makes a single calculation lasting approx. half an hour for only this task

- Some post-interpolation stuff

Future plans:

- Extending matrix dimensionality to six while, of course, lowering the resolution (e.g. 32^6 or even more if we get the RAM Wink | ;-) )

- GUI (Here's where .NET becomes interesting)

- Database connection (dito)

Now maybe things become clearer. So what do I want to do?

- Let C# load the parameters (e.g. matrix size)
- Let native C++ allocate the memory for the 3D/6D arrays and pass the pointer to C# (using a pinned pointer, right?). However, these MUST be pure arrays since Intel Math Kernel Libraries accept nothing else
- Let C# fill the matrix
- Let C++ perform all calculations. I hope to be able to somehow handle the messaging between C++ and C# during the calculation for e.g. updating a progess bar
- When finished, let C# present and save the resulting matrix

As you can see, the managed world is hardly involved in the buffer. I could, of course, also let the managed code allocate the memory for the initial matrix and then copy it. But should I?

You asked:

> Why is that, do you have good reasons to avoid it?
> allocating and later collecting one array will be
> cheaper than copying its contents once.

Is this true in my case? Wouldn't the performance decline dramatically if GC was involved in the matrix calculations? It's just that I've heard (yet, never tested, maybe I should give it a try) that the performance of such calculations with matrices stored in managed memory is always lower.

> There are some app categories for which .NET isn't suited but
> for most of those Windows isn't suited either.

O dear - would that be one of those categories? Frown | :(

Regs
GeneralRe: Use native C++-DLLs with managed C++ or C#? Pin
Luc Pattyn23-May-09 12:35
sitebuilderLuc Pattyn23-May-09 12:35 
GeneralRe: Use native C++-DLLs with managed C++ or C#? Pin
Unbe Kant23-May-09 13:22
Unbe Kant23-May-09 13:22 
GeneralRe: Use native C++-DLLs with managed C++ or C#? Pin
led mike27-May-09 5:01
led mike27-May-09 5:01 
GeneralRe: Use native C++-DLLs with managed C++ or C#? Pin
Luc Pattyn27-May-09 5:50
sitebuilderLuc Pattyn27-May-09 5:50 
GeneralRe: Use native C++-DLLs with managed C++ or C#? Pin
N a v a n e e t h27-May-09 17:22
N a v a n e e t h27-May-09 17:22 
QuestionResizing of Labels in Controls Pin
cherrymotion21-May-09 21:23
cherrymotion21-May-09 21:23 
AnswerRe: Resizing of Labels in Controls Pin
N a v a n e e t h21-May-09 21:54
N a v a n e e t h21-May-09 21:54 
GeneralRe: Resizing of Labels in Controls Pin
cherrymotion21-May-09 22:16
cherrymotion21-May-09 22:16 
QuestionRe: Resizing of Labels in Controls Pin
led mike22-May-09 4:26
led mike22-May-09 4:26 
AnswerRe: Resizing of Labels in Controls Pin
cherrymotion22-May-09 8:25
cherrymotion22-May-09 8:25 
GeneralRe: Resizing of Labels in Controls [modified] Pin
Luc Pattyn22-May-09 9:40
sitebuilderLuc Pattyn22-May-09 9:40 
QuestionSending events to main window of another process Pin
parth_patel21-May-09 5:34
parth_patel21-May-09 5:34 
QuestionRe: Sending events to main window of another process Pin
led mike21-May-09 5:48
led mike21-May-09 5:48 
AnswerRe: Sending events to main window of another process Pin
parth_patel21-May-09 6:05
parth_patel21-May-09 6:05 
GeneralRe: Sending events to main window of another process Pin
led mike21-May-09 7:50
led mike21-May-09 7:50 
GeneralRe: Sending events to main window of another process Pin
parth_patel21-May-09 10:58
parth_patel21-May-09 10:58 
GeneralRe: Sending events to main window of another process Pin
parth_patel27-May-09 9:23
parth_patel27-May-09 9:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.