00001
00002 #ifndef eman__cuda_util_h__
00003 #define eman__cuda_util_h__ 1
00004
00005
00006 const char* const cudalockfile="/tmp/cuda";
00007
00008
00012 int device_init();
00013 int getCudaDeviceManually(const int deviceCount);
00014 int getCudaDeviceAuto(const int deviceCount);
00015
00018 struct EMDataForCuda {
00019 float * data;
00020 int nx;
00021 int ny;
00022 int nz;
00023 };
00024
00025 struct CudaPeakInfo {
00026 int px;
00027 int py;
00028 int pz;
00029 float peak;
00030 };
00031
00032 struct CudaPeakInfoFloat {
00033 float xintp;
00034 float yintp;
00035 float zintp;
00036 float peak;
00037 };
00038
00039 bool copy_to_array(const float * data, cudaArray * array, const int nx, const int ny, const int n, const cudaMemcpyKind memkindz);
00040
00041
00042
00043
00044
00045 cudaArray* get_cuda_array(const int nx, const int ny, const int nz);
00046
00047 void bind_cuda_array_to_textureA( const cudaArray* const array, const int ndims, const bool interp_mode);
00048
00049 void unbind_cuda_textureA(const int ndims);
00050
00051 void bind_cuda_array_to_textureB( const cudaArray* const array, const int ndims, const bool interp_mode);
00052
00053 void unbind_cuda_textureB(const int ndims);
00054
00055 float get_edgemean_cuda(const float* data, const int nx, const int ny, const int nz);
00056
00057 void to_value_cuda(float* data, const float value, const int nx, const int ny, const int nz);
00058
00059 void to_zero_cuda(float* data, const int nx, const int ny, const int nz);
00060
00061 #endif // eman__cuda_util_h__
00062
00063
00064
00065