0
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
4

1 回答 1

1

好吧,我检查了,看起来这是一个错误。将不得不检查这一点。如果您在普通的 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 @>,或者简单地使用<@ (+) @>.

于 2015-09-05T05:16:21.890 回答