1
votes

So I downloaded and installed Microsoft Accelerator v2 to use ParallelArrays. I have referenced it in my project but when I try and execute the code from the module in a script file I get:

"The namespace 'ParallelArrays' is not defined

I have followed the instructions on this post:

Microsoft Accelerator library with Visual Studio F#

I've added a reference to the managed version "Microsoft.Accelerator.dll" to my F# project and then added the native "Accelerator.dll" as an item in my solution and set it's 'Copy To Output Directory' to Copy Always.

Still getting the FSI error and inline error in my script file on the '#load ...' line, however the solution builds fine, and no error in the module file.

Any ideas on what I'm missing? I'm sure it's something stupid.

Thanks, Justin

UPDATE

I tried mydogisbox's advice, which got rid of the error above, but now when I run the code in the .fsx file I get this error instead:

--> Referenced 'F:\Work\GitHub\qf-sharp\qf-sharp\bin\Debug\Microsoft.Accelerator.dll'    (file may be locked by F# Interactive process)

[Loading F:\Work\GitHub\qf-sharp\qf-sharp\MonteCarloGPU.fs]


error FS0192: internal error: F:\Work\GitHub\qf-sharp\qf-sharp\Accelerator.dll: bad cli header, rva 0

UPDATE 2

So the bad header error has dissapeared, but now I get this instead:

Microsoft.ParallelArrays.AcceleratorException: Failure to create a DirectX 9 device.
   at Microsoft.ParallelArrays.ParallelArrays.ThrowNativeAcceleratorException()
   at Microsoft.ParallelArrays.DX9Target..ctor()
   at <StartupCode$FSI_0002>.$FSI_0002_MonteCarloGPU.main@() in F:\Work\GitHub\qf-    sharp\qf-sharp\MonteCarloGPU.fs:line 14
Stopped due to error

I found this thread on MSDN however the answers proposed as fixes on that thread barely even relate to the question.

http://social.msdn.microsoft.com/Forums/vstudio/en-US/98600646-0345-4f62-a6c5-f03ac9c77179/ms-accelerator?forum=csharpgeneral

My Direct X version is 11, and I imagine that will suffice, however I tried installing DX9 however, it tells me that a newer version is detected therefore cant install.

1

1 Answers

2
votes

There are special directives for referencing dlls from fsi. The #load directive loads the .fs file only. You need to use the #r directive to reference the file. You can either use the full path of the file or you can use #I to include the path to the file. More details here. Keep in mind that fsi is completely independent of your project, so all references in your project must be duplicated in fsi for it to access the same types.