V
V
Vasily Stolbovskiy2021-03-14 00:10:05
GPGPU
Vasily Stolbovskiy, 2021-03-14 00:10:05

How to interpret code for CUDA?

Hello.
The problem is this: you need code (for example, calculating prime factors) for execution on the CPU (preferably c ++) and for execution on CUDA cores (it is also desirable that it be compiled in visual).
I'm mostly a sucker at this, but I found a simple code for calculating prime factors on the CPU (from Schildt's tutorial).
Here it is:

#include
#include
using namespace std;
int main()
{
int i, j;
for (i = 2; i < 1000; i++){
for (j = 2; j <= (i / j); j++){
if (!(i % j)) break;
if (j > (i / j)) cout << i << " - simple number\n";
}
_getch();
return 0;
}

It is necessary to parallelize for CUDA and, since I indicated that I do not understand anything about this, I ask for help.
PS: if you have code for CPU and CUDA for another simple task, please send it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananiev, 2021-03-14
@SaNNy32

https://developer.nvidia.com/blog/even-easier-intr...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question