简体   繁体   English

我可以在 C# 中使用 OpenCL 发出 HTTP 请求吗?

[英]Can I make HTTP requests using OpenCL in C#?

Can I make HTTP requests using OpenCL in C#?我可以在 C# 中使用 OpenCL 发出 HTTP 请求吗? I tryed to do this calling system("curl website.com") but only getting an error about system implicit calling.我尝试执行此调用system("curl website.com")但只收到有关system隐式调用的错误。

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. OpenCL kernel C/C++ 语言不支持标准 C 库 - 该库被一组自定义的标准函数取代,面向数学编程。

The list of functions, which can be used in the kernel language, can be found here .可在 kernel 语言中使用的函数列表可在此处找到。

As others have said, no, it's not possible to do I/O in OpenCL kernels.正如其他人所说,不,不可能在 OpenCL 内核中执行 I/O。

Moreover though, it makes no sense to do so;而且,这样做是没有意义的; OpenCL is specialised on computationally-intensive massively parallel data processing. OpenCL 专门用于计算密集型大规模并行数据处理。 Waiting for I/O to complete would entirely defeat the point of it.等待 I/O 完成将完全违背它的意义。 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?)在主机环境中收集和准备您的数据(常规的基于 CPU 的编程环境;在您的情况下听起来像 C#,尽管还不完全清楚?)
  2. Create OpenCL buffers and fill them with the data创建 OpenCL 缓冲区并用数据填充它们
  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, eg writing to disk,.network, or display on the host.结果的进一步处理,例如写入磁盘、网络或在主机上显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM