2015-01-23 03:38:24 +03:00
|
|
|
#ifndef CUDA_H
|
|
|
|
#define CUDA_H
|
|
|
|
|
2015-01-31 09:05:23 +03:00
|
|
|
extern int gpu_index;
|
|
|
|
|
|
|
|
#ifdef GPU
|
|
|
|
|
2015-08-11 09:22:27 +03:00
|
|
|
#define BLOCK 512
|
2015-01-23 03:38:24 +03:00
|
|
|
|
|
|
|
#include "cuda_runtime.h"
|
2015-03-21 22:25:14 +03:00
|
|
|
#include "curand.h"
|
2015-01-23 03:38:24 +03:00
|
|
|
#include "cublas_v2.h"
|
|
|
|
|
2016-05-13 21:59:43 +03:00
|
|
|
#ifdef CUDNN
|
|
|
|
#include "cudnn.h"
|
|
|
|
#endif
|
|
|
|
|
2015-01-23 03:38:24 +03:00
|
|
|
void check_error(cudaError_t status);
|
|
|
|
cublasHandle_t blas_handle();
|
2016-05-13 21:59:43 +03:00
|
|
|
float *cuda_make_array(float *x, size_t n);
|
2017-05-29 21:59:27 +03:00
|
|
|
int *cuda_make_int_array(int *x, size_t n);
|
2016-05-13 21:59:43 +03:00
|
|
|
void cuda_push_array(float *x_gpu, float *x, size_t n);
|
|
|
|
void cuda_pull_array(float *x_gpu, float *x, size_t n);
|
2016-09-12 23:55:20 +03:00
|
|
|
void cuda_set_device(int n);
|
2015-01-23 03:38:24 +03:00
|
|
|
void cuda_free(float *x_gpu);
|
2016-05-13 21:59:43 +03:00
|
|
|
void cuda_random(float *x_gpu, size_t n);
|
|
|
|
float cuda_compare(float *x_gpu, float *x, size_t n, char *s);
|
2015-01-23 03:38:24 +03:00
|
|
|
dim3 cuda_gridsize(size_t n);
|
2017-03-27 09:42:30 +03:00
|
|
|
float cuda_mag_array(float *x_gpu, size_t n);
|
2015-01-23 03:38:24 +03:00
|
|
|
|
2016-05-13 21:59:43 +03:00
|
|
|
#ifdef CUDNN
|
|
|
|
cudnnHandle_t cudnn_handle();
|
|
|
|
#endif
|
|
|
|
|
2015-01-23 03:38:24 +03:00
|
|
|
#endif
|
2015-01-31 09:05:23 +03:00
|
|
|
#endif
|