Cudafy (Mono) - Odroid XU4 Topic is solved

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
pavelKudrna
Posts: 2
Joined: Tue Oct 01, 2019 4:03 pm

Cudafy (Mono) - Odroid XU4

Post by pavelKudrna »

Hi, I am trying to run cudafy example under mono-runtime (x86 compilation):

using System;
using Cudafy;
using Cudafy.Host;
using Cudafy.Translator;

namespace cudafy_test
{
class Program
{
static void Main(string[] args)
{
try
{
CudafyModes.Target = eGPUType.OpenCL;
CudafyTranslator.Language = eLanguage.OpenCL;
CudafyModule km = CudafyTranslator.Cudafy();

string txt;
try
{
txt = CudafyHost.GetDeviceCount(eGPUType.Cuda).ToString();
}
catch
{
txt = "0";
}
Console.WriteLine("Cuda devices: " + txt);
try
{
txt = CudafyHost.GetDeviceCount(eGPUType.OpenCL).ToString();
}
catch
{
txt = "0";
}
Console.WriteLine("OpenCl devices: " + txt);
try
{
txt = CudafyHost.GetDeviceCount(eGPUType.Emulator).ToString();
}
catch
{
txt = "0";
}
Console.WriteLine("Emulations CPU devices: " + txt);

GPGPU gpu = CudafyHost.GetDevice(CudafyModes.Target, CudafyModes.DeviceId);
gpu.LoadModule(km);
gpu.Launch().thekernel();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine("Hello world");
Console.ReadKey();
}

[Cudafy]
public static void thekernel()
{
}
}
}

I even checked all mono dll libraries to be x86 (and they are). But when I run in bash "mono cudafy_test.exe" I got a strange error:

"Unhandled Exception: System.BadImageFormatException: Could not resolve field token 0x04000001 File name: 'cudafy_test'"

Do you anybody have enough experience why is it, is it connected to mono, dietPi, cudafy or what?
pavelKudrna
Posts: 2
Joined: Tue Oct 01, 2019 4:03 pm

Re: Cudafy (Mono) - Odroid XU4

Post by pavelKudrna »

I found the answer (unexpectadly). It should be higher than mono-runtime installation (e.g. mono-devel, mono-complete).
Post Reply