75 lines
2.7 KiB
Plaintext
75 lines
2.7 KiB
Plaintext
|
|
#ifndef _GPUTOOL_H_
|
|||
|
|
#define _GPUTOOL_H_
|
|||
|
|
#ifdef __CUDANVCC___
|
|||
|
|
#include "BaseConstVariable.h"
|
|||
|
|
#include <cuda_runtime.h>
|
|||
|
|
#include <device_launch_parameters.h>
|
|||
|
|
#include <cublas_v2.h>
|
|||
|
|
#include <cuComplex.h>
|
|||
|
|
|
|||
|
|
#define __CUDADEBUG__
|
|||
|
|
|
|||
|
|
#define CUDAMEMORY Memory1MB*100
|
|||
|
|
|
|||
|
|
#define LAMP_CUDA_PI 3.141592653589793238462643383279
|
|||
|
|
|
|||
|
|
|
|||
|
|
// Ĭ<><C4AC><EFBFBD>Դ<EFBFBD><D4B4>ֲ<EFBFBD>
|
|||
|
|
|
|||
|
|
|
|||
|
|
enum LAMPGPUDATETYPE {
|
|||
|
|
LAMP_LONG,
|
|||
|
|
LAMP_FLOAT,
|
|||
|
|
LAMP_COMPLEXFLOAT
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
extern "C" struct CUDAVector {
|
|||
|
|
float x;
|
|||
|
|
float y;
|
|||
|
|
float z;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
extern "C" struct CUDAVectorEllipsoidal {
|
|||
|
|
float theta;
|
|||
|
|
float phi;
|
|||
|
|
float pho;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
|||
|
|
extern __device__ cuComplex cuCexpf(cuComplex x);
|
|||
|
|
extern __device__ CUDAVector GPU_VectorAB(CUDAVector A, CUDAVector B);
|
|||
|
|
extern __device__ float GPU_VectorNorm2(CUDAVector A);
|
|||
|
|
extern __device__ float GPU_dotVector(CUDAVector A, CUDAVector B);
|
|||
|
|
extern __device__ float GPU_CosAngle_VectorA_VectorB(CUDAVector A, CUDAVector B);
|
|||
|
|
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ȫ<EFBFBD>ֺ<EFBFBD><D6BA><EFBFBD>
|
|||
|
|
extern __global__ void CUDA_DistanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long len);
|
|||
|
|
extern __global__ void CUDA_B_DistanceA(float* Ax, float* Ay, float* Az, float Bx, float By, float Bz, float* R, long len);
|
|||
|
|
extern __global__ void CUDA_make_VectorA_B(float sX, float sY, float sZ, float* tX, float* tY, float* tZ, float* RstX, float* RstY, float* RstZ, long len);
|
|||
|
|
extern __global__ void CUDA_Norm_Vector(float* Vx, float* Vy, float* Vz, float* R, long len);
|
|||
|
|
extern __global__ void CUDA_cosAngle_VA_AB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* anglecos, long len);
|
|||
|
|
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
extern "C" void checkCudaError(cudaError_t err, const char* msg);
|
|||
|
|
|
|||
|
|
// GPU <20>ڴ溯<DAB4><E6BAAF>
|
|||
|
|
extern "C" void* mallocCUDAHost( long memsize); // <20><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
extern "C" void FreeCUDAHost(void* ptr);
|
|||
|
|
extern "C" void* mallocCUDADevice( long memsize); // GPU<50>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
extern "C" void FreeCUDADevice(void* ptr);
|
|||
|
|
extern "C" void HostToDevice(void* hostptr, void* deviceptr, long memsize);//GPU <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA> <20>豸 -> GPU
|
|||
|
|
extern "C" void DeviceToHost(void* hostptr, void* deviceptr, long memsize);//GPU <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA> GPU -> <20>豸
|
|||
|
|
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㺯<EFBFBD><E3BAAF>
|
|||
|
|
extern "C" void CUDAdistanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long member);
|
|||
|
|
extern "C" void CUDABdistanceAs(float* Ax, float* Ay, float* Az, float Bx, float By, float Bz, float* R, long member);
|
|||
|
|
extern "C" void CUDAmake_VectorA_B(float sX, float sY, float sZ, float* tX, float* tY, float* tZ, float* RstX, float* RstY, float* RstZ, long member);
|
|||
|
|
extern "C" void CUDANorm_Vector(float* Vx, float* Vy, float* Vz, float* R, long member);
|
|||
|
|
extern "C" void CUDAcosAngle_VA_AB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* anglecos, long len);
|
|||
|
|
|
|||
|
|
#endif
|
|||
|
|
#endif
|