Converting C # Methods to C ++ Methods

I’m exploring various options for mapping common C # code constructs with C ++ CUDA code to work on the GPU. The structure of the system is as follows (arrows represent method calls):

C # program → C # GPU lib → C ++ CUDA implementation of lib

A method in the GPU library might look something like this:

public static void Map<T>(this ICollection<T> c, Func<T,T> f)
{
   //Call 'f' on each element of 'c'
}

This is an extension method for ICollection <> types that run a function for each element. However, what I would like to do is call the C ++ library and make it run the methods on the GPU. This will require that the function be somehow translated into C ++ code. Is it possible?

To develop, if a user of my library executes a method (in C #) with some arbitrary code in it, I would like to translate this code into the C ++ equivalent so that I can run it on CUDA. I have the feeling that there is no easy way to do this, but I would like to know if there is a way to do this or achieve the same effect.

One thing that I was curious about was grabbing a function for translating in an expression and using it to match with the C ++ equivalent. Does anyone have any experience?

+3
source share
6 answers

There is CUDA.Net , if you need some kind of link, how C # can be run on the GPU.

+7
source

, , , . , .Net-/ ++ - .NET. http://www.codeplex.com/crossnet

+2

CUDA #:

  • ++, P/Invoke , . , CUDA.
  • #. , . , , , .
  • ++ ( ) CUDA.
+1

. #, , ICollection - . c , , , , float, CUDA . , , - gpu.

0

, IQueryable LINQ, LINQ to SQL LINQ SQL.

, , , LINQ . , , , .

, Googles API MapReduce # CUDA, , PyCuda, GPU. MapReduce CUDA.

0

, , .

, , , - . LINQ, GLSL . , , Game of Life.

0

Source: https://habr.com/ru/post/1698210/


All Articles