DeviceReduceModule 抛出一个 OverflowException
DeviceReduceModule throws an OverflowException
let absoluteSumModule = (new DeviceReduceModule<float32>(GPUModuleTarget.Worker(worker), fun a b -> a+b)).Create(128000)
我已经尝试了各种 maxNumItems 设置,但不管怎样它都会抛出相同的异常。与上次不同,我什至不知道错误可能是什么,所以我在这里包含了整个转储。
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
嗯,我检查了一下,看起来是一个错误。将不得不检查这个。如果您在普通 F# 文件中编写代码,它会起作用,但在 F# 交互式文件中不起作用。
同时,在 F# 中,我们鼓励您对运算符使用引号,因此您可以试试这个:
> 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
let absoluteSumModule = (new DeviceReduceModule<float32>(GPUModuleTarget.Worker(worker), fun a b -> a+b)).Create(128000)
我已经尝试了各种 maxNumItems 设置,但不管怎样它都会抛出相同的异常。与上次不同,我什至不知道错误可能是什么,所以我在这里包含了整个转储。
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
嗯,我检查了一下,看起来是一个错误。将不得不检查这个。如果您在普通 F# 文件中编写代码,它会起作用,但在 F# 交互式文件中不起作用。
同时,在 F# 中,我们鼓励您对运算符使用引号,因此您可以试试这个:
> 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