|
Hi All,
After reading about parallel programming by multicore processor,I have some doubts.
1>Its undoubtedly best idea for play stations,X-Box [as they have soo... many cores]
But will it prove to be effective for core i7 running 8 parallel process then running 100 thread in Windows 7 64 bit?
2> If some how its managed to make all the process running parallel with less critical resource to then will it give better performance over 100 thread?
3>If not then in which case I can see multicore programming[I am trying VC++ with Opem MP] winning over multi thread in my i7,win 7[64 bit] ,4GB ram?
[it will be great If I can get a code in C++ or JAVA to run in my machine to compare same task running 1>parallel,2>sequence,3>thread]
Eagerly Waiting for the response.
Thanks in advance.
|
|
|
|
|
See here[^]; please post your question in one forum only.
|
|
|
|
|
I am facing problems in launching my dll application. which is launching correctly for some PCS but it is not launching for some other PCS. Pls check the 2 attachments.
one is working.jpeg which is working fine. it is expected that when clicking on launch button from client this should show the screen with the CAD model. for some pcs this is working.
Check the other attachment which not-working-screen-shot.png which on launching the application it's not displaying the model. it is a grey color screen whethe there's no opengl window even.
I have developed this dll application in dialog based window. Pls help resolve this problem. Thanks a lot in advance Sujan
Check the attachements in codeguru. thread name as this thread name "dll application is not launching for some PCS" under VC++ programming.
|
|
|
|
|
What do you mean by "dll application"? You cannot launch a DLL, it can only be loaded from a running executable file. As to your links, if you cannot post them here I do not think anyone is going to go searching for them. Also without some further information than "doesn't work", it's anybody's guess what is happening.
|
|
|
|
|
Richard MacCutchan wrote: . Also without some further information than "doesn't work", it's anybody's guess what is happening.
Come on, Richard. This is exactly why you should stop using Windows 95. It just doesn't have the guessing capability that newer OSs do.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
|
I have a Delphi application which Creates a shared memory uses CreateFileMapping, OpenFileMapping, MapViewOfFile functions.
Now I wanted to share the same memory for my MFC application. I used the OpenFileMapping, MapViewOfFile functions.
I created a structure exactly same in size as the Delphi application and mapped the structure object.
sample code:
HANDLE hMapObject2;
hMapObject2 = OpenFileMapping( FILE_MAP_ALL_ACCESS, FALSE, "PP101U3_SHARED");
if( !hMapObject2 )
{
AfxMessageBox("Failed to open Simpack DataBase");
return( 0 );
}
Simpack = ( struct SIMPACKDB *) MapViewOfFile( hMapObject2, FILE_MAP_ALL_ACCESS, 0, 0, 0 );
if( !Simpack )
{
AfxMessageBox("Failed to create Simpack File Map View");
return(0);
}
Esim->SPV1 = Simpack->SP_Z;I am able to read the values exactly correct for all the member variables in the structure.
But when I try to write value in the shared memory, its not changing. It shows the previous value immediately in the debugger watch window.
The value of Simpack->SP_Z[15] is 0.5010 as read from the shared memory which is got from the Delphi application. i.e., value set by the Delphi application
When I set or write the value of the same variable to the shared memory in my MFC Application using the code:
Simpack->SP_Z[15] = 0.6123;
or
float test = 0.6123;
memcpy( Simpack->SP_Z + 16, &test, sizeof(float));it still shows the previous value 0.5010 which is got from the Delphi Application. But When I change the same variable's value in the Delphi applicationit changes and the changed value can be read here in the MFC application.
Please help me to find why I am unable to write or set value in the shared memory from my MFC Application and suggest me with any code how to write the values in the shared memory from my MFC Application.
Is there anything wrong in the code?
Is this happening because I am sharing the memory that is created by a Delphi Application from a MFC Application? i.e., Sharing memory between Delphi and MFC Application is not allowed.
|
|
|
|
|
You may need to use #pragma pack compiler option round your structure, as C++ (in Windows) tends to align structures at word boundaries by default. As to your second problem, you may like to check this sample[^] to see if you are missing something.
|
|
|
|
|
Hi Guy,
I am trying to add checkboxes to the multiple columns of a MFC List ctrl.
Can you please help me in this. If possible please share me some snippet for the same.
Thanks.
asdasdadadasd
|
|
|
|
|
|
You can also look here[^], these list control can have any control in any column ...
modified 16-Jun-12 5:16am.
|
|
|
|
|
Hi all,
I'll try to explain my question as much as quickly. Actually its not a question, but a clarification I am looking for.
Say I have a two code blocks which is doing two different things. I can implement those two blocks in two functions and call as I need from a third function. Or else, I can implement those two blocks in the third function and used goto jump between blocks. So what is the difference between two?
Thanks for all the comments in advance.
If you've never failed... You've never lived...
|
|
|
|
|
// So what is the difference between two?
I would say
- stack
- accountability for the heap (de-)allocations
- perfomance
- re-usage of the functions
- readability
What thesis does stay misty for you ?
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
A goto wont add stuff to the stack like a function call will.
But the problem is that the code that you goto has to get back somehow, which means embedding a label in your code, which means you goto code would be better just put in your calling code. So really, you should use a func, it will be easier.
Gotos are useful for exiting funcs in error conditions. (Often replaced by a do{}while(0) these days).
==============================
Nothing to say.
|
|
|
|
|
People will hate you if you use goto , it makes the code more difficult to test, debug and maintain; stick with functions.
|
|
|
|
|
This is pure dogma. Any code can be crap and hard to maintain and goto when used judiciously is perfectly OK.
For example:
myfunc()
{
do{
if(!somefunc())
continue;
if(!someotherfunc())
continue;
}while(0);
}
Is heavy when compared to:
myfunc()
{
if(!somefunc())
goto end;
if(!someotherfunc())
goto end;
end:
}
==============================
Nothing to say.
|
|
|
|
|
Erudite_Eric wrote: This is pure dogma.
Not at all. And what's wrong with:
myfunc()
{
if(somefunc() &&
someotherfunc())
{
}
}
|
|
|
|
|
I think I have found a bug in the CString assignement operator of the ATL/MFC 8.
CStringT& operator=( __in_z_opt PCYSTR pszSrc )
The method calculates the length of the required buffer and allocates the buffer. The calculation does not include the terminating null character. Thereafter it calls MultiByteToWideChar, passing the length as the cchWideChar parameter.
The function MultiByteToWideChar returns 0 as failure indication, but this is ignored by the MFC. As a side effect, MultiByteToWideChar fills the output buffer on some platforms like Win32 and Windows CE 5.0 (SH4).
But the Windows CE 5.0 (x86) implementation of MultiByteToWideChar does not fill the buffer. Although the allocated buffer is too small, the bug is not visible on most platforms but on Windows CE 5.0 (x86). Here you get an empty CString after the assignment.
Example:
CStringW s("ABC");
PCWSTR p = (PCWSTR)s;
assert(0 != p[0]); The assert in the code above fails.
|
|
|
|
|
It wont be the first time different platforms have behaved differently. Whether MS will admit its a bug or not, well, they dont like to.
But anyway, contact them and see what they say. There might be a patch already.
==============================
Nothing to say.
|
|
|
|
|
Here is an polar example of the operator's usage :
{
LPTSTR lpszBuffer(_T("test"));
CString cszDestination;
cszDestination = lpszBuffer; ASSERT(cszDestination[0] == _T('t'));
}
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
Yes, this calls the assignment constructor directly. It shows the same behavior since it executes the same code.
My example came from a real project.
As long Microsoft is reluctant to fix this I will have to get the debug source code and build my own MFC version. Unfortunately this requires to install this version on all PCs that just wants to assign an (ANSI) string to a string class object.
|
|
|
|
|
class Filter;
typedef void (Filter::*PFN)();
class Filter
{
public:
void ProcessPart();
void MyProcessPart();
struct Pair_t
{
Pair_t(int d, PFN n) : iid(d), pfn(n) {}
int iid;
PFN pfn;
private:
Pair_t& operator=(const Pair_t&);
};
};
void Filter::ProcessPart()
{
PFN pfn2;
pfn2 = dynamic_cast<Filter*> (&Filter::ProcessPart);
Pair_t(9, pfn2);
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
I am not able to solve this.
Any help?
Thanks
|
|
|
|
|
You are trying to cast a function address to a pointer to a class, which is illegal.
|
|
|
|
|
Ya I got it.
Thanks Richard MacCutchan
|
|
|
|
|
Function pointer casting has a really crappy syntax in C. I posted on it way back, but so ugly is I have totally forgotten how it goes.
==============================
Nothing to say.
|
|
|
|