arrayfire / forge

High Performance Visualization
222 stars 48 forks source link

Forge could not work with std::thread. #151

Closed BookmanHan closed 6 years ago

BookmanHan commented 6 years ago

Forge could not work with std::thread. It came up with Unknown Error (9003).

Codes are Here:

af::Window w;
thread t([](){do{w.show();}while(!w.close());};
t.join();

Could there be a solution?

9prady9 commented 6 years ago

@BookmanHan Forge is not ready for threaded programs as of current release. We have some code that is written to handle the case scattered across the code base, but it hasn't been tested thoroughly and we don't claim Forge can be used in threaded programs as of now.

Having said that, I believe most applications don't push rendering calls to sub-processes/threads, although I can image some use cases where I see this being used - render to texture on server in a headless environment.

So, usually all the rendering happens on main thread and the computations takes place on the threads and results are queued up for rendering on main thread.

BookmanHan commented 6 years ago

Thanks a lot for explaining the reason.

Actually, I am using ArrayFire in the Linux server. I login in the server with a terminal from my notebook. I want to run my codes in the server then visualize the results in my notebook.

I tried the ssh -X, which doesn't work. I tried the VNC, which leads to the same result.

Finally, I am getting up to transfer the array from server to notebook within the network. So there is the issue, because I apply two threads: Forge and Network.

I am reconsidering the VNC solution, which failed because something wrong happens to the OpenGL driver. So the next step is to setup the driver.

Thanks a lot for ArrayFire, which is a really amazing library. Thanks a lot for explaining my issue.

codeants2012 commented 6 years ago

@BookmanHan Do you have a Test program about Fast-TransX, I want to test quikly because of Limited hardware resources. Thank you very much!