newton on gpu or discrete HPC

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: newton on gpu or discrete HPC

Postby Julio Jerez » Thu Sep 27, 2018 2:50 am

Oh I just post when you were making your post,
please sync again. you should select the sse and dx12 plugins and you should get the plugin identifications.

ok Joe, when you read this.
now if you sync and you use cmake, you can crate a solution that let you select any of the available plugins.

I added the NewtonSse which soudl work on all modern CPU, and the newtonDX12
I am naming it by the name found on the d3dvice. and I gave the highest score.

the only thong is does is create the adapter and pick the GPU device.
in my case is an AMD radion rx 480

which seems to be quite good, 2304 stream processors, 36 compute units and 8 gb ram.
that about 70 time the number of alu in a quadcore. so even wit the cost of memory
we should expect some impressive results.
for now the plugin will run but is just using the CPU.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: newton on gpu or discrete HPC

Postby JoeJ » Thu Sep 27, 2018 3:29 am

Julio Jerez wrote:you sould select the sse and dx12 plugins and you should get the plugin identifications.


Ok, starting from scratch, i see i can select x64 at the same time i select the complier. This time i choose VC2015 x64.
Now there are 5 plugins (SSE and SSE4) I'm unsure of support, so i check only SSE and DX12.

Projects fine... building fine...

But no option or info about PlugIn usage.
I would expect some info in statistics window or options menu. Is there something more i need to do?

Julio Jerez wrote:in my case is an AMD radion rx 480

which seems to be quite good


I would see this as a high end GPU, compute performance should be at least at GTX 1080 level.
I don't know how 20X0 performs with compute, but with spending so much chip area on Tensor and RT cores, i do not expect a big boost.
So what you have is more than you can expect from the average user. (Any GCN is good, but older NV like Kepler is very slow with compute.)
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: newton on gpu or discrete HPC

Postby Julio Jerez » Thu Sep 27, 2018 12:02 pm

you did it right. It must not be loading the plugins.
I will do the step you did on a different computers and what is wrong.

on compute shader been slower on nvidia cards, that does not surprise me. I heard graphics programers for years doing the more atrocious things like loading a map to gpu, rendering some stuff them get it back do some cpu work and then loading again to render to screen.
when I ask them why they do not use computer shader, their answer is that they are slower.

I would not be surprise nvidia delivery slow down compute shader to give an advantage to cuda, they are notorious for doing that kind of shenanigans for years.
Stuff like looking for signature of unreal games in the driver in order to unlock some experimental functionality that not other dev would not have otherwise.
the corruption at nvidia is standard procedure operation for them.

mark my word, I bet you one day a nerd will figure that out and expose it, there will be another scadal, but nothing will happens because people has grown to be complasan and docile as long as they think they are getting free stuff.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: newton on gpu or discrete HPC

Postby JoeJ » Thu Sep 27, 2018 1:50 pm

Julio Jerez wrote:Stuff like looking for signature of unreal games in the driver in order to unlock some experimental functionality that not other dev would not have otherwise.


No no, man. That's just because NV and Epic are awesome buddies who now drive all progress and innovation there is in games. Of course they manage to tickle a bit more performance out - they are just so clever. We are just fools still working on custom physics or graphics, instead making games, instead using free stuff we will never be able to catch up with, haha! :mrgreen:
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: newton on gpu or discrete HPC

Postby Julio Jerez » Thu Sep 27, 2018 2:09 pm

I just did the step you did on a different machine at work and it does work.
I get two plugin sse, and NVidia 970

can you set a brak point on this line and see if it get there

..\newton-dynamics\sdk\dgNewtonDx12\dgWorldBase.cpp
Code: Select all
// This is an example of an exported function.
dgWorldPlugin* GetPlugin(dgWorld* const world, dgMemoryAllocator* const allocator)
{
   
   static dgWorldBase module(world, allocator);


if it does not then some how the path is wrong, maybe because of language stuff.
I recently change the way the plugin are loaded form.
before the engine was getting the path of the exe by calling the windowGetAppPath function,
but now the there is a load plugin that take the path as an argument, this is because some engine like unity and unreal plugin are loaded form a directory that is different that the executable.
can you step there and see if the function does find the dlls at the specified locations.
wen you have some time.

this is the code,
Code: Select all
#ifdef _DEBUG
   strcat(plugInPath, "/newtonPlugins/debug");
#else
   strcat(plugInPath, "/newtonPlugins/release");
#endif
   NewtonLoadPlugins(m_world, plugInPath);
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: newton on gpu or discrete HPC

Postby JoeJ » Thu Sep 27, 2018 2:24 pm

Julio Jerez wrote:static dgWorldBase module(world, allocator);


Breakpoint here does not get hit.

So i start from there:
NewtonLoadPlugins(m_world, plugInPath);

path is
"C:\\dev\\newton-dynamics-master\\applications\\demosSandbox\\Debug/newtonPlugins/debug"

Path is valid and contains the two dlls as expected...

HMODULE module = LoadLibrary(rootPathInPath);

module is NULL in both cases.

maybe it's the wrong \ vs. / in the path?
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: newton on gpu or discrete HPC

Postby Julio Jerez » Thu Sep 27, 2018 2:32 pm

are the dlls in the folder?
can you add the like
Code: Select all
         sprintf(rootPathInPath, "%s/%s", plugInPath, data.name);
         HMODULE module = LoadLibrary(rootPathInPath);

// add
                        DWORD WINAPI GetLastError(void);

to see what error generates?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: newton on gpu or discrete HPC

Postby JoeJ » Thu Sep 27, 2018 2:36 pm

I try to change this:

#ifdef _DEBUG
//strcat(plugInPath, "/newtonPlugins/debug");
strcat(plugInPath, "\\newtonPlugins\\debug");
#else

nope, does not help. so i also change this:

#if _MSC_VER > 1700
char rootPathInPath[2048];
//sprintf(rootPathInPath, "%s/*.dll", plugInPath);
sprintf(rootPathInPath, "%s\\*.dll", plugInPath);

...
//sprintf(rootPathInPath, "%s/%s", plugInPath, data.name);
sprintf(rootPathInPath, "%s\\%s", plugInPath, data.name);


rootPathInPath is now "C:\\dev\\newton-dynamics-master\\applications\\demosSandbox\\Debug\\newtonPlugins\\debug\\dgNewtonDx12_d.dll"

All \\ instead /, but it does not help, HMODULE module = LoadLibrary(rootPathInPath) still NULL
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: newton on gpu or discrete HPC

Postby Julio Jerez » Thu Sep 27, 2018 2:39 pm

wait a minute shouldn't the path have library name at the end?
for me the path looks like this
rootPathInPath =
"C:\Temp\xxxxxxxxxxxxxx\applications\demosSandbox\Debug/newtonPlugins/debug/dgNewtonDx12_d.dll"
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: newton on gpu or discrete HPC

Postby JoeJ » Thu Sep 27, 2018 2:41 pm

Julio Jerez wrote:are the dlls in the folder?
can you add the like
Code: Select all
         sprintf(rootPathInPath, "%s/%s", plugInPath, data.name);
         HMODULE module = LoadLibrary(rootPathInPath);

// add
                        DWORD WINAPI GetLastError(void);

to see what error generates?


dlls are there.
GetLasError returns 1114

ERROR_DLL_INIT_FAILED

1114 (0x45A)

A dynamic link library (DLL) initialization routine failed.
Last edited by JoeJ on Thu Sep 27, 2018 2:43 pm, edited 1 time in total.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: newton on gpu or discrete HPC

Postby Julio Jerez » Thu Sep 27, 2018 2:43 pm

when a library is loaded, it call the main function, set a break point on this function

Code: Select all
BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                )
{
   switch (ul_reason_for_call)


the will rule out if the path is valid or not and also if the error is produced by the DLL.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: newton on gpu or discrete HPC

Postby JoeJ » Thu Sep 27, 2018 2:50 pm

Julio Jerez wrote:BOOL APIENTRY DllMain( HMODULE hModule


I get there often, but only for newton_d.dll. Then the sandbox window shows up and brekpoint is no more hit.

Edit: I did revert my changes about \ or /. Path seems not the issue.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: newton on gpu or discrete HPC

Postby Julio Jerez » Thu Sep 27, 2018 2:55 pm

ah stupid me I think I found the bug, it was a copy and paste bug

at the end of the DLL main BOOL APIENTRY DllMain( HMODULE hModule
I do the hardware detection for SSE4 or AVX, but your cpu does not support those sets.
It is removed now because these plugins do not use any special CPU instructions.

please sync again
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: newton on gpu or discrete HPC

Postby JoeJ » Thu Sep 27, 2018 3:06 pm

Yeah...

but now i get this:

Unhandled exception at 0x00007FFC5597CDB3 (dgNewtonDx12_d.dll) in demosSandbox.exe: 0xC000001D: Illegal Instruction.

breaks into parallelSolver.h
Code: Select all
DG_INLINE dgParallelBodySolver::dgParallelBodySolver(dgMemoryAllocator* const allocator)
   :m_world(NULL)
   ,m_cluster(NULL)
   ,m_bodyArray(NULL)
   ,m_jointArray(NULL)
   ,m_bodyProxyArray(NULL)
   ,m_timestep(dgFloat32(0.0f)) /// <- here
   ,m_invTimestep(dgFloat32(0.0f))
   ,m_invStepRK(dgFloat32(0.0f))
   ,m_timestepRK(dgFloat32(0.0f))
   ,m_invTimestepRK(dgFloat32(0.0f))
   ,m_firstPassCoef(dgFloat32(0.0f))
   ,m_jointCount(0)
   ,m_jacobianMatrixRowAtomicIndex(0)
   ,m_solverPasses(0)
   ,m_threadCounts(0)
   ,m_soaRowsCount(0)
   ,m_soaRowStart(NULL)
   ,m_bodyRowStart(NULL)
   ,m_massMatrix(allocator)
{
}


which does not make much sense.
I'll try SSE plugin only...
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: newton on gpu or discrete HPC

Postby JoeJ » Thu Sep 27, 2018 3:08 pm

Ok, i have deleted DX12 dll manually and sandbox starts up, displaying plugin: newtonSSE4.2_d


Then i rebuild DX12 dll to get the same exception again.
Call stack:
Code: Select all
>   dgNewtonDx12_d.dll!dgParallelBodySolver::dgParallelBodySolver(dgMemoryAllocator * const allocator) Line 328   C++
    dgNewtonDx12_d.dll!dgSolver::dgSolver(dgWorld * const world, dgMemoryAllocator * const allocator) Line 33   C++
    dgNewtonDx12_d.dll!dgWorldBase::dgWorldBase(dgWorld * const world, dgMemoryAllocator * const allocator) Line 47   C++
    dgNewtonDx12_d.dll!GetPlugin(dgWorld * const world, dgMemoryAllocator * const allocator) Line 39   C++
    newton_d.dll!dgWorldPluginList::LoadVisualStudioPlugins(const char * const plugInPath) Line 62   C++
    newton_d.dll!dgWorldPluginList::LoadPlugins(const char * const path) Line 94   C++
    newton_d.dll!NewtonLoadPlugins(const NewtonWorld * const newtonWorld, const char * const plugInPath) Line 324   C++
    demosSandbox.exe!DemoEntityManager::Cleanup() Line 583   C++
    demosSandbox.exe!DemoEntityManager::DemoEntityManager() Line 331   C++
    demosSandbox.exe!main(int __formal, char * * __formal) Line 45   C++
    demosSandbox.exe!invoke_main() Line 65   C++
    demosSandbox.exe!__scrt_common_main_seh() Line 253   C++
    demosSandbox.exe!__scrt_common_main() Line 296   C++
    demosSandbox.exe!mainCRTStartup() Line 17   C++
    kernel32.dll!00007ffc88503034()   Unknown
    ntdll.dll!00007ffc88cb1461()   Unknown
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 12 guests

cron