-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support CPU/GPU from the same binary? #203
Comments
This is not easy to do. The reason is that the binary to run on CPUs is compiled with One possible way to use one binary for both CPU and GPU is to implement ThunderSVM with OpenCL. |
Thanks for the quick reply @zeyiwen ! I'm not sure I fully understand. Currently I can build thundersvm twice, once for CPU and once for GPU. Then I get two libraries that I can both link into the same executable. If their methods would be distinguishable (for example with separate namespaces) I could use them concurrently, no? That is what I'm aiming at. Maybe there could be another, higher abstraction like |
Your machine has the environment to run both versions of ThunderSVM. Some users don't have GPUs or the CUDA environment installed, where the CUDA code of ThunderSVM can't be compiled. Our current implementation is to disable the CUDA code when compiling the binary for CPUs, and to disable some C++ code when compiling the binary for GPUs. There could be a solution for users who have GPUs (like your case), where both the CPU version and GPU version are compiled and combined as one binary. However, one concern I have in this scenario is that, if users have GPUs, they would probably use GPUs. So having a CPU version for those users may not be too compelling. |
Dear @zeyiwen I see that my question was not very clear! Sorry for that. I did not mean that all users would need to have CUDA. I only mean that the decision between CUDA and CPU could be a runtime choice. Of course users without CUDA will only have the choice between CPU and CPU :-) But users with CUDA will be able to switch back and forth. What is my motivation? The motivation is that CUDA is not as portable as the CPU mode. I would love to have a portable Also, think about thundersvm included in Linux distributions. They probably would not want to recompile for each user specifically. It would be much more portable to have a single binary with multiple runtime options. |
Thanks @emmenlau I got your idea. This is doable. Let me label this issue as an enhancement of ThunderSVM. We will keep this in mind in the future upgrade. |
Its really just an idea, but I hope it can help make thundersvm even more broadly applicable. |
I guess this can be closed now. |
It would be really awesome if the backend (CPU/GPU) could be selected at runtime. I think that is currently not possible? Could this be added?
The text was updated successfully, but these errors were encountered: