--User changes

-Add new options to EmberGenome to better help assess which variations have certain characteristics. The options are:
  --sumvars: Display the names of all regular variations which have the default behavior of summing their outputs and exit.
  --assignvars: Display the names of all regular variations which have the non-standard behavior of assigning their outputs and exit.
  --ppsumvars: Display the names of all pre/post variations which have the non-standard behavior of summing their outputs and exit.
  --ppassignvars: Display the names of all pre/post variations which have the default behavior of assigning their outputs and exit.
  --dcvars: Display the names of all variations which use direct coloring and exit.
  --parvars: Display the names of all variations which have parameters and exit.
  --nonparvars: Display the names of all variations which do not have parameters (weight only) and exit.

--Code changes
 -Make VariationList vectors have const elements since no callers should ever change them.
 -Add new function to VariationList to retrieve a const ref to the parametric variations.
 -Move some search functions out of EmberTester and into EmberCommon.h.
 -General code cleanup.
This commit is contained in:
mfeemster
2016-05-14 23:33:08 -07:00
parent 5b6c62b95d
commit 5aec58b4a2
11 changed files with 283 additions and 135 deletions

View File

@ -299,65 +299,6 @@ void TestAtomicAdd()
}
}
template <typename T>
bool SearchVar(const Variation<T>* var, vector<string>& stringVec, bool matchAll)
{
bool ret = false;
size_t i;
auto cl = var->OpenCLFuncsString() + "\n" + var->OpenCLString();
if (matchAll)
{
for (i = 0; i < stringVec.size(); i++)
{
if (cl.find(stringVec[i]) == std::string::npos)
{
break;
}
}
ret = (i == stringVec.size());
}
else
{
for (i = 0; i < stringVec.size(); i++)
{
if (cl.find(stringVec[i]) != std::string::npos)
{
ret = true;
break;
}
}
}
return ret;
}
template <typename T>
static vector<Variation<T>*> FindVarsWith(vector<string>& stringVec, bool findAll = true)
{
int index = 0;
auto vl = VariationList<T>::Instance();
vector<Variation<T>*> vec;
while (index < vl->RegSize())
{
auto regVar = vl->GetVariation(index, eVariationType::VARTYPE_REG);
if (SearchVar(regVar, stringVec, false))
{
vec.push_back(regVar->Copy());
if (!findAll)
break;
}
index++;
}
return vec;
}
bool TestVarCounts()
{
auto vlf(VariationList<float>::Instance());
@ -1306,7 +1247,8 @@ void TestVarTime()
void TestCasting()
{
vector<string> stringVec;
vector<Variation<float>*> varVec;
auto varList = VariationList<float>::Instance();
auto& vars = varList->AllVars();
stringVec.push_back("T(");
stringVec.push_back(".0f");
stringVec.push_back(".1f");
@ -1318,21 +1260,20 @@ void TestCasting()
stringVec.push_back(".7f");
stringVec.push_back(".8f");
stringVec.push_back(".9f");
varVec = FindVarsWith<float>(stringVec);
auto varVec = FindVarsWith<float>(vars, stringVec);
for (auto& it : varVec)
{
cout << "Variation " << it->Name() << " contained an improper float cast." << endl;
}
ClearVec<Variation<float>>(varVec);
}
template <typename T>
void TestOperations()
{
vector<string> stringVec;
vector<Variation<T>*> varVec;
auto varList = VariationList<T>::Instance();
auto& vars = varList->AllVars();
//stringVec.push_back("%");
//varVec = FindVarsWith<T>(Vec);
//
@ -1345,7 +1286,7 @@ void TestOperations()
//ClearVec<Variation<T>>(varVec);
stringVec.push_back("MwcNext(mwc) %");
stringVec.push_back("MwcNext(mwc)%");
varVec = FindVarsWith<T>(stringVec);
auto varVec = FindVarsWith<T>(vars, stringVec);
for (size_t i = 0; i < varVec.size(); i++)
{
@ -1353,7 +1294,6 @@ void TestOperations()
}
stringVec.clear();
ClearVec<Variation<T>>(varVec);
}
template <typename T>