I have a CUDA code which I have compiled and have the executable of it. Now I want to call this executable from a R script and pass it arguments also from the R script itself? Is it possible? If yes, please explain how?
To call any external executables you can use the system function:
system("cuda_exe arg1 arg2")
where cuda_exe is the cuda executable, and arg* are the command line arguments passed to the script.
A more cross-platform alternative than system is system2. It'll work on Windows and other systems without a /bin/sh.
system2("cuda_exe", c("arg1", "arg2"))
It requires no shell, but shell syntax like the * glob won't work, and you'll have to learn the R way of doing things, such as list.files(pattern = ".*.csv") instead of just "*.csv". The upside is that you won't have to fiddle with paste() to construct the command line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With