You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
411 B
Common Lisp

__kernel void check_prime(__global int *IN, __global bool *OUT) {
int id = get_global_id(0);
int num = IN[id];
bool prime = true;
if (num < 3 || num % 2 == 0) {
prime = false;
} else {
for (int i = 3; i <= sqrt((float) num); i += 2) {
if (num % i == 0) {
prime = false;
break;
}
}
}
OUT[id] = prime;
}