Skip to content

Commit

Permalink
refs #6449 hopefully fixed performance test
Browse files Browse the repository at this point in the history
hopefully fixed CPP check warning.
  • Loading branch information
abuts committed Feb 15, 2013
1 parent 2637aa4 commit 118a7e1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ namespace
detFalseSize[3*i+1] = 0.22f;
detFalseSize[3*i+2] = 0.33f;

detOrient[3*i+0] = float(i*0.1f);
detOrient[3*i+1] = float(i*0.2f);
detOrient[3*i+2] = float(i*0.3f);
detOrient[3*i+0] = static_cast<float>(i*0.1f);
detOrient[3*i+1] = static_cast<float>(i*0.2f);
detOrient[3*i+2] = static_cast<float>(i*0.3f);

detStruct[2*i+0] = boost::lexical_cast<float>(pressure[ic]);
detStruct[2*i+1] =boost::lexical_cast<float>(wallThick[ic]);
Expand Down
58 changes: 31 additions & 27 deletions Code/Mantid/Framework/MDEvents/test/MDEventWorkspaceTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -607,64 +607,68 @@ class MDEventWorkspaceTest : public CxxTest::TestSuite
}
};

class MDEventWorkspaceTestPerformance : public CxxTest::TestSuite
class MDEventWorkspacePerformanceTest : public CxxTest::TestSuite
{

private:

MDEventWorkspace3Lean::sptr m_ws;

size_t nEvents,nBoxes;
public:

// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static MDEventWorkspaceTestPerformance *createSuite() { return new MDEventWorkspaceTestPerformance(); }
static void destroySuite( MDEventWorkspaceTestPerformance *suite ) { delete suite; }
static MDEventWorkspacePerformanceTest *createSuite() { return new MDEventWorkspacePerformanceTest(); }
static void destroySuite( MDEventWorkspacePerformanceTest *suite ) { delete suite; }

MDEventWorkspaceTestPerformance()
{
MDEventWorkspacePerformanceTest()
{
}
void startUp()
{
size_t dim_size = 100;
size_t sq_dim_size = dim_size*dim_size;
m_ws = MDEventsTestHelper::makeMDEW<3>(10, 0.0, (Mantid::coord_t)dim_size, 10 /*event per box*/);
m_ws->getBoxController()->setSplitThreshold(10);
std::vector<MDLeanEvent<3> > vecEvents(dim_size*dim_size*dim_size);

for(size_t i = 0; i < dim_size; ++i)
void setUp()
{
for(size_t j = 0; j < dim_size; ++j)
size_t dim_size = 20;
size_t sq_dim_size = dim_size*dim_size;
m_ws = MDEventsTestHelper::makeMDEW<3>(10, 0.0, (Mantid::coord_t)dim_size, 10 /*event per box*/);
m_ws->getBoxController()->setSplitThreshold(10);
nBoxes = dim_size*dim_size*dim_size;
std::vector<MDLeanEvent<3> > vecEvents(nBoxes);

for(size_t i = 0; i < dim_size; ++i)
{
for(size_t k = 0; k < dim_size; ++k)
for(size_t j = 0; j < dim_size; ++j)
{
double centers[3] = {(double)i, (double)j, (double)k};
vecEvents[i + j*dim_size + k*sq_dim_size] = MDLeanEvent<3>(1, 1, centers);
for(size_t k = 0; k < dim_size; ++k)
{
double centers[3] = {(double)i, (double)j, (double)k};
vecEvents[i + j*dim_size + k*sq_dim_size] = MDLeanEvent<3>(1, 1, centers);
}
}
}
m_ws->addEvents(vecEvents);
}
m_ws->addEvents(vecEvents);
}

void tearDown()
{
m_ws.reset();
}
void test_splitting_performance_single_threaded()
void teadDown()
{
m_ws.reset();
}
void test_splitting_performance_single_threaded()
{
std::cout<<"Starting Workspace splitting performance test, single threaded with "<<nBoxes <<" events \n";
Kernel::Timer clock;
m_ws->splitAllIfNeeded(NULL);
std::cout << clock.elapsed()<<std::endl;
std::cout<<"Finished Workspace splitting performance test, single threaded in "<< clock.elapsed()<<" sec\n";
}

void test_splitting_performance_parallel()
{
auto ts_splitter = new ThreadSchedulerFIFO();
ThreadPool tp_splitter(ts_splitter,8);
Kernel::Timer clock;
std::cout<<"Starting Workspace splitting performance test, 8 thread with "<<nBoxes <<" events \n";
m_ws->splitAllIfNeeded(ts_splitter);
tp_splitter.joinAll();
std::cout << clock.elapsed()<<std::endl;
std::cout<<"Finished Workspace splitting performance test, 8 threads in "<< clock.elapsed()<<" sec\n";
}
};

Expand Down

0 comments on commit 118a7e1

Please sign in to comment.