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.
Asked
Active
Viewed 91 times
0

Anna Boyko
- 25
- 5
-
1As always, rather than just saying you're getting "an error" please show the precise code, and the precise error message. (There's no built-in `system` method in C#... you'd normally launch a process using the `System.Diagnostics.Process` class...) – Jon Skeet Mar 28 '22 at 10:44
-
1Although the normal way to make HTTP requests in C# is to use HttpClient... I'm not sure why you want to use curl here. – Jon Skeet Mar 28 '22 at 10:45
-
OpenCl uses C language, so I need to write code for kernel string in C. – Anna Boyko Mar 28 '22 at 14:34
-
So why is C# mentioned in both your title and tag? Currently it's very unclear to me what you're trying to do, or what's happening. – Jon Skeet Mar 28 '22 at 15:25
2 Answers
0
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.

pmdj
- 22,018
- 3
- 52
- 103