33 lines
970 B
Plaintext
33 lines
970 B
Plaintext
|
#include <cstdio>
|
||
|
|
||
|
#define CHECK_CUDA(call) \
|
||
|
do { \
|
||
|
cudaError_t status_ = call; \
|
||
|
if (status_ != cudaSuccess) { \
|
||
|
fprintf(stderr, "CUDA error (%s:%d): %s:%s\n", __FILE__, __LINE__, \
|
||
|
cudaGetErrorName(status_), cudaGetErrorString(status_)); \
|
||
|
exit(EXIT_FAILURE); \
|
||
|
} \
|
||
|
} while (0)
|
||
|
|
||
|
__global__ void pythagoras(int *pa, int *pb, int *pc, int *pd) {
|
||
|
int a = *pa;
|
||
|
int b = *pb;
|
||
|
int c = *pc;
|
||
|
|
||
|
if ((a * a + b * b) == c * c)
|
||
|
*pd = 1;
|
||
|
else
|
||
|
*pd = 0;
|
||
|
}
|
||
|
|
||
|
int main(int argc, char *argv[]) {
|
||
|
if (argc != 4) {
|
||
|
printf("Usage: %s <num 1> <num 2> <num 3>\n", argv[0]);
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
// TODO
|
||
|
return 0;
|
||
|
}
|