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.
CodePudding user response:
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.
CodePudding user response:
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:
- 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?)
- Create OpenCL buffers and fill them with the data
- Perform computation in kernels
- Put results in buffers
- Read back results from the buffers on the host.
- Further processing of results, e.g. writing to disk, network, or display on the host.