diff --git a/lib/gpu/lal_base_atomic.cpp b/lib/gpu/lal_base_atomic.cpp index eb4dae636f..eb0eab87b6 100644 --- a/lib/gpu/lal_base_atomic.cpp +++ b/lib/gpu/lal_base_atomic.cpp @@ -26,15 +26,16 @@ BaseAtomicT::BaseAtomic() : _compiled(false), _max_bytes(0) { ans=new Answer(); nbor=new Neighbor(); pair_program=NULL; + ucl_device=NULL; } template BaseAtomicT::~BaseAtomic() { delete ans; delete nbor; - if (pair_program) delete pair_program; k_pair_fast.clear(); k_pair.clear(); + if (pair_program) delete pair_program; } template @@ -78,6 +79,8 @@ int BaseAtomicT::init_atomic(const int nlocal, const int nall, if (success!=0) return success; + if (ucl_device!=device->gpu) _compiled=false; + ucl_device=device->gpu; atom=&device->atom; diff --git a/lib/gpu/lal_base_charge.cpp b/lib/gpu/lal_base_charge.cpp index 17f30a7047..52e8ae2d89 100644 --- a/lib/gpu/lal_base_charge.cpp +++ b/lib/gpu/lal_base_charge.cpp @@ -26,15 +26,16 @@ BaseChargeT::BaseCharge() : _compiled(false), _max_bytes(0) { ans=new Answer(); nbor=new Neighbor(); pair_program=NULL; + ucl_device=NULL; } template BaseChargeT::~BaseCharge() { delete ans; delete nbor; - if (pair_program) delete pair_program; k_pair_fast.clear(); k_pair.clear(); + if (pair_program) delete pair_program; } template @@ -78,6 +79,8 @@ int BaseChargeT::init_atomic(const int nlocal, const int nall, if (success!=0) return success; + if (ucl_device!=device->gpu) _compiled=false; + ucl_device=device->gpu; atom=&device->atom; diff --git a/lib/gpu/lal_base_dipole.cpp b/lib/gpu/lal_base_dipole.cpp index a4b0bf3c37..ed71029e68 100644 --- a/lib/gpu/lal_base_dipole.cpp +++ b/lib/gpu/lal_base_dipole.cpp @@ -26,15 +26,16 @@ BaseDipoleT::BaseDipole() : _compiled(false), _max_bytes(0) { ans=new Answer(); nbor=new Neighbor(); pair_program=NULL; + ucl_device=NULL; } template BaseDipoleT::~BaseDipole() { delete ans; delete nbor; - if (pair_program) delete pair_program; k_pair_fast.clear(); k_pair.clear(); + if (pair_program) delete pair_program; } template @@ -79,6 +80,8 @@ int BaseDipoleT::init_atomic(const int nlocal, const int nall, if (success!=0) return success; + if (ucl_device!=device->gpu) _compiled=false; + ucl_device=device->gpu; atom=&device->atom; diff --git a/lib/gpu/lal_base_dpd.cpp b/lib/gpu/lal_base_dpd.cpp index bf4533ad1a..c0d7ad47bc 100644 --- a/lib/gpu/lal_base_dpd.cpp +++ b/lib/gpu/lal_base_dpd.cpp @@ -26,15 +26,16 @@ BaseDPDT::BaseDPD() : _compiled(false), _max_bytes(0) { ans=new Answer(); nbor=new Neighbor(); pair_program=NULL; + ucl_device=NULL; } template BaseDPDT::~BaseDPD() { delete ans; delete nbor; - if (pair_program) delete pair_program; k_pair_fast.clear(); k_pair.clear(); + if (pair_program) delete pair_program; } template @@ -79,6 +80,8 @@ int BaseDPDT::init_atomic(const int nlocal, const int nall, if (success!=0) return success; + if (ucl_device!=device->gpu) _compiled=false; + ucl_device=device->gpu; atom=&device->atom; diff --git a/lib/gpu/lal_base_ellipsoid.cpp b/lib/gpu/lal_base_ellipsoid.cpp index dc32383264..abc8807a8b 100644 --- a/lib/gpu/lal_base_ellipsoid.cpp +++ b/lib/gpu/lal_base_ellipsoid.cpp @@ -36,6 +36,7 @@ BaseEllipsoidT::BaseEllipsoid() : _compiled(false), _max_bytes(0) { nbor_program=NULL; ellipsoid_program=NULL; lj_program=NULL; + ucl_device=NULL; } template @@ -92,7 +93,9 @@ int BaseEllipsoidT::init_base(const int nlocal, const int nall, max_nbors,cell_size,true,1); if (success!=0) return success; - + + if (ucl_device!=device->gpu) _compiled=false; + ucl_device=device->gpu; atom=&device->atom; diff --git a/lib/gpu/lal_base_three.cpp b/lib/gpu/lal_base_three.cpp index 1715fc3074..0b4dbdc89a 100644 --- a/lib/gpu/lal_base_three.cpp +++ b/lib/gpu/lal_base_three.cpp @@ -28,6 +28,7 @@ BaseThreeT::BaseThree() : _compiled(false), _max_bytes(0) { ans2=new Answer(); #endif pair_program=NULL; + ucl_device=NULL; } template @@ -37,12 +38,12 @@ BaseThreeT::~BaseThree() { #ifdef THREE_CONCURRENT delete ans2; #endif - if (pair_program) delete pair_program; k_three_center.clear(); k_three_end.clear(); k_three_end_vatom.clear(); k_pair.clear(); k_short_nbor.clear(); + if (pair_program) delete pair_program; } template @@ -94,6 +95,8 @@ int BaseThreeT::init_three(const int nlocal, const int nall, if (success!=0) return success; + if (ucl_device!=device->gpu) _compiled=false; + ucl_device=device->gpu; atom=&device->atom;