Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solve potential compilation issue in HyP_examples #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ DEVICE void Dvc_MultiAgentRockSample::Dvc_Copy_NoAlloc(Dvc_State* des, const Dvc
/*Pass member values, assign member pointers to existing state pointer*/
const Dvc_MARockSampleState* src_i= static_cast<const Dvc_MARockSampleState*>(src)+pos;
if(!offset_des) pos=0;
Dvc_MARockSampleState* des_i= static_cast<const Dvc_MARockSampleState*>(des)+pos;
Dvc_MARockSampleState* des_i= static_cast<Dvc_MARockSampleState*>(des)+pos;

des_i->weight = src_i->weight;
des_i->scenario_id = src_i->scenario_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ DEVICE Dvc_State* Dvc_UncNavigation::Dvc_Get(Dvc_State* particles, int pos) {

DEVICE Dvc_State* Dvc_UncNavigation::Dvc_Alloc( int num) {
//Dvc_UncNavigationState* state = Dvc_memory_pool_.Allocate();
Dvc_UncNavigationState* state = (Dvc_UncNavigationState*)malloc(num*sizeof(Dvc_UncNavigationState));
Dvc_UncNavigationState* state = new Dvc_UncNavigationState[num];

for(int i=0;i<num;i++)
state[i].SetAllocated();
Expand All @@ -145,7 +145,7 @@ DEVICE void Dvc_UncNavigation::Dvc_Copy_NoAlloc(Dvc_State* des, const Dvc_State*
/*Pass member values, assign member pointers to existing state pointer*/
const Dvc_UncNavigationState* src_i= static_cast<const Dvc_UncNavigationState*>(src)+pos;
if(!offset_des) pos=0;
Dvc_UncNavigationState* des_i= static_cast<const Dvc_UncNavigationState*>(des)+pos;
Dvc_UncNavigationState* des_i= static_cast<Dvc_UncNavigationState*>(des)+pos;

*des_i = *src_i;
des_i->SetAllocated();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ __global__ void AllocCells(Dvc_UncNavigationState* Dvc,int Cell_x,int Cell_y, in
if(pos < num_particles)
{
Dvc_UncNavigationState* Dvc_i=Dvc+pos;
Dvc_i->cells=(bool*)malloc(Cell_x*Cell_y*sizeof(bool));
Dvc_i->cells=new bool[Cell_x*Cell_y];
Dvc_i->b_Extern_cells=false;
}
}
Expand Down Expand Up @@ -443,10 +443,10 @@ Dvc_State* BaseUncNavigation::CopyParticlesToGPU(Dvc_State* dvc_particles, const
for (int i=0;i<particles.size();i++)
{
const UncNavigationState* src=static_cast<const UncNavigationState*>(particles[i]);
Dvc_UncNavigationState::CopyMainStateToGPU(static_cast<const Dvc_UncNavigationState*>(dvc_particles)
Dvc_UncNavigationState::CopyMainStateToGPU(static_cast<Dvc_UncNavigationState*>(dvc_particles)
,src->scenario_id,src);
}
Dvc_UncNavigationState::CopyCellsToGPU(static_cast<const Dvc_UncNavigationState*>(dvc_particles),particles.size());
Dvc_UncNavigationState::CopyCellsToGPU(static_cast<Dvc_UncNavigationState*>(dvc_particles),particles.size());

cout<<"GPU particles copy time:"<<chrono::duration_cast<sec>(Time::now() - start).count()<<endl;

Expand Down