Search code examples
aleagpu

DeviceReduceModule can't find the IL file


System.TypeInitializationException: The type initializer for 'Alea.CUDA.IL.CIRCallInstructionBuilder' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Alea.IL, Version=2.1.2.3274, Culture=neutral, PublicKeyToken=ba52afc3c2e933d6' or one of its dependencies. The system cannot find the file specified.

The above is the relevant snippet. I am guessing I did not setup Alea correctly, but the troublesome thing is that everything else works for me perfectly. Only this piece of code below throws an exception.

let absoluteSumModule = (new DeviceReduceModule<float32>(GPUModuleTarget.Worker(worker), fun a b -> abs(a)+abs(b))).Create(hidden_layer_width*dtest_data.num_rows)

I am doing all my work in F# Scripting mode and here is how I set it up.

#I @"C:\F# Packages\packages\Alea.CUDA.2.1.2.3274\private"
#I @"C:\F# Packages\packages\Alea.CUDA.2.1.2.3274\lib\net40"
#I @"C:\F# Packages\packages\Alea.CUDA.IL.2.1.2.3274\lib\net40"
#I @"C:\F# Packages\packages\Alea.CUDA.Unbound.2.1.2.3274\lib\net40"
#r @"Alea.CUDA.Unbound.dll"
#r @"Alea.CUDA.IL.dll"
#r @"Alea.CUDA.dll"
#r @"Alea.CUDA.CT.Native.X86.B64.Windows.dll"
#r "System.Configuration.dll"

My own code, CuBlas, Unbound's random modules, Unbound's block reduce and scan, and the DeviceSumModuleF32 work for me. I tried pointing the Alea.CUDA.Settings.Instance.Resource.AssemblyPath and Alea.CUDA.Settings.Instance.Resource.Path at various library directories, but that does not seem to be doing anything at all. Not having it set at all for the past few weeks did not hinder me. I haven't touched the app.config file because I am not sure how to configure it and am not that comfortable editing config files by hand.

Any advice?


Solution

  • I guess you miss loading Alea.IL.dll. Alea.CUDA.Unbound depends on Alea.CUDA.IL, and Alea.CUDA.IL depends on Alea.CUDA AND Alea.IL. See here for more information.

    In your fsx file, you can try add Alea.IL, and you don't need reference Alea.CUDA.CT.XXXX, just point the Resource.AssemblyPath to that private folder is enough.