Fix memory issue in fix_nvt_sllod_kokkos

This commit is contained in:
Stan Gerald Moore
2021-08-26 09:36:16 -06:00
parent 0e8facdcbb
commit be98d0bbd9
2 changed files with 15 additions and 11 deletions

View File

@ -65,8 +65,6 @@ void FixNVTSllodKokkos<DeviceType>::init()
{
FixNHKokkos<DeviceType>::init();
vdelu = typename ArrayTypes<DeviceType>::t_v_array("nvt/sllod/kk:vdelu", atomKK->nlocal);
if (!this->temperature->tempbias)
this->error->all(FLERR,"Temperature for fix nvt/sllod does not have a bias");
@ -100,7 +98,7 @@ void FixNVTSllodKokkos<DeviceType>::nh_v_temp()
// calculate temperature since some computes require temp
// computed on current nlocal atoms to remove bias
if (nondeformbias){
if (nondeformbias) {
atomKK->sync(this->temperature->execution_space,this->temperature->datamask_read);
this->temperature->compute_scalar();
atomKK->modified(this->temperature->execution_space,this->temperature->datamask_modify);
@ -115,6 +113,9 @@ void FixNVTSllodKokkos<DeviceType>::nh_v_temp()
d_h_two = Few<double, 6>(h_two);
if (vdelu.extent(0) < atomKK->nmax)
vdelu = typename AT::t_v_array(Kokkos::NoInit("nvt/sllod/kk:vdelu"), atomKK->nmax);
this->copymode = 1;
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagFixNVTSllod_temp1>(0,nlocal),*this);
this->copymode = 0;

View File

@ -35,6 +35,9 @@ struct TagFixNVTSllod_temp2{};
template<class DeviceType>
class FixNVTSllodKokkos : public FixNHKokkos<DeviceType> {
public:
typedef DeviceType device_type;
typedef ArrayTypes<DeviceType> AT;
FixNVTSllodKokkos(class LAMMPS *, int, char **);
~FixNVTSllodKokkos() {}
void init();
@ -51,14 +54,14 @@ class FixNVTSllodKokkos : public FixNHKokkos<DeviceType> {
void nh_v_temp();
protected:
typename ArrayTypes<DeviceType>::t_x_array x;
typename ArrayTypes<DeviceType>::t_v_array v;
typename ArrayTypes<DeviceType>::t_v_array vdelu;
typename ArrayTypes<DeviceType>::t_f_array_const f;
typename ArrayTypes<DeviceType>::t_float_1d rmass;
typename ArrayTypes<DeviceType>::t_float_1d mass;
typename ArrayTypes<DeviceType>::t_int_1d type;
typename ArrayTypes<DeviceType>::t_int_1d mask;
typename AT::t_x_array x;
typename AT::t_v_array v;
typename AT::t_v_array vdelu;
typename AT::t_f_array_const f;
typename AT::t_float_1d rmass;
typename AT::t_float_1d mass;
typename AT::t_int_1d type;
typename AT::t_int_1d mask;
Few<double, 6> d_h_two;