let absoluteSumModule = (new DeviceReduceModule<float32>(GPUModuleTarget.Worker(worker), fun a b -> a+b)).Create(128000)
I've tried various maxNumItems settings but no mater what it throws the same exception. Unlike last time I have no idea what the error could even possibly be so I've included the whole dump here.
Failure
(Description "$f0(sm52,64)",
Exception
System.OverflowException: Value was either too large or too small for a UInt16.
at Alea.CUDA.UsageByInstanceUtil.f@1-46(Object clrModuleInstance, IRModuleBuildingContext ctx, FieldInfo fieldInfo)
at Alea.CUDA.UsageByInstanceUtil.cudafy@104.Invoke(IRModuleBuildingContext ctx)
at <StartupCode$Alea-CUDA>.$Compilation.compile@490[T](Template`1 template, FSharpOption`1 bitcodeCache, IRModuleBuildingContext ctx, Unit unitVar0)
at <StartupCode$Alea-CUDA>.$Compilation.compile@515-7[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 Alea.CUDA.UsageByInstanceUtil.f@1-46(Object clrModuleInstance, IRModuleBuildingContext ctx, FieldInfo fieldInfo)
at Alea.CUDA.UsageByInstanceUtil.cudafy@104.Invoke(IRModuleBuildingContext ctx)
at <StartupCode$Alea-CUDA>.$Compilation.compile@490[T](Template`1 template, FSharpOption`1 bitcodeCache, IRModuleBuildingContext ctx, Unit unitVar0)
at <StartupCode$Alea-CUDA>.$Compilation.compile@515-7[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>.$UsageByInstance.-ctor@271-215.Invoke(Unit _arg1)
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at <StartupCode$Alea-CUDA>.$UsageByInstance.-ctor@77-214.Invoke(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>.$FSI_0002.main@() in C:\Users\Marko\Documents\Visual Studio 2015\Projects\Load MNIST\Load MNIST\utils.fsx:line 28
Stopped due to error
Well, I checked that, looks like it is a bug. Will have to check this. It works if you code it in normal F# file, but doesn't work in F# interactive.
In the mean time, in F#, we encourge you to use quotations for the operator, so you can try this:
> 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>
>
So, instead of using fun a b -> a + b
you can try <@ fun a b -> a + b @>
, or simply <@ (+) @>
.