The question is quite simple.
I am developing part of a script for grasshopper that makes use of gpu for computing.
I am trying to use the Alea http://www.quantalea.com/ library which is just a wrap around the CUDA C environment.
I tried two ways.
Loading a component build in Visual Studio, grasshopper does not recognize the Alea library, throwing the exception "Could not load file or assembly 'Alea, Version=3.0.0.0"
I checked version, public token and if the file was locked and everything seemed to be fine.
Second way, loading the library directly into a C# grasshopper component.
As soon as I write Alea.Gpu
Rhino crashes.
Is there any known compatibility issue? If so, is there a way work around the issue?
Hi Giulio,
Thanks for the quick answer.
Here is the return from the corflag of the Alea.dll
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 3.5.30729.1
Copyright (c) Microsoft Corporation. All rights reserved.
Version : v4.0.30319
CLR Header: 2.5
PE : PE32
CorFlags : 9
ILONLY : 1
32BIT : 0
Signed : 1
I tried with another .NET library to explore the problem and the same exception has been raised.
1. Solution exception:Could not load file or assembly 'Cudafy.NET, Version=1.29.5576.13786, Culture=neutral, PublicKeyToken=63a4c9931616906b' or one of its dependencies. The system cannot find the file specified.
And this is the the return for the Cudafy.Net libary that shows the same compatibility of the Alea.dll library.
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 3.5.30729.1
Copyright (c) Microsoft Corporation. All rights reserved.
Version : v4.0.30319
CLR Header: 2.5
PE : PE32
CorFlags : 9
ILONLY : 1
32BIT : 0
Signed : 1
I don’t know how interested this community is in running GrassHopepr components on GPU… but I am. So I posted a fairly elaborate description including packadge paths and projects) of my case on Stackoverflow.
Hi @edu_pignatelli, thanks for these hints. I have copied the file, actually all files to Rhino system, and I keep trying with the simplest code possible, like only accessing the default Gpu, but I keep getting similar error message. This time it complains about FSharp.Core which it can’t find. I thought I was working with CSharp though… < scratching head >
Alea GPU is implemented with F#, so it uses the F# runtime. If you use Alea GPU from C# or VB, you also need version 3.1 or higher of FSharp.Core.dll assembly. If you use Visual Studio, you can locate that assembly by navigating to Add Reference -> Assemblies -> Extensions -> FSharp.Core 4.3.1.0. Alternatively, you can add FSharp.Core NuGet package to your project.
Unfortunately I do not have time to try right now, but have tried to add the FSharp.Core via NuGet in Visual Studio?
I got the error message fixed by adding symlinks under Rhino…\system\ down to the VS compile folder, like so:
Which under the VS project looks like so :
But for some reason my Gpu.For(…) code silently doesn’t seem to do anything (it doesn’t modify any input variables). The following method for example runs without errors but it returns only an “empty” point [0,0,0] although the input list has 47.000 points off from the origin .:
I am glad you guys solved the Alea issue that was related to memory-loading the DLLs! That option is there to help load assemblies over networks, and allow reloading sometimes, but I think it really sometimes adds more hurdles rather than helping.
I believe the problem was not related to assembly reflection, but for some unknown reasons, Grasshopper (Rhino?) was not able to access the file from the usual %AppData%\Roaming\Grasshopper\Libraries. I assume that it is due to lack of admin privileges in that folder. The library is correctly loaded if copied in the C:\Program Files\Rhinoceros 5 (64-bit)\System folder, or better, if installed in the GAC.
Did you unblock all files that are in use? If you don’t you very well can see this exception.
Grasshopper simply won’t be able to load DLLs that haven’t been unblocked. Anecdote: earlier today I recorded a video about how to use GhShaderNodes, Cycles XML material and the custom preview component to raytrace GH geometry. During the recording session I noticed GhShaderNodes wasn’t loaded. I just had downloaded and installed them, turned out I still had to unblock all of the files (fsharp dlls included)
Yes, all files unblocked! I use to forget that, but it is usually the first thing you do after you cannot find the library.
I also believe that if it was blocked, it would not have been loaded even if in the Rhino System library.