style(C): fix warnings and use C++ includes

This commit is contained in:
xeals 2019-06-23 23:38:30 +10:00
parent 26003ed956
commit 18d1fdfa11

View File

@ -1,6 +1,5 @@
#include <stdlib.h> #include <cstdlib>
#include <stdio.h> #include <cstdio>
#include "kernel.cu"
#define CUDA_ERRCHK(fn) { __gpucheck((fn), __FILE__, __LINE__); } #define CUDA_ERRCHK(fn) { __gpucheck((fn), __FILE__, __LINE__); }
@ -23,7 +22,7 @@ void mulAll_kernel(int *out, int *in, int n, size_t size) {
extern "C" { extern "C" {
void mulAll(int *out, const int *input, int n, size_t size) { void mulAll(int *out, const int *input, int n, size_t size) {
int *out_d, *in_d, i_d, size_d; int *out_d, *in_d;
CUDA_ERRCHK(cudaMalloc((void **) &in_d, sizeof(int) * size)); CUDA_ERRCHK(cudaMalloc((void **) &in_d, sizeof(int) * size));
CUDA_ERRCHK(cudaMemcpy(in_d, input, sizeof(int) * size, cudaMemcpyHostToDevice)); CUDA_ERRCHK(cudaMemcpy(in_d, input, sizeof(int) * size, cudaMemcpyHostToDevice));