コード例 #1
0
ファイル: Memcopy.hpp プロジェクト: CodeLemon/picongpu
 void operator()(Type* dest, const math::Size_t<1> pitchDest, 
                 const Type* source, const math::Size_t<1> pitchSource, const math::Size_t<2u>& size,
                 flags::Memcopy::Direction direction)
 {
         const cudaMemcpyKind kind[] = {cudaMemcpyHostToDevice, cudaMemcpyDeviceToHost,
                                  cudaMemcpyHostToHost, cudaMemcpyDeviceToDevice};
                                  
         CUDA_CHECK_NO_EXCEP(cudaMemcpy2D(dest, pitchDest.x(), source, pitchSource.x(), sizeof(Type) * size.x(), size.y(),
                      kind[direction]));
 }                    
コード例 #2
0
ファイル: Memcopy.hpp プロジェクト: CodeLemon/picongpu
 void operator()(Type* dest, const math::Size_t<2u> pitchDest, 
                 Type* source, const math::Size_t<2u> pitchSource, const math::Size_t<3>& size,
                 flags::Memcopy::Direction direction)
 {
         const cudaMemcpyKind kind[] = {cudaMemcpyHostToDevice, cudaMemcpyDeviceToHost,
                                  cudaMemcpyHostToHost, cudaMemcpyDeviceToDevice};
                                  
         cudaPitchedPtr pitchedPtrDest;
         pitchedPtrDest.pitch = pitchDest.x(); pitchedPtrDest.ptr = dest;
         pitchedPtrDest.xsize = size.x(); pitchedPtrDest.ysize = size.y();
         cudaPitchedPtr pitchedPtrSource;
         pitchedPtrSource.pitch = pitchSource.x(); pitchedPtrSource.ptr = source;
         pitchedPtrSource.xsize = size.x(); pitchedPtrSource.ysize = size.y();
         
         cudaMemcpy3DParms params;
         params.srcArray = NULL;
         params.srcPos = make_cudaPos(0,0,0);
         params.srcPtr = pitchedPtrSource;
         params.dstArray = NULL;
         params.dstPos = make_cudaPos(0,0,0);
         params.dstPtr = pitchedPtrDest;
         params.extent = make_cudaExtent(size.x() * sizeof(Type), size.y(), size.z());
         params.kind = kind[direction];
         CUDA_CHECK_NO_EXCEP(cudaMemcpy3D(&params));
 }                    
コード例 #3
0
 /**
  * Creates a host buffer from a pointer with a size. Assumes dense layout (no padding)
  *
  * @param ptr Pointer to the first element
  * @param size Size of the buffer
  * @param ownMemory Set to false if the memory is only a reference and managed outside of this class
  * @param pitch Pitch in bytes (number of bytes in the lower dimensions)
  */
 HINLINE HostBuffer(Type* ptr, const math::Size_t<T_dim>& size, bool ownMemory, PitchType pitch = PitchType::create(0))
 {
     this->dataPointer = ptr;
     this->_size = size;
     if(T_dim >= 2)
         this->pitch[0] = (pitch[0]) ? pitch[0] : size.x() * sizeof(Type);
     if(T_dim == 3)
         this->pitch[1] = (pitch[1]) ? pitch[1] : this->pitch[0] * size.y();
     this->refCount = new int;
     *this->refCount = (ownMemory) ? 1 : 2;
 }
コード例 #4
0
 void operator()(Type* dest, const math::Size_t<0>,
                 const Type* source, const math::Size_t<0>, const math::Size_t<1>& size,
                 flags::Memcopy::Direction direction)
 {
         const cudaMemcpyKind kind[] = {cudaMemcpyHostToDevice, cudaMemcpyDeviceToHost,
                                  cudaMemcpyHostToHost, cudaMemcpyDeviceToDevice};
         CUDA_CHECK(cudaMemcpy(dest, source, sizeof(Type) * size.x(), kind[direction]));
 }
コード例 #5
0
ファイル: SphericMapper.hpp プロジェクト: Heikman/picongpu
 dim3 cudaGridDim(const math::Size_t<2>& size) const
 {
     return dim3(size.x() / BlockDim::x::value,
                 size.y() / BlockDim::y::value, 1);
 }
コード例 #6
0
ファイル: SphericMapper.hpp プロジェクト: Heikman/picongpu
 dim3 cudaGridDim(const math::Size_t<3>& size) const
 {
     return dim3((size.x() / BlockDim::x::value) * (size.z() / BlockDim::z::value),
                 size.y() / BlockDim::y::value, 1);
 }
コード例 #7
0
ファイル: SphericMapper.hpp プロジェクト: Heikman/picongpu
 SphericMapper(const math::Size_t<3>& size)
  : widthInBlocks(size.x() / BlockDim::x::value) {}
コード例 #8
0
 PNGBuffer(math::Size_t<2> size, const std::string& name) : png(size.x(), size.y(), 0.0, name.data()), size(size) {}