2015-09-04 47 views
0
let absoluteSumModule = (new DeviceReduceModule<float32>(GPUModuleTarget.Worker(worker), fun a b -> a+b)).Create(128000) 

我試過各種maxNumItems設置,但沒有mater它拋出相同的異常。與上次不同,我不知道這個錯誤甚至可能是什麼,所以我在這裏包括了整個轉儲。DeviceReduceModule拋出一個OverflowException

Failure 
    (Description "$f0(sm52,64)", 
    Exception 
    System.OverflowException: Value was either too large or too small for a UInt16. 
    at [email protected](Object clrModuleInstance, IRModuleBuildingContext ctx, FieldInfo fieldInfo) 
    at [email protected](IRModuleBuildingContext ctx) 
    at <StartupCode$Alea-CUDA>[email protected][T](Template`1 template, FSharpOption`1 bitcodeCache, IRModuleBuildingContext ctx, Unit unitVar0) 
    at <StartupCode$Alea-CUDA>[email protected][T](Template`1 template, FSharpOption`1 bitcodeCache, IRModuleBuildingContext ctx, Unit unitVar0), 
    System.OverflowException: Value was either too large or too small for a UInt16. 
    at [email protected](Object clrModuleInstance, IRModuleBuildingContext ctx, FieldInfo fieldInfo) 
    at [email protected](IRModuleBuildingContext ctx) 
    at <StartupCode$Alea-CUDA>[email protected][T](Template`1 template, FSharpOption`1 bitcodeCache, IRModuleBuildingContext ctx, Unit unitVar0) 
    at <StartupCode$Alea-CUDA>[email protected][T](Template`1 template, FSharpOption`1 bitcodeCache, IRModuleBuildingContext ctx, Unit unitVar0)) 
System.Exception: Compiling failed. 
    at Alea.CUDA.Worker.LoadProgram[T](Template`1 template, CompileOptions options) 
    at <StartupCode$Alea-CUDA>[email protected](Unit _arg1) 
    at System.Lazy`1.CreateValue() 
    at System.Lazy`1.LazyInitValue() 
    at <StartupCode$Alea-CUDA>[email protected](Unit _arg1) 
    at System.Lazy`1.CreateValue() 
    at System.Lazy`1.LazyInitValue() 
    at Alea.CUDA.Unbound.DeviceReduceModule`1.Create(Int32 maxNumItems) 
    at <StartupCode$FSI_0002>[email protected]() in C:\Users\Marko\Documents\Visual Studio 2015\Projects\Load MNIST\Load MNIST\utils.fsx:line 28 
Stopped due to error 

回答

1

嗯,我檢查了一下,看起來它是一個錯誤。將不得不檢查這一點。如果您在普通的F#文件中編寫代碼,但它在F#交互式中不起作用,它將起作用。

與此同時,在F#中,我們encourge您使用的報價爲運營商,所以你可以試試這個:

> let worker = Worker.Default;; 

val worker : Worker = [0|5.2|GeForce GTX 970|7] 

> let m = new DeviceReduceModule<float32>(GPUModuleTarget.Worker(worker), <@ (+) @>);; 
Binding session to 'C:\Users\Xiang\Documents\Inbox\Library3\packages\Alea.CUDA.IL.2.1.2.3274\lib\net40\Alea.CUDA.IL.dll'... 

val m : DeviceReduceModule<float32> 

> m.GPUForceLoad();; 
Binding session to 'C:\Users\Xiang\Documents\Inbox\Library3\packages\Alea.CUDA.2.1.2.3274\lib\net40\Alea.CUDA.dll'... 
val it : unit =() 
> let x = m.Create(128000);; 

val x : DeviceReduce<float32> 

> 

所以,而是採用fun a b -> a + b你可以嘗試<@ fun a b -> a + b @>,或者乾脆<@ (+) @>

+0

非常感謝您耐心回答我的所有問題。 –