#include <stdio.h>
#include <complex>
Go to the source code of this file.
|
void | mycufftDestroy (void *ptr) |
|
void | myStreamDestroy (void *ptr) |
|
void | myStreamCreate (myStreamHandle &myStream) |
|
void | gpuMalloc (void **d_data, size_t Nbytes) |
|
void | gpuFree (void *d_data) |
|
void | cpuMalloc (void **h_data, size_t Nbytes) |
|
void | cpuFree (void *h_data) |
|
void | initializeIdentity (float *d_data, float *h_data, int Ndim, myStreamHandle &myStream) |
|
void | setTranslationMatrix (float *d_data, float *posX, float *posY, int Ndim, myStreamHandle &myStream) |
|
void | setRotationMatrix (float *d_data, float *ang, int Ndim, myStreamHandle &myStream) |
|
void | gpuCopyFromGPUToGPUStream (void *d_dataFrom, void *d_dataTo, size_t Nbytes, myStreamHandle &myStream) |
|
void | gpuCopyFromCPUToGPUStream (void *data, void *d_data, size_t Nbytes, myStreamHandle &myStream) |
|
void | gpuCopyFromGPUToCPUStream (void *d_data, void *data, size_t Nbytes, myStreamHandle &myStream) |
|
void | gpuCopyFromGPUToGPU (void *d_dataFrom, void *d_dataTo, size_t Nbytes) |
|
void | gpuCopyFromCPUToGPU (void *data, void *d_data, size_t Nbytes) |
|
void | gpuCopyFromGPUToCPU (void *d_data, void *data, size_t Nbytes) |
|
int | gridFromBlock (int tasks, int Nthreads) |
|
template<typename T > |
T * | loadToGPU (const T *data, size_t items) |
|
void | cuda_check_gpu_memory (float *data) |
|
void | cuda_check_gpu_properties (int *maxGridSize) |
|
◆ cpuFree()
void cpuFree |
( |
void * |
h_data | ) |
|
◆ cpuMalloc()
void cpuMalloc |
( |
void ** |
h_data, |
|
|
size_t |
Nbytes |
|
) |
| |
◆ gpuCopyFromCPUToGPU()
void gpuCopyFromCPUToGPU |
( |
void * |
data, |
|
|
void * |
d_data, |
|
|
size_t |
Nbytes |
|
) |
| |
◆ gpuCopyFromCPUToGPUStream()
void gpuCopyFromCPUToGPUStream |
( |
void * |
data, |
|
|
void * |
d_data, |
|
|
size_t |
Nbytes, |
|
|
myStreamHandle & |
myStream |
|
) |
| |
Definition at line 293 of file cuda_xmipp_utils.cpp.
295 cudaStream_t *stream = (cudaStream_t*) myStream.
ptr;
296 gpuErrchk(cudaMemcpyAsync(d_data, data, Nbytes, cudaMemcpyHostToDevice, *stream));
◆ gpuCopyFromGPUToCPU()
void gpuCopyFromGPUToCPU |
( |
void * |
d_data, |
|
|
void * |
data, |
|
|
size_t |
Nbytes |
|
) |
| |
◆ gpuCopyFromGPUToCPUStream()
void gpuCopyFromGPUToCPUStream |
( |
void * |
d_data, |
|
|
void * |
data, |
|
|
size_t |
Nbytes, |
|
|
myStreamHandle & |
myStream |
|
) |
| |
Definition at line 301 of file cuda_xmipp_utils.cpp.
303 cudaStream_t *stream = (cudaStream_t*) myStream.
ptr;
304 gpuErrchk(cudaMemcpyAsync(data, d_data, Nbytes, cudaMemcpyDeviceToHost, *stream));
306 gpuErrchk(cudaStreamSynchronize(*stream));
◆ gpuCopyFromGPUToGPU()
void gpuCopyFromGPUToGPU |
( |
void * |
d_dataFrom, |
|
|
void * |
d_dataTo, |
|
|
size_t |
Nbytes |
|
) |
| |
◆ gpuCopyFromGPUToGPUStream()
void gpuCopyFromGPUToGPUStream |
( |
void * |
d_dataFrom, |
|
|
void * |
d_dataTo, |
|
|
size_t |
Nbytes, |
|
|
myStreamHandle & |
myStream |
|
) |
| |
Definition at line 310 of file cuda_xmipp_utils.cpp.
312 cudaStream_t *stream = (cudaStream_t*) myStream.
ptr;
313 gpuErrchk(cudaMemcpyAsync(d_dataTo, d_dataFrom, Nbytes, cudaMemcpyDeviceToDevice, *stream));
◆ gpuFree()
void gpuFree |
( |
void * |
d_data | ) |
|
◆ gpuMalloc()
void gpuMalloc |
( |
void ** |
d_data, |
|
|
size_t |
Nbytes |
|
) |
| |
◆ gridFromBlock()
int gridFromBlock |
( |
int |
tasks, |
|
|
int |
Nthreads |
|
) |
| |
◆ initializeIdentity()
void initializeIdentity |
( |
float * |
d_data, |
|
|
float * |
h_data, |
|
|
int |
Ndim, |
|
|
myStreamHandle & |
myStream |
|
) |
| |
Definition at line 216 of file cuda_xmipp_utils.cpp.
219 for(
int i=0;
i<Ndim;
i++){
220 float aux_matrix[9] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0};
222 for (
int j=0;
j<9;
j++)
223 h_data[offset+
j] = aux_matrix[
j];
225 cudaStream_t *stream = (cudaStream_t*) myStream.
ptr;
226 gpuErrchk(cudaMemcpyAsync((
void*)d_data, h_data, Ndim*9*
sizeof(
float), cudaMemcpyHostToDevice, *stream));
◆ mycufftDestroy()
void mycufftDestroy |
( |
void * |
ptr | ) |
|
◆ myStreamCreate()
Definition at line 63 of file cuda_xmipp_utils.cpp.
65 cudaStream_t *streamPtr =
new cudaStream_t;
67 myStream.
ptr = (
void*)streamPtr;
◆ myStreamDestroy()
void myStreamDestroy |
( |
void * |
ptr | ) |
|
Definition at line 57 of file cuda_xmipp_utils.cpp.
59 cudaStream_t *streamPtr = (cudaStream_t *)ptr;
60 cudaStreamDestroy(*streamPtr);
◆ setRotationMatrix()
void setRotationMatrix |
( |
float * |
d_data, |
|
|
float * |
ang, |
|
|
int |
Ndim, |
|
|
myStreamHandle & |
myStream |
|
) |
| |
Definition at line 260 of file cuda_xmipp_utils.cpp.
264 gpuErrchk(cudaMallocHost((
void**)&rad_vector,
sizeof(
float)*Ndim*9));
266 for(
int i=0;
i<Ndim;
i++){
267 float rad = (float)(-ang[
i]*M_PI/180);
268 float matrix[9] = {cosf(rad), -sinf(rad), 0, sinf(rad), cosf(rad), 0, 0, 0, 1};
270 for (
int j=0;
j<9;
j++)
271 rad_vector[offset+
j] = matrix[
j];
273 cudaStream_t *stream = (cudaStream_t*) myStream.
ptr;
274 gpuErrchk(cudaMemcpyAsync((
void*)d_data, rad_vector, Ndim*9*
sizeof(
float), cudaMemcpyHostToDevice, *stream));
◆ setTranslationMatrix()
void setTranslationMatrix |
( |
float * |
d_data, |
|
|
float * |
posX, |
|
|
float * |
posY, |
|
|
int |
Ndim, |
|
|
myStreamHandle & |
myStream |
|
) |
| |
Definition at line 237 of file cuda_xmipp_utils.cpp.
240 gpuErrchk(cudaMallocHost((
void**)&matrices,
sizeof(
float)*Ndim*9));
242 for(
int i=0;
i<Ndim;
i++){
243 float aux_matrix[9] = {1, 0, -posX[
i], 0, 1, -posY[
i], 0, 0, 1};
246 for (
int j=0;
j<9;
j++)
247 matrices[offset+
j] = aux_matrix[
j];
249 cudaStream_t *stream = (cudaStream_t*) myStream.
ptr;
250 gpuErrchk(cudaMemcpyAsync((
void*)d_data, matrices, Ndim*9*
sizeof(
float), cudaMemcpyHostToDevice, *stream));