Skip to content

Commit

Permalink
Put Workspace2D spectra delete in OpenMP loop.
Browse files Browse the repository at this point in the history
On MSVC this improves the time taken to delete large workspaces that have
had their memory allocated on multiple threads, i.e. running ConvertUnits
and breaking the X-data sharing. For example, a workspace
with ~70000 spectra & ~2600 bins (~4.3Gb) takes ~45 seconds to delete
after a ConvertUnits call. This drops to 1-2s if the deallocation of the
memory also happens within a multi-threaded loop.
Refs #8216
  • Loading branch information
martyngigg committed Mar 17, 2014
1 parent 9f6600b commit e81d0d8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Code/Mantid/Framework/DataObjects/src/Workspace2D.cpp
Expand Up @@ -28,7 +28,8 @@ namespace Mantid
Workspace2D::~Workspace2D()
{
// Clear out the memory
for (size_t i=0; i<data.size(); i++)
PARALLEL_FOR1(this)
for (int64_t i=0; i < static_cast<int64_t>(data.size()); i++)
{
delete data[i];
}
Expand Down

0 comments on commit e81d0d8

Please sign in to comment.