mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Fixed Lanczos calling aligned alloc in threaded region hitting up against pointer-cache no-threading restrictions
Fixed Lattice::reset not compiling with new Grid explicit memory region handling Fixed memory leak in Lattice::resize that occurs when data region has been previously allocated
This commit is contained in:
parent
9b7a6d197f
commit
114ebb7914
@ -62,9 +62,12 @@ void basisRotate(std::vector<Field> &basis,Eigen::MatrixXd& Qt,int j0, int j1, i
|
|||||||
basis_v[k] = basis[k].View();
|
basis_v[k] = basis[k].View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector < vobj , commAllocator<vobj> > Bt(thread_max() * Nm); // Thread private
|
||||||
|
|
||||||
thread_region
|
thread_region
|
||||||
{
|
{
|
||||||
std::vector < vobj , commAllocator<vobj> > B(Nm); // Thread private
|
vobj* B = Bt.data() + Nm * thread_num();
|
||||||
|
|
||||||
thread_for_in_region(ss, grid->oSites(),{
|
thread_for_in_region(ss, grid->oSites(),{
|
||||||
for(int j=j0; j<j1; ++j) B[j]=0.;
|
for(int j=j0; j<j1; ++j) B[j]=0.;
|
||||||
|
|
||||||
|
@ -178,8 +178,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
void dealloc(void)
|
void dealloc(void)
|
||||||
{
|
{
|
||||||
alignedAllocator<vobj> alloc;
|
|
||||||
if( this->_odata_size ) {
|
if( this->_odata_size ) {
|
||||||
|
alignedAllocator<vobj> alloc;
|
||||||
alloc.deallocate(this->_odata,this->_odata_size);
|
alloc.deallocate(this->_odata,this->_odata_size);
|
||||||
this->_odata=nullptr;
|
this->_odata=nullptr;
|
||||||
this->_odata_size=0;
|
this->_odata_size=0;
|
||||||
@ -187,16 +187,18 @@ private:
|
|||||||
}
|
}
|
||||||
void resize(uint64_t size)
|
void resize(uint64_t size)
|
||||||
{
|
{
|
||||||
alignedAllocator<vobj> alloc;
|
|
||||||
if ( this->_odata_size != size ) {
|
if ( this->_odata_size != size ) {
|
||||||
|
alignedAllocator<vobj> alloc;
|
||||||
|
|
||||||
dealloc();
|
dealloc();
|
||||||
}
|
|
||||||
this->_odata_size = size;
|
this->_odata_size = size;
|
||||||
if ( size )
|
if ( size )
|
||||||
this->_odata = alloc.allocate(this->_odata_size);
|
this->_odata = alloc.allocate(this->_odata_size);
|
||||||
else
|
else
|
||||||
this->_odata = nullptr;
|
this->_odata = nullptr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
// Return a view object that may be dereferenced in site loops.
|
// Return a view object that may be dereferenced in site loops.
|
||||||
@ -346,7 +348,7 @@ public:
|
|||||||
void reset(GridBase* grid) {
|
void reset(GridBase* grid) {
|
||||||
if (this->_grid != grid) {
|
if (this->_grid != grid) {
|
||||||
this->_grid = grid;
|
this->_grid = grid;
|
||||||
this->_odata.resize(grid->oSites());
|
this->resize(grid->oSites());
|
||||||
this->checkerboard = 0;
|
this->checkerboard = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user