简体   繁体   English

将C ++库链接到html前端

[英]Link C++ library to html front end

I do computational research with a C++/CUDA library that does intensive number crunching. 我使用进行大量数字运算的C ++ / CUDA库进行计算研究。 Recently I was thinking to set up a little showcase of my library on my webpage where people could work interactively with the library and see the results (plots, animations, etc.) in real time. 最近,我正在考虑在我的网页上建立一个关于图书馆的小展示柜,以便人们可以与图书馆进行交互工作,并实时查看结果(图形,动画等)。

I have very limited html and website creating expertise. 我在HTML和网站创建方面的专业知识非常有限。 Are there libraries out there to link the html front-end to the C++/CUDA back-end? 是否有库将html前端链接到C ++ / CUDA后端? I'm developing in Linux environment but obviously I'd like my webpage to be accessed by anyone independent of their OS and/or browser. 我正在Linux环境中进行开发,但显然我希望任何独立于其操作系统和/或浏览器的人都可以访问我的网页。

So after a little bit of research I found the Wt library which is written in C++ and used for webpage development. 因此,经过一番研究,我发现了Wt库,该库是用C ++编写的,用于网页开发。 Based on the information on their homepage, it seems to be exactly what I'm looking for: 根据他们主页上的信息,这似乎正是我要的内容:

Typical use scenarios: 典型的使用场景:

  • High performance, complex web applications which are fully personalized (and thus cannot benefit from caching), fully Ajax enabled and at the same time entirely accessible and Search Engine Optimized. 完全个性化的高性能,复杂的Web应用程序(因此无法从缓存中受益),完全启用Ajax,同时完全可访问且经过搜索引擎优化。

  • Web-based GUIs for embedded systems benefit from the low footprint of a C++ web application server. 嵌入式系统的基于Web的GUI受益于C ++ Web应用程序服务器的低占用空间。

  • Web-based GUIs that require integration with (existing) C++ libraries, for example for scientific or engineering applications, or existing C++ desktop applications 需要与(现有)C ++库集成的基于Web的GUI,例如用于科学或工程应用程序或现有C ++桌面应用程序

I did something like this. 我做了这样的事情。 To do this, I used a simple library I wrote called jrb_node at https://github.com/kennethho/jrb_node 为此,我在https://github.com/kennethho/jrb_node使用了一个名为jrb_node的简单库

There are other libraries like cppnetlib http://cpp-netlib.org/ 还有其他库,例如cppnetlib http://cpp-netlib.org/

Basically you make a small http server that based on the request will perform some computation and return the results as an http response. 基本上,您将创建一个小型的http服务器,该服务器将基于请求执行一些计算并将结果作为http响应返回。 You can then combine that with javascript and Ajax if you want to make it more interactive. 然后,如果您想使其更具交互性,可以将其与javascript和Ajax结合使用。

An alternative to consider is to use WebCL . 还可以考虑使用WebCL CUDA is pretty similar to OpenCL and it should be pretty easy to convert your code to the latter. CUDA与OpenCL非常相似,将代码转换为OpenCL应该很容易。 If you have other C++ code, that might be a bit of problem though. 如果您还有其他C ++代码,则可能会有点问题。

Do you want to run CUDA on server (eg the users will input the parameters, push a button and your server will do number crunching) or on client (eg it will be user GPU that does computations)? 您要在服务器上运行CUDA(例如,用户将输入参数,按一个按钮,服务器将对数字进行运算)还是在客户端上运行(例如,将由用户GPU进行计算)?

For server-side you should be able to use pretty much any server technology - PHP, JSP, etc. They all provide a way to integrate to "native code". 对于服务器端,您应该几乎可以使用任何服务器技术-PHP,JSP等。它们都提供了一种集成到“本地代码”的方法。 For client-side you will not be able to do with just HTML - you need to use some "fat client" technology - eg ActiveX, Java applet. 对于客户端,您将无法仅使用HTML-您需要使用某些“胖客户端”技术-例如ActiveX,Java applet。 I do not know if Silverlight or Flash have access to native code. 我不知道Silverlight或Flash是否可以访问本机代码。 IMHO, you might as well just write a Qt application and put a download link on your site. 恕我直言,您最好编写一个Qt应用程序,然后在您的站点上放置一个下载链接。

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

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