Quantcast
Channel: Intel® Many Integrated Core Architecture
Viewing all articles
Browse latest Browse all 1347

Struggling to create dynamic library (interop C# - C++ -> MIC)

$
0
0

Hello everyone,

I'm working on a project C# and I want to aim a MIC within a computation kernel. Here's the scheme of my project:

C# main project

--> sending data to C++/CLI

C++/CLI project (bridge between C++ and C#)

--> executing C++ kernel (aiming the MIC - offload mod)

C++ (project offload mod)

Unfortunatly, this isn't working. So I procceed another way because I think there's some problem between Intel compiler and Visual compiler. I tried a second way:

With the C++ code containing offload directives, I build a static library with Intel compiler. (I can't create a dynamic library with offload directive, I don't know why maybe someone could explain me. Here's the error I got:

k1om-mpss-linux-ld.exe: C:\..\AppData\Local\Temp\918833MIC16.o: relocation R_X86_64_32S against `.data' can not be used when making a shared object; recompile with -fPIC

C:\..\AppData\Local\Temp\918833MIC16.o: could not read symbols: Bad value

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\x64\PlatformToolsets\Intel C++ Compiler XE 15.0\Microsoft.Cpp.x64.Intel C++ Compiler XE 15.0.targets(1028,5): error MSB6006: "xilink.exe" exited with code 1.

)

So I thought I found a little a trick so I create a second project which contains just a wrapper for the kernel that I want to execute from the previous library made;

I compile this with the Visual compiler and I build a static library, this time this is working.

Now I try to import this DLL on a C# project, this is still OK but when I execute the program I got the following message error:

offload error: target executable is not available

I tried to set the environment variable "OFFLOAD_REPORT" to "3" through CMD and through the C# directly and C++ kernel but this doesn't work. I can't have more messages. 

This is probably due to the Visual Compiler and to its environment but it seems that I'm far capable to solve this problem.alone!

Thanks in advance.

 

GS

 


Viewing all articles
Browse latest Browse all 1347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>