Feature request - enable cuda if detected

Is there any inherent reason that the cuda flag is not enabled by default if CUDA is present in the system?

I was looking at this file - https://github.com/root-project/root/blob/7d7b70500e1413094a01ce7c7b795ef58cd51529/cmake/modules/SearchInstalledSoftware.cmake and it seems like the cuda flag is relevant only when the tmva and the tmva-gpu flags are enabled.
If that is the case, would it make sense for the cuda flag to be removed and check for CUDA in the system when just the tmva and the tmva-gpu flags are enabled?


In summary: No, I don’t think so and I am in favour of not requiring two flags to make tmva compile with gpu support.

Indeed, the current defaults are cuda=OFF and tmva-gpu=ON. However, the DL library is enabled iff tmva-gpu and cude holds true. Currently the only user of cuda, to my knowledge, is the tmva dl-library.

In this context, it could make sense to remove the cuda flag completely. We should at least make tmva-gpu imply cuda as currently it is absolutely required.

One reason to have the separation of the tmva-gpu and cuda flags is that if there were several backends available, the user should be able to choose their preference. However, also in this case there should be a reasonable default.


Related pull request - https://github.com/root-project/root/pull/3438

We need to discuss with @moneta to decide what to do. In principle, we shouldn’t have duplication of flags for similar functionality. On the other hand, if we remove the cuda flag, we may have to add it back later when something else (e.g. fitting) supports CUDA in ROOT. That said, it seems tmva-gpu and cuda interact in a strange way and we need to sort that out indeed.


I agree with @amadio. I thin kit is better to keep the cuda flag in case other parts of ROOT will support Cuda in the future. Also TMVA-GPU it is good to have it because in principle you could have cuda for some other parts of ROOT and TMVA-CPU for others.

I think the flags work fine, if something does not work as expected we should fix.
If CUDA is enable I think by default also TMVA-GPU is enabled
The opposite it is not true (i.e if TMVA-GPU is set to ON it will not be set if CUDA=Off). Maybe this could be changed