26 lines
763 B
C
26 lines
763 B
C
|
#ifndef __GPUBASETOOL_H__
|
||
|
#define __GPUBASETOOL_H__
|
||
|
|
||
|
#include "GPUBaseLibAPI.h"
|
||
|
#include "BaseConstVariable.h"
|
||
|
#include <iostream>
|
||
|
#include <memory>
|
||
|
#include <complex>
|
||
|
#include "GPUTool.cuh"
|
||
|
|
||
|
extern "C" GPUBASELIBAPI size_t getfsize(FILE* fp);
|
||
|
extern "C" GPUBASELIBAPI unsigned char* loadBinFromPath(char* binPath, size_t* binpath_len);
|
||
|
extern "C" GPUBASELIBAPI void writeComplexDataBinFile(char* dataPath, size_t datalen, cuComplex* data);
|
||
|
|
||
|
template<typename T>
|
||
|
inline std::shared_ptr<T> CPUToHost(std::shared_ptr<T> CPUArr, size_t len) {
|
||
|
std::shared_ptr<T> result = std::shared_ptr<T>((T*)mallocCUDAHost(len*sizeof(T)), FreeCUDAHost);
|
||
|
for (size_t i = 0; i < len; i++) {
|
||
|
result.get()[i] = CPUArr.get()[i];
|
||
|
}
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
|
||
|
#endif // !__GPUBASETOOL_H__
|