A
A
askeet2014-01-27 16:32:18
C++ / C#
askeet, 2014-01-27 16:32:18

Implementation of dynamic expressions in C#. Library for working with OpenCL Cudafy.NET?

In general, my question is from the category, but how does it work? In particular, the Cudafy library ( http://cudafy.codeplex.com)
For example, in the example below, the static function method thekernel() of the simple_kernel class from another gpu class is called.
To be honest, I would never have thought it was possible.
I read the article from
msdn.microsoft.com/en-us/library/dd264736.aspx the only thing that dynamic linking understood is that it avoids errors at compile time, but not at runtime.
So there are still more questions than answers.

/* 
 * This software is based upon the book CUDA By Example by Sanders and Kandrot
 * and source code provided by NVIDIA Corporation.
 * It is a good idea to read the book while studying the examples!
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cudafy;
using Cudafy.Host;
using Cudafy.Translator;
namespace CudafyByExample
{

    public class simple_kernel
    {
        public static void Execute()
        {
            CudafyModule km = CudafyTranslator.Cudafy(eArchitecture.OpenCL);

            GPGPU gpu = CudafyHost.GetDevice(CudafyModes.Target, CudafyModes.DeviceId);
            gpu.LoadModule(km);
            gpu.Launch().thekernel(); // or gpu.Launch(1, 1, "kernel"); 
            Console.WriteLine("Hello, World!");
        }

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

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
askeet, 2014-01-27
@askeet

An interesting article, live a century, as they say, learn a century. As I understand gpu.Launch() return dinamyc.

D
Dmitry Guketlev, 2014-01-27
@Yavanosta

Look habrahabr.ru/post/96988

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question