05-27-2022 06:20 AM
Hello!
I have a large array of elements. I need to calculate the cosine of each element of this array. How can I do this using CUDA?
Thank you
05-27-2022 08:52 AM
@nakom wrote:
Hello!
I have a large array of elements. I need to calculate the cosine of each element of this array. How can I do this using CUDA?
Thank you
Are you expecting to post a question and expect someone to do the work for you?
I don't understand attitude like yours.
05-27-2022 09:02 AM
Hi nakom,
@nakom wrote:
I have a large array of elements. I need to calculate the cosine of each element of this array. How can I do this
using CUDA?
Apply the Cosine function on your "large array", it is polymorphic…
Why do you want to use CUDA?
Why is the thread title about "sine", but the message about "cosine"?
05-27-2022 10:04 AM - edited 05-27-2022 10:07 AM
CUDA sounds nice in theory for something like that. In practice it is useless. To perform the operation as graphics accelerated function the "large" array has to be transported to the graphics card over the PCI bus, the CUDA processors need to process it and then the data needs to be transferred back to the main memory. These two transfers back and forth easily can make and to dominate the time needed and will destroy any performance gain you could get from the CUDA accelerated operation.
CUDA only makes sense if you can download data to the card and do a lot of massive calculations on them before they need to be transferred back. Otherwise the bus transfer times are the dominant part of the processing and even your "super accelerated" graphics operation is not able to make up for that time.
And once you venture into such highly customized graphics processing algorithmes you end up writing C code for the CUDA compiler, and that is even more complicated than normal C code on the host system.