Can I make HTTP requests using OpenCL in C#?

124 Views Asked by At

Can I make HTTP requests using OpenCL in C#? I tryed to do this calling system("curl website.com") but only getting an error about system implicit calling.

2

There are 2 best solutions below

0
On BEST ANSWER

No, you can't. The OpenCL kernel C/C++ language doesn't support the standard C library - this library is replaced by a custom set of standard functions, geared toward math programming.

The list of functions, which can be used in the kernel language, can be found here.

0
On

As others have said, no, it's not possible to do I/O in OpenCL kernels.

Moreover though, it makes no sense to do so; OpenCL is specialised on computationally-intensive massively parallel data processing. Waiting for I/O to complete would entirely defeat the point of it. The usual pattern is:

  1. Collect and prepare your data in the host environment (regular CPU based programming environment; sounds like C# in your case although that's not entirely clear?)
  2. Create OpenCL buffers and fill them with the data
  3. Perform computation in kernels
  4. Put results in buffers
  5. Read back results from the buffers on the host.
  6. Further processing of results, e.g. writing to disk, network, or display on the host.