Hi,
i build a litlle function Brook+, it runs fine from Visual Studio but if i compile it as a dll and load it from an another program it crashes. Could it be that GPU kernels which are called from a dll always crash? Maybe a bug?
DLL built with MT or MD flag?
Originally posted by: genaganna DLL built with MT or MD flag?
I compile with none of them, this is how i compile:
cl.exe /EHsc -I%brook% -LD main.cpp BrookSimpleTest.cpp -FeGPU_DLL.dll /link /LIBPATH:%brooklibs% %libs%
Which flag i should use?
compile with MD flag.
Originally posted by: genaganna compile with MD flag.
I added the /MD flag, which libs? i've to add? Because the program fails because (Unsatisfied Link Errors, cannot find dependent libraries). This is my bat file
set brook="C:\Program Files\ATI\ATI Brook+ 1.4.0_beta\sdk\include"
set brooklibs="C:\Program Files\ATI\ATI Brook+ 1.4.0_beta\sdk\lib"
set libs="brook.lib"
"%VC2008%\cl" /MD /EHsc -I%brook% -LD main.cpp BrookSimpleTest.cpp -FeHelloNative.dll /link /LIBPATH:%brooklibs% %libs%
Hi Steven_Makoviac,
I assume you are using XP for your development. Brook+ uses one thread local variable in the generated CPP and XP (not Vista or Linux) has limitation on using thread local variable in a dll and calling LoadLibrary() on this dll (more information at http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx).
There are two possible solution of this issue. You can choose any one of them-
1. Instead of loading libraries at runtime, make them link time dependent.
2. Change line 48 of KernelInterface.h (under $(BROOKROOT)\ sdk\include\brook) from #define __THREAD__ __declspec(thread) to #define __THREAD__ and rebuild your application or dll (no need to build Brook+ source). This change should not affect your application until your application is calling the same kernel from multiple threads.
Hi,
yes i'm using Windows XP but now it works. I used the second solution.
Many thanks
Interesting. It was explained to me that this wouldn't gaurantee correct results, unless something has changed in 1.4.
In fact, this flies directly in the face off their Stream Programming Model and the fact that there are no read/write streams.
I'm interested to see what AMD has to say.
Edit:Removed Advertising from the post