mbraceproject / MBrace.StarterKit

A collection of demos and tutorials for MBrace
http://mbrace.io
57 stars 34 forks source link

null reference exception in cloud flow #24

Closed soloman817 closed 9 years ago

soloman817 commented 9 years ago

Hi guys,

I tried a C# coded gpu code with Alea GPU, and want to run it through mbrace azure. But I get null reference exception from CloudFlow.Apply()

the C# code is : https://github.com/quantalea/GPUCloudDemo/blob/master/MyApp.CS/CalcPI.cs#L54 and the code to launch it with mbrace azure is: https://github.com/quantalea/GPUCloudDemo/blob/master/CloudScripts/CalcPI_CS.fsx#L55

I get the following error when trying to run it:

Binding session to 'C:\Users\Xiang\Documents\Projects\GPUCloudDemo_quantalea\CloudScripts\../packages/Microsoft.Data.Edm/lib/net40\Microsoft.Data.Edm.dll'...
Binding session to 'C:\Users\Xiang\Documents\Projects\GPUCloudDemo_quantalea\CloudScripts\../packages/Microsoft.Data.Services.Client/lib/net40\Microsoft.Data.Services.Client.dll'...
Binding session to 'C:\Users\Xiang\Documents\Projects\GPUCloudDemo_quantalea\CloudScripts\../packages/Microsoft.Data.OData/lib/net40\Microsoft.Data.OData.dll'...
Binding session to 'C:\Users\Xiang\Documents\Projects\GPUCloudDemo_quantalea\CloudScripts\../packages/Newtonsoft.Json/lib/net45\Newtonsoft.Json.dll'...
Binding session to 'C:\Users\Xiang\Documents\Projects\GPUCloudDemo_quantalea\CloudScripts\../packages/System.Spatial/lib/net40\System.Spatial.dll'...
Binding session to 'C:\Users\Xiang\Documents\Projects\GPUCloudDemo_quantalea\CloudScripts\../packages\Alea.CUDA.Unbound/lib/net40/Alea.CUDA.Unbound.dll'...
Binding session to 'C:\Users\Xiang\Documents\Projects\GPUCloudDemo_quantalea\CloudScripts\../packages\Alea.CUDA.IL/lib/net40/Alea.CUDA.IL.dll'...
Binding session to 'C:\Users\Xiang\Documents\Projects\GPUCloudDemo_quantalea\CloudScripts\../packages\Alea.IL/lib/net40/Alea.IL.dll'...
System.NullReferenceException: Object reference not set to an instance of an object.
   at FSI_0003.pi@55-1.MBrace-Flow-CloudFlow`1-Apply[S,Result](Local`1 X1, FSharpFunc`2 X2, FSharpFunc`2 X3)
   at FSI_0003.pi@56-7.Invoke(Unit unitVar)
   at MBrace.Builders.Delay@287-1.Invoke(ExecutionContext ctx, Unit t) in c:\Users\eirik\Development\mbrace\MBrace.Core\src\MBrace.Core\Continuation\Builders.fs:line 287
--- End of stack trace from previous location where exception was thrown ---
   在 <StartupCode$MBrace-Azure-Client>.$Process.AwaitResultAsync@135-2.Invoke(Unit _arg4) 位置 c:\Users\eirik\Development\mbrace\MBrace.Azure\src\MBrace.Azure.Client\Process.fs:行号 135
   在 Microsoft.FSharp.Control.AsyncBuilderImpl.args@787-1.Invoke(a a)
   at MBrace.Continuation.ExceptionDispatchInfoUtils.Async.RunSync[T](FSharpAsync`1 workflow, FSharpOption`1 cancellationToken) in c:\Users\eirik\Development\mbrace\MBrace.Core\src\MBrace.Core\Continuation\ExceptionDispatchInfo.fs:line 138
   at <StartupCode$MBrace-Azure-Client>.$Client.RunAsync@232-2.Invoke(Unit unitVar) in c:\Users\eirik\Development\mbrace\MBrace.Azure\src\MBrace.Azure.Client\Client.fs:line 232
   at Microsoft.FSharp.Control.AsyncBuilderImpl.callA@803.Invoke(AsyncParams`1 args)
   at MBrace.Continuation.ExceptionDispatchInfoUtils.Async.RunSync[T](FSharpAsync`1 workflow, FSharpOption`1 cancellationToken) in c:\Users\eirik\Development\mbrace\MBrace.Core\src\MBrace.Core\Continuation\ExceptionDispatchInfo.fs:line 138
   at <StartupCode$FSI_0003>.$FSI_0003.main@() in C:\Users\Xiang\Documents\Projects\GPUCloudDemo_quantalea\CloudScripts\CalcPI_CS.fsx:line 52
Stopped due to error
> 

For how to run the cloud gpu demo, please reference: https://github.com/quantalea/GPUCloudDemo/blob/master/README.md

palladin commented 9 years ago

Hi Xiang, Try to add the Serializable attribute to CalcPIParam

[Serializable]
public class CalcPIParam

Sorry for the weird exception, I think that it is fixed in the master branch.

soloman817 commented 9 years ago

@palladin thanks, I added that, and it works smoothly now!