Skip to content

Commit

Permalink
Merge pull request ComputationalRadiationPhysics#186 from psychocoder…
Browse files Browse the repository at this point in the history
…HPC/fix-cudaPitchedPtr

fix initilization of cudaPitchedPtr
  • Loading branch information
ax3l committed Feb 10, 2014
2 parents e44bd3a + d734635 commit 4203111
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/libPMacc/include/memory/buffers/DeviceBufferIntern.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ namespace PMacc
}
if (DIM == DIM2)
{
CUDA_CHECK(cudaMemset2D(data.ptr, data.pitch, 0, data.xsize * sizeof (TYPE), data.ysize));
CUDA_CHECK(cudaMemset2D(data.ptr, data.pitch, 0, data.xsize , data.ysize));
}
if (DIM == DIM3)
{
Expand Down Expand Up @@ -249,20 +249,19 @@ namespace PMacc
__startOperation(ITask::TASK_CUDA);
data.ptr = NULL;
data.pitch = 1;
data.xsize = this->data_space[0];
data.xsize = this->data_space[0]* sizeof (TYPE);
data.ysize = 1;

if (DIM == DIM1)
{
log<ggLog::MEMORY >("Create device 1D data: %1% MiB") % ( this->data_space[0] * sizeof (TYPE) / 1024 / 1024 );
CUDA_CHECK(cudaMallocPitch(&data.ptr, &data.pitch, this->data_space[0] * sizeof (TYPE), 1));
log<ggLog::MEMORY >("Create device 1D data: %1% MiB") % ( data.xsize / 1024 / 1024 );
CUDA_CHECK(cudaMallocPitch(&data.ptr, &data.pitch, data.xsize , 1));
}
if (DIM == DIM2)
{
data.xsize = this->data_space[0];
data.ysize = this->data_space[1];
log<ggLog::MEMORY >("Create device 2D data: %1% MiB") % ( data.xsize * data.ysize * sizeof (TYPE) / 1024 / 1024 );
CUDA_CHECK(cudaMallocPitch(&data.ptr, &data.pitch, data.xsize * sizeof (TYPE), data.ysize));
log<ggLog::MEMORY >("Create device 2D data: %1% MiB") % ( data.xsize * data.ysize / 1024 / 1024 );
CUDA_CHECK(cudaMallocPitch(&data.ptr, &data.pitch, data.xsize , data.ysize));

}
if (DIM == DIM3)
Expand All @@ -286,7 +285,7 @@ namespace PMacc
__startOperation(ITask::TASK_CUDA);
data.ptr = NULL;
data.pitch = 1;
data.xsize = this->data_space[0];
data.xsize = this->data_space[0]* sizeof (TYPE);
data.ysize = 1;

log<ggLog::MEMORY >("Create device fake data: %1% MiB") % ( this->data_space.productOfComponents() * sizeof (TYPE) / 1024 / 1024 );
Expand Down

0 comments on commit 4203111

Please sign in to comment.