Commit a20b63e7 authored by camp's avatar camp
Browse files

Merge VisIt threading branch -

svn+ssh://portal-auth.nersc.gov/project/projectdirs/visit/svn/visit/branches/camp/hp/src
to truck.

This check in adds the changes needed to thread the filters of VisIt.
I still need to port the VTK changes to the new version of VTK 6 to have everything work.
I will send out a message when I have these changes.

By default VisIt is build in serial mode. You need to build VisIt with the threading option
to have a threaded version. This can be done with the --thread option to build visit script.
Or there is a CMake flag VISIT_THREAD.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@21206 18c085ea-50e0-402c-830e-de6fd14e8384
parent 84dc26f4
......@@ -618,6 +618,8 @@ ENDIF(APPLE OR WIN32)
OPTION(VISIT_USE_GLEW "Use GLEW to call GL functions." ON)
OPTION(VISIT_USE_BOOST "Use system boost library." ON)
OPTION(VISIT_THREAD "Build VisIt with thread support." OFF)
SET(VISIT_INSTALL_PROFILES_TO_HOSTS "" CACHE STRING "Install specified host profiles (no action if empty)." )
MACRO(VISIT_3RDPARTY_VAR libvar comment)
......@@ -1038,6 +1040,15 @@ ENDIF(VISIT_R_DIR)
# Configure VTK support.
INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindVisItVTK.cmake)
# Enable thread build of VisIt
IF(VISIT_THREAD)
ADD_DEFINITIONS(-DVISIT_ATOMIC_USE_GCC_ATOMIC)
ADD_DEFINITIONS(-DVISIT_THREADS)
MESSAGE(STATUS "Threading for VisIt: ON")
ELSE(VISIT_THREAD)
MESSAGE(STATUS "Threading for VisIt: OFF")
ENDIF(VISIT_THREAD)
#-----------------------------------------------------------------------------
# If we are doing a static build or the VTK Python wrappers do not exist:
# Disable python filters.
......
......@@ -45,8 +45,7 @@
#include <BadIndexException.h>
#include <ImproperUseException.h>
using std::vector;
#include <avtExecutionManager.h>
avtFileDescriptorManager *avtFileDescriptorManager::instance = NULL;
......@@ -266,8 +265,12 @@ avtFileDescriptorManager::UsedFile(int index)
EXCEPTION2(BadIndexException, index, fileIsOpen.size());
}
VisitMutexLock("avtFileDescriptorManagerFileTimestamp");
fileTimestamp[index] = timestamp;
timestamp++;
VisitMutexUnlock("avtFileDescriptorManagerFileTimestamp");
}
......
......@@ -903,6 +903,8 @@ avtSourceFromDatabase::ManageExpressions(const char *name)
if (curList->operator[](name) == NULL)
return std::string(name);
// TODO. If we thread safe the cache we can add back. DC
#ifndef VISIT_THREADS
if (lastExprList == NULL)
lastExprList = new ExpressionList(*curList);
......@@ -914,6 +916,7 @@ avtSourceFromDatabase::ManageExpressions(const char *name)
cache->ClearVariablesWithString("__AVT_EXPR__");
*lastExprList = *curList;
}
#endif // VISIT_THREADS
// mangle in a prefix to say this is an expression.
char str[1024];
......
......@@ -51,6 +51,7 @@
#include <ImproperUseException.h>
#include <TimingsManager.h>
#include "avtExecutionManager.h"
using std::string;
using std::vector;
......@@ -252,6 +253,10 @@ avtVariableCache::GetVTKObject(const char *var, const char *type, int timestep,
// Mark C. Miller, Sun Dec 3 12:20:11 PST 2006
// Added RemoveObjectPointerPair to ensure we don't have a pair with obj
// already recorded
//
// David Camp, Mon May 20 07:45:08 PDT 2013
// Added code to lock the push of the cache var. This is only done in
// thread mode.
// ****************************************************************************
void
......@@ -274,7 +279,9 @@ avtVariableCache::CacheVTKObject(const char *name, const char *type,
if (v == NULL)
{
v = new OneVar(name, type);
VisitMutexLock( "avtVariableCache::vtkVars" );
vtkVars.push_back(v);
VisitMutexUnlock( "avtVariableCache::vtkVars" );
}
RemoveObjectPointerPair(obj);
......@@ -665,6 +672,9 @@ avtVariableCache::GetVoidRef(const char *var, const char *type, int timestep,
// Programmer: Hank Childs
// Creation: May 22, 2001
//
// David Camp, Mon May 20 07:45:08 PDT 2013
// Added code to lock the push of the cache var. This is only done in
// thread mode.
// ****************************************************************************
void
......@@ -686,7 +696,9 @@ avtVariableCache::CacheVoidRef(const char *name, const char *type,
if (v == NULL)
{
v = new OneVar(name, type);
VisitMutexLock( "avtVariableCache::voidRefVars" );
voidRefVars.push_back(v);
VisitMutexUnlock( "avtVariableCache::voidRefVars" );
}
avtCachedVoidRef *cvr = new avtCachedVoidRef(vr);
......@@ -1148,6 +1160,9 @@ avtVariableCache::OneMat::~OneMat()
// Programmer: Hank Childs
// Creation: October 5, 2001
//
// David Camp, Mon May 20 07:45:08 PDT 2013
// Added code to lock the push of the cache var. This is only done in
// thread mode.
// ****************************************************************************
void
......@@ -1169,7 +1184,9 @@ avtVariableCache::OneMat::CacheItem(int timestep, int domain,
if (t == NULL)
{
t = new OneTimestep(timestep);
VisitMutexLock( "avtVariableCache::OneMat::timesteps" );
timesteps.push_back(t);
VisitMutexUnlock( "avtVariableCache::OneMat::timesteps" );
}
t->CacheItem(domain, im);
......
......@@ -139,7 +139,7 @@ avtBinaryMathExpression::~avtBinaryMathExpression()
// ****************************************************************************
vtkDataArray *
avtBinaryMathExpression::DeriveVariable(vtkDataSet *in_ds)
avtBinaryMathExpression::DeriveVariable(vtkDataSet *in_ds, int currentDomainsIndex)
{
// Our first operand is in the active variable. We don't know if it's
// point data or cell data, so check which one is non-NULL.
......
......@@ -95,7 +95,7 @@ class EXPRESSION_API avtBinaryMathExpression
virtual int NumVariableArguments() { return 2; }
protected:
virtual vtkDataArray *DeriveVariable(vtkDataSet *);
virtual vtkDataArray *DeriveVariable(vtkDataSet *, int currentDomainsIndex);
virtual vtkDataArray *CreateArray(vtkDataArray *, vtkDataArray *);
virtual void DoOperation(vtkDataArray *in1, vtkDataArray *in2,
vtkDataArray *out, int, int) = 0;
......
......@@ -179,6 +179,10 @@ avtExpressionDataTreeIterator::~avtExpressionDataTreeIterator()
// with ncells and npts. (The old way would do the wrong thing
// for single-cell data sets.)
//
// David Camp, Tue May 21 13:56:12 PDT 2013
// Removed the currentDomainsLabel and currentDomainsIndex variables.
// This was done to thread the code.
//
// ****************************************************************************
vtkDataSet *
......@@ -204,11 +208,9 @@ avtExpressionDataTreeIterator::ExecuteData(vtkDataSet *in_ds, int index,
//
// Start off by having the derived type calculate the derived variable.
//
currentDomainsLabel = label;
currentDomainsIndex = index;
if (dat == NULL)
{
dat = DeriveVariable(in_ds);
dat = DeriveVariable(in_ds, index);
if (dat == NULL)
{
EXCEPTION2(ExpressionException, outputVariableName, "an unknown error occurred while "
......
......@@ -65,6 +65,17 @@
// Programmer: Hank Childs
// Creation: December 27, 2004
//
// Modifications:
//
// David Camp, Tue May 21 13:56:12 PDT 2013
// Remove these variables because the worker threads will call
// the ExecuteData function and they all can not share these variables.
// I will change the code to pass the currentDomainsIndex into the
// DeriveVariable function. I have found that no one uses the
// currentDomainsLabel variable, so I am not going to pass it.
// std::string currentDomainsLabel;
// int currentDomainsIndex;
//
// ****************************************************************************
class EXPRESSION_API avtExpressionDataTreeIterator
......@@ -76,14 +87,9 @@ class EXPRESSION_API avtExpressionDataTreeIterator
virtual ~avtExpressionDataTreeIterator();
protected:
std::string currentDomainsLabel;
int currentDomainsIndex;
virtual vtkDataSet *ExecuteData(vtkDataSet *, int, std::string);
virtual vtkDataArray *DeriveVariable(vtkDataSet *) = 0;
virtual vtkDataArray *DeriveVariable(vtkDataSet *, int currentDomainsIndex) = 0;
};
#endif
......@@ -84,7 +84,7 @@ class EXPRESSION_API avtSingleInputExpressionFilter
virtual int NumVariableArguments() { return 1; }
protected:
virtual vtkDataArray *DeriveVariable(vtkDataSet *) = 0;
virtual vtkDataArray *DeriveVariable(vtkDataSet *, int currentDomainsIndex) = 0;
};
#endif
......@@ -154,7 +154,7 @@ avtUnaryMathExpression::~avtUnaryMathExpression()
// ****************************************************************************
vtkDataArray *
avtUnaryMathExpression::DeriveVariable(vtkDataSet *in_ds)
avtUnaryMathExpression::DeriveVariable(vtkDataSet *in_ds, int currentDomainsIndex)
{
int i;
......
......@@ -96,7 +96,7 @@ class EXPRESSION_API avtUnaryMathExpression : public avtSingleInputExpressionFil
virtual bool NullInputIsExpected(void) { return false; };
protected:
virtual vtkDataArray *DeriveVariable(vtkDataSet *);
virtual vtkDataArray *DeriveVariable(vtkDataSet *, int currentDomainsIndex);
virtual void DoOperation(vtkDataArray *in, vtkDataArray *out,
int ncomponents, int ntuples) = 0;
virtual vtkDataArray *CreateArray(vtkDataArray *);
......
......@@ -164,6 +164,7 @@ General/avtNormalizeExpression.C
General/avtPerMaterialValueExpression.C
General/avtPerformColorTableLookupExpression.C
General/avtProcessorIdExpression.C
General/avtThreadIdExpression.C
General/avtRandomExpression.C
General/avtRecenterExpression.C
General/avtRectilinearLaplacianExpression.C
......
......@@ -120,7 +120,7 @@ avtConditionalExpression::~avtConditionalExpression()
// ****************************************************************************
vtkDataArray *
avtConditionalExpression::DeriveVariable(vtkDataSet *in_ds)
avtConditionalExpression::DeriveVariable(vtkDataSet *in_ds, int currentDomainsIndex)
{
// Our first operand is in the active variable. We don't know if it's
// point data or cell data, so check which one is non-NULL.
......
......@@ -82,7 +82,7 @@ class EXPRESSION_API avtConditionalExpression
virtual int NumVariableArguments() { return 3; }
protected:
virtual vtkDataArray *DeriveVariable(vtkDataSet *);
virtual vtkDataArray *DeriveVariable(vtkDataSet *, int currentDomainsIndex);
virtual bool FilterUnderstandsTransformedRectMesh();
};
......
......@@ -111,7 +111,7 @@ avtCurvatureExpression::~avtCurvatureExpression()
// ****************************************************************************
vtkDataArray *
avtCurvatureExpression::DeriveVariable(vtkDataSet *in_ds)
avtCurvatureExpression::DeriveVariable(vtkDataSet *in_ds, int currentDomainsIndex)
{
if (in_ds->GetDataObjectType() != VTK_POLY_DATA)
{
......
......@@ -73,7 +73,7 @@ class EXPRESSION_API avtCurvatureExpression
protected:
bool doGauss;
virtual vtkDataArray *DeriveVariable(vtkDataSet *);
virtual vtkDataArray *DeriveVariable(vtkDataSet *, int currentDomainsIndex);
virtual bool IsPointVariable(void) { return true; };
virtual int GetVariableDimension(void) { return 1; };
};
......
......@@ -95,7 +95,7 @@ avtDisplacementExpression::~avtDisplacementExpression()
// ****************************************************************************
vtkDataArray *
avtDisplacementExpression::DeriveVariable (vtkDataSet *in_ds)
avtDisplacementExpression::DeriveVariable (vtkDataSet *in_ds, int currentDomainsIndex)
{
char msg[1024];
double vals[3];
......
......@@ -70,7 +70,7 @@ class EXPRESSION_API avtDisplacementExpression
virtual int NumVariableArguments() { return 2; }
protected:
virtual vtkDataArray *DeriveVariable(vtkDataSet *in);
virtual vtkDataArray *DeriveVariable(vtkDataSet *in, int currentDomainsIndex);
virtual avtVarType GetVariableType(void) { return AVT_VECTOR_VAR; };
virtual int GetNumberOfComponentsInOutput(int ncompsIn1,
int ncompsIn2)
......
......@@ -111,7 +111,7 @@ avtLocalizedCompactnessExpression::~avtLocalizedCompactnessExpression()
// ****************************************************************************
vtkDataArray *
avtLocalizedCompactnessExpression::DeriveVariable(vtkDataSet *in_ds)
avtLocalizedCompactnessExpression::DeriveVariable(vtkDataSet *in_ds, int currentDomainsIndex)
{
int i, j, k, ii, jj, kk;
......
......@@ -83,7 +83,7 @@ class EXPRESSION_API avtLocalizedCompactnessExpression
{return "Calculating localized compactness"; };
protected:
virtual vtkDataArray *DeriveVariable(vtkDataSet *);
virtual vtkDataArray *DeriveVariable(vtkDataSet *, int currentDomainsIndex);
virtual bool IsPointVariable(void) { return true; };
virtual int GetVariableDimension(void) { return 1; };
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment