mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3634 Regression Test : Use flag to control OpenMP when building geometry
This commit is contained in:
parent
ca07e710c6
commit
cfbbcacc23
@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@ -22,42 +22,61 @@
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
#include "cafPdmUiTextEditor.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RiaRegressionTest, "RiaRegressionTest");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaRegressionTest::RiaRegressionTest(void)
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault(&folderContainingCompareTool, "workingFolder", "Folder containing <b>compare</b>", "", "Location of compare tool from Image Magic suite", "");
|
||||
CAF_PDM_InitFieldNoDefault(&folderContainingCompareTool,
|
||||
"workingFolder",
|
||||
"Folder containing <b>compare</b>",
|
||||
"",
|
||||
"Location of compare tool from Image Magic suite",
|
||||
"");
|
||||
folderContainingCompareTool.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&folderContainingDiffTool, "folderContainingDiffTool", "Folder containing <b>diff</b>", "", "Location of diff tool used for text compare", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&folderContainingDiffTool,
|
||||
"folderContainingDiffTool",
|
||||
"Folder containing <b>diff</b>",
|
||||
"",
|
||||
"Location of diff tool used for text compare",
|
||||
"");
|
||||
folderContainingDiffTool.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&folderContainingGitTool, "folderContainingGitTool", "Folder containing <b>git</b>", "", "Location of git tool used for text compare", "");
|
||||
CAF_PDM_InitFieldNoDefault(&folderContainingGitTool,
|
||||
"folderContainingGitTool",
|
||||
"Folder containing <b>git</b>",
|
||||
"",
|
||||
"Location of git tool used for text compare",
|
||||
"");
|
||||
folderContainingGitTool.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(®ressionTestFolder, "regressionTestFolder", "Regression Test Folder", "", "", "");
|
||||
regressionTestFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&showInteractiveDiffImages, "showInteractiveDiffImages", false, "Interactive Diff Images", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&testFilter, "testFilter", "Test Filter", "", "If empty, all tests are executed.\nTo execute a subset of tests, specify folder names separated by ;", "");
|
||||
CAF_PDM_InitField(
|
||||
&useOpenMPForGeometryCreation, "useOpenMPForGeometryCreation", true, "Use OpenMP For Geometry Creation", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(
|
||||
&testFilter,
|
||||
"testFilter",
|
||||
"Test Filter",
|
||||
"",
|
||||
"If empty, all tests are executed.\nTo execute a subset of tests, specify folder names separated by ;",
|
||||
"");
|
||||
testFilter.uiCapability()->setUiEditorTypeName(caf::PdmUiTextEditor::uiEditorTypeName());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaRegressionTest::~RiaRegressionTest(void)
|
||||
{
|
||||
|
||||
}
|
||||
RiaRegressionTest::~RiaRegressionTest(void) {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaRegressionTest::writeSettingsToApplicationStore() const
|
||||
{
|
||||
@ -65,7 +84,7 @@ void RiaRegressionTest::writeSettingsToApplicationStore() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaRegressionTest::readSettingsFromApplicationStore()
|
||||
{
|
||||
@ -73,11 +92,14 @@ void RiaRegressionTest::readSettingsFromApplicationStore()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaRegressionTest::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
void RiaRegressionTest::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
if (field == &folderContainingDiffTool || field == &folderContainingCompareTool || field == ®ressionTestFolder || field == &folderContainingGitTool)
|
||||
if (field == &folderContainingDiffTool || field == &folderContainingCompareTool || field == ®ressionTestFolder ||
|
||||
field == &folderContainingGitTool)
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
|
@ -1,28 +1,26 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RiaRegressionTest : public caf::PdmObject
|
||||
{
|
||||
@ -36,13 +34,16 @@ public:
|
||||
void readSettingsFromApplicationStore();
|
||||
|
||||
public:
|
||||
caf::PdmField<QString> folderContainingCompareTool;
|
||||
caf::PdmField<QString> folderContainingDiffTool;
|
||||
caf::PdmField<QString> folderContainingGitTool;
|
||||
caf::PdmField<QString> regressionTestFolder;
|
||||
caf::PdmField<QString> testFilter;
|
||||
caf::PdmField<bool> showInteractiveDiffImages;
|
||||
caf::PdmField<QString> folderContainingCompareTool;
|
||||
caf::PdmField<QString> folderContainingDiffTool;
|
||||
caf::PdmField<QString> folderContainingGitTool;
|
||||
caf::PdmField<QString> regressionTestFolder;
|
||||
caf::PdmField<QString> testFilter;
|
||||
caf::PdmField<bool> showInteractiveDiffImages;
|
||||
caf::PdmField<bool> useOpenMPForGeometryCreation;
|
||||
|
||||
protected:
|
||||
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
|
||||
void defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute) override;
|
||||
};
|
||||
|
@ -630,6 +630,8 @@ void RiaRegressionTestRunner::executeRegressionTests(const QString& regressionTe
|
||||
|
||||
mainWnd->setDefaultWindowSize();
|
||||
|
||||
m_regressionTestSettings.readSettingsFromApplicationStore();
|
||||
|
||||
m_rootPath = regressionTestPath;
|
||||
m_testFilter = testFilter;
|
||||
runRegressionTest();
|
||||
@ -646,6 +648,16 @@ bool RiaRegressionTestRunner::isRunningRegressionTests() const
|
||||
return m_runningRegressionTests;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaRegressionTestRunner::useOpenMPForGeometryCreation() const
|
||||
{
|
||||
if (!m_runningRegressionTests) return false;
|
||||
|
||||
return m_regressionTestSettings.useOpenMPForGeometryCreation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaRegressionTest.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QSize>
|
||||
#include <QStringList>
|
||||
@ -37,6 +39,7 @@ public:
|
||||
void executeRegressionTests();
|
||||
|
||||
bool isRunningRegressionTests() const;
|
||||
bool useOpenMPForGeometryCreation() const;
|
||||
|
||||
static void updateRegressionTest(const QString& testRootPath);
|
||||
static void regressionTestConfigureProject();
|
||||
@ -63,7 +66,8 @@ private:
|
||||
QFileInfoList subDirectoriesForTestExecution(const QDir& directory);
|
||||
|
||||
private:
|
||||
QString m_rootPath;
|
||||
QStringList m_testFilter;
|
||||
bool m_runningRegressionTests;
|
||||
QString m_rootPath;
|
||||
QStringList m_testFilter;
|
||||
bool m_runningRegressionTests;
|
||||
RiaRegressionTest m_regressionTestSettings;
|
||||
};
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaRegressionTestRunner.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
@ -71,7 +72,7 @@
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivGridPartMgr::RivGridPartMgr(RivCellSetEnum cellSetType, RimEclipseCase* eclipseCase, const RigGridBase* grid, size_t gridIdx)
|
||||
: m_surfaceGenerator(grid)
|
||||
: m_surfaceGenerator(grid, RiaRegressionTestRunner::instance()->useOpenMPForGeometryCreation())
|
||||
, m_gridIdx(gridIdx)
|
||||
, m_grid(grid)
|
||||
, m_surfaceFaceFilter(grid)
|
||||
|
@ -172,8 +172,9 @@ bool CellRangeFilter::hasIncludeRanges() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
StructGridGeometryGenerator::StructGridGeometryGenerator(const StructGridInterface* grid)
|
||||
: m_grid(grid)
|
||||
StructGridGeometryGenerator::StructGridGeometryGenerator(const StructGridInterface* grid, bool useOpenMP)
|
||||
: m_grid(grid),
|
||||
m_useOpenMP(useOpenMP)
|
||||
{
|
||||
CVF_ASSERT(grid);
|
||||
m_quadMapper = new StructGridQuadToCellFaceMapper;
|
||||
@ -373,7 +374,7 @@ void StructGridGeometryGenerator::computeArrays()
|
||||
|
||||
cvf::Vec3d offset = m_grid->displayModelOffset();
|
||||
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
#pragma omp parallel for schedule(dynamic) if (m_useOpenMP)
|
||||
for (int k = 0; k < static_cast<int>(m_grid->cellCountK()); k++)
|
||||
{
|
||||
size_t j;
|
||||
|
@ -164,7 +164,7 @@ private:
|
||||
class StructGridGeometryGenerator : public Object
|
||||
{
|
||||
public:
|
||||
explicit StructGridGeometryGenerator(const StructGridInterface* grid);
|
||||
explicit StructGridGeometryGenerator(const StructGridInterface* grid, bool useOpenMP);
|
||||
~StructGridGeometryGenerator();
|
||||
|
||||
// Setup methods
|
||||
@ -209,6 +209,11 @@ private:
|
||||
// Mappings
|
||||
ref<StructGridQuadToCellFaceMapper> m_quadMapper;
|
||||
ref<StuctGridTriangleToCellFaceMapper> m_triangleMapper;
|
||||
|
||||
// Multiple treads can be used when building geometry data structures.
|
||||
// This causes visual artifacts due to transparency algorithm, and a stable visual image
|
||||
// can be produced if OpenMP is disabled. Currently used by regression test comparing images
|
||||
bool m_useOpenMP;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user