Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into AutoTune
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Baur committed Feb 9, 2016
2 parents ff6599b + ecab811 commit 0b504ad
Show file tree
Hide file tree
Showing 66 changed files with 2,995 additions and 1,760 deletions.
2,381 changes: 1,447 additions & 934 deletions Doxyfile_template

Large diffs are not rendered by default.

26 changes: 20 additions & 6 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ env['LIBDIR'] = env.get( 'LIBDIR', os.path.join( env['EPREFIX'], "lib" ) )
env['INCLUDEDIR'] = env.get( 'INCLUDEDIR', os.path.join( env['PREFIX'], "include" ) )

# no docu if clean:
if not env.GetOption('clean'):
if not env['PYDOC'] and not env.GetOption('clean'):
prepareDoxyfile(moduleFolders)

if 'CXX' in ARGUMENTS:
Expand Down Expand Up @@ -179,12 +179,9 @@ if env['PLATFORM'] == 'win32':
env.Append(LIBPATH=[BUILD_DIR])

# # add C++ defines for all modules
cppdefines = []
for module in moduleNames:
if env[module]:
env['CPPDEFINES'][module] = '1'
# cppdefines.append(module)
# env.Append(CPPDEFINES=cppdefines)

# environement setup finished, export environment
Export('env')
Expand Down Expand Up @@ -224,16 +221,24 @@ if env['COMPILE_BOOST_TESTS']:
builder = Builder(action="./$SOURCE --log_level=test_suite")
env.Append(BUILDERS={'BoostTest' : builder})



libraryTargetList = []
installTargetList = []
testTargetList = []
boostTestTargetList = []
exampleTargetList = []
pydocTargetList = []
headerSourceList = []
headerDestList = []
env.Export('libraryTargetList')
env.Export('installTargetList')
env.Export('testTargetList')
env.Export('boostTestTargetList')
env.Export('exampleTargetList')
env.Export('pydocTargetList')
env.Export('headerSourceList')
env.Export('headerDestList')

# compile selected modules
flattenedDependencyGraph = []
Expand All @@ -252,7 +257,7 @@ for moduleFolder in moduleFolders:

Export('flattenedDependencyGraph')

if env['PYDOC'] and env['SG_PYTHON']:
if env['PYDOC'] and env['SG_PYTHON'] and not env.GetOption('clean'):
with open('moduleDoxy', 'r') as template:
data = template.read()
for module in moduleFolders:
Expand Down Expand Up @@ -391,10 +396,19 @@ dependencies.append(env.Command('printFinished', [], printFinished))
for i in range(len(dependencies) - 1):
env.Depends(dependencies[i + 1], dependencies[i])

# Stuff needed for system install
env.Clean("distclean",
[
"config.log",
])
Default(libraryTargetList, dependencies)

env.Alias('install-lib-sgpp', Install(os.path.join( env.get('LIBDIR'), 'sgpp'), libraryTargetList))
ils = env.Alias('install-lib-sgpp', Install(os.path.join( env.get('LIBDIR'), 'sgpp'), libraryTargetList))

headerFinalDestList = []
for headerDest in headerDestList:
headerFinalDestList.append(os.path.join( env.get('INCLUDEDIR'), headerDest))

iis = env.Alias('install-inc-sgpp', InstallAs(headerFinalDestList, headerSourceList))

env.Alias('install', [ils, iis])
7 changes: 6 additions & 1 deletion base/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Import('moduleName')
Import('libraryTargetList')
Import('installTargetList')
Import('exampleTargetList')
Import('headerSourceList')
Import('headerDestList')

moduleDependencies = []
Export('moduleDependencies')
Expand All @@ -36,7 +38,10 @@ for currentFolder, subdirNames, fileNames in os.walk("src", topdown=True):
for fileName in fnmatch.filter(fileNames, '*.cpp'):
sourceFile = os.path.join(currentFolder, fileName)
objs.append(env.SharedObject(sourceFile))

if currentFolder != 'src':
for fileName in fnmatch.filter(fileNames, '*.hpp'):
headerSourceList.append(os.path.join(moduleName, currentFolder, fileName))
headerDestList.append(os.path.join(currentFolder, fileName).split(os.sep,1)[1])

libname = "sgpp%s" % moduleName
if env['USE_STATICLIB']:
Expand Down
6 changes: 6 additions & 0 deletions base/examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/JSONTest
/platformConfigurationTest
/predictive_refinement
/quadrature
/refinement
/tutorial
4 changes: 2 additions & 2 deletions base/src/sgpp/base/grid/Grid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ struct RegularGridConfiguration {
/// number of levels
int level_;
/// max. polynomial degree for poly basis
size_t maxDegree;
size_t maxDegree_;
/// level of boundary grid
size_t boundaryLevel;
size_t boundaryLevel_;
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ size_t HashRefinementBoundaries::getNumberOfRefinablePoints(
// if there no more grid points --> test if we should refine the grid
if (child_iter == end_iter) {
counter++;
break;
}
} else {
// left child
Expand All @@ -184,6 +185,7 @@ size_t HashRefinementBoundaries::getNumberOfRefinablePoints(
// if there no more grid points --> test if we should refine the grid
if (child_iter == end_iter) {
counter++;
break;
}

// right child
Expand All @@ -192,6 +194,7 @@ size_t HashRefinementBoundaries::getNumberOfRefinablePoints(

if (child_iter == end_iter) {
counter++;
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion base/tests/test_DataVectorSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(testMinMax) {
}

BOOST_AUTO_TEST_CASE(testOps) {
float tol = 1e-5f;
float tol = 1e-4f;

DataVectorSP d = d_rand;
DataVectorSP d2(N);
Expand Down
142 changes: 142 additions & 0 deletions base/tests/test_DirichletGridConverter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>

#include <sgpp/base/grid/common/DirichletGridConverter.hpp>

#include <sgpp/base/grid/Grid.hpp>
#include <sgpp/base/grid/type/LinearGrid.hpp>
#include <sgpp/base/grid/type/LinearStretchedGrid.hpp>
#include <sgpp/base/operation/BaseOpFactory.hpp>
#include <sgpp/base/datatypes/DataVector.hpp>

using namespace SGPP::base;


BOOST_AUTO_TEST_CASE(test_DirichletGridConverter){
/// number of the boundary grid's grid points
size_t numTotalGridPoints;
/// number of the inner grid's grid points
size_t numInnerGridPoints;
/**
* array to store the position of i-th inner point in
* the boundary grid's coefficients
*/
size_t* conCoefArray;
Grid* innerGridExact;

int level = 3;
int dimension = 2;
Grid* linearBoundaryGrid = Grid::createLinearBoundaryGrid(dimension);
GridStorage* linearBoundaryGridStorageExact = linearBoundaryGrid->getStorage();
GridGenerator* gridGen = linearBoundaryGrid->createGridGenerator();
gridGen->regular(level);

// determine the number of grid points for both grids
numTotalGridPoints = linearBoundaryGridStorageExact->size();
numInnerGridPoints = linearBoundaryGridStorageExact->getNumInnerPoints();

DataVector boundaryGridCoeffs(numTotalGridPoints);
GridIndex* gp;
for(size_t i = 0; i < numTotalGridPoints; ++i){
gp = linearBoundaryGridStorageExact->get(i);
boundaryGridCoeffs[i] =
gp->getCoord(0) * (gp->getCoord(0)) + gp->getCoord(1) * (gp->getCoord(1));
}

SGPP::op_factory::createOperationHierarchisation(*linearBoundaryGrid)->
doHierarchisation(boundaryGridCoeffs);

// allocate the translation array for the coefficients
conCoefArray = new size_t[numInnerGridPoints];

// Get the algorithmic dimensions
std::vector<size_t> BSalgoDims = linearBoundaryGrid->getAlgorithmicDimensions();

// create new inner Grid, with one grid point
innerGridExact = new LinearGrid(*(linearBoundaryGrid->getBoundingBox()));

// Set algorithmic dimensions for inner Grid
innerGridExact->setAlgorithmicDimensions(BSalgoDims);

// create new DataVector for storing the inner grid's coefficients
DataVector innerCoeffsExact(numInnerGridPoints);

// Iterate through all grid points and filter inner points
size_t numInner = 0;

for (size_t i = 0; i < numTotalGridPoints; ++i) {
GridIndex* curPoint = linearBoundaryGridStorageExact->get(i);
if (curPoint->isInnerPoint() == true) {
// handle coefficients
conCoefArray[numInner] = i;
innerCoeffsExact.set(numInner, boundaryGridCoeffs.get(i));
numInner++;
// insert point into inner grid
innerGridExact->getStorage()->insert(*curPoint);
}
}

//Test BUILD
DirichletGridConverter dirichGridConverter;
Grid* innerGridActual;
DataVector* innerCoeffsActual;
dirichGridConverter.buildInnerGridWithCoefs(
*linearBoundaryGrid, boundaryGridCoeffs, &innerGridActual, &innerCoeffsActual);

BOOST_CHECK_EQUAL(innerCoeffsActual->getSize(), innerCoeffsExact.getSize());

for(size_t i = 0; i < innerCoeffsActual->getSize(); ++i){
BOOST_CHECK_EQUAL(innerCoeffsActual->get(i), innerCoeffsExact.get(i));
}

GridIndex* curPointExact;
GridIndex* curPointActual;
int innerPointIndex = 0;
GridStorage* linearBoundaryGridStorageActual = innerGridActual->getStorage();
for(size_t i = 0; i < numTotalGridPoints; ++i){
curPointExact = linearBoundaryGridStorageExact->get(i);
if (curPointExact->isInnerPoint() == true) {
curPointActual = linearBoundaryGridStorageActual->get(innerPointIndex);
for (size_t curDim = 0; curDim < curPointExact->dim(); ++curDim){
BOOST_CHECK_EQUAL(curPointActual->getCoord(curDim), curPointExact->getCoord(curDim));
}
innerPointIndex++;
}
}

//TEST REBUILD
dirichGridConverter.rebuildInnerGridWithCoefs(
*linearBoundaryGrid, boundaryGridCoeffs, &innerGridActual, &innerCoeffsActual);

BOOST_CHECK_EQUAL(innerCoeffsActual->getSize(), innerCoeffsExact.getSize());

for(size_t i = 0; i < innerCoeffsActual->getSize(); ++i){
BOOST_CHECK_EQUAL(innerCoeffsActual->get(i), innerCoeffsExact.get(i));
}

innerPointIndex = 0;
linearBoundaryGridStorageActual = innerGridActual->getStorage();
for(size_t i = 0; i < numTotalGridPoints; ++i){
curPointExact = linearBoundaryGridStorageExact->get(i);
if (curPointExact->isInnerPoint() == true) {
curPointActual = linearBoundaryGridStorageActual->get(innerPointIndex);
for (size_t curDim = 0; curDim < curPointExact->dim(); ++curDim){
BOOST_CHECK_EQUAL(curPointActual->getCoord(curDim), curPointExact->getCoord(curDim));
}
innerPointIndex++;
}
}

//TEST calcInnerCoefs
dirichGridConverter.calcInnerCoefs(boundaryGridCoeffs, *innerCoeffsActual);
for(size_t i = 0; i < innerCoeffsActual->getSize(); ++i){
BOOST_CHECK_EQUAL(innerCoeffsActual->get(i), innerCoeffsExact.get(i));
}

//TEST updateBoundaryCoefs
DataVector boundaryGridCoeffsActual(boundaryGridCoeffs);
dirichGridConverter.updateBoundaryCoefs(boundaryGridCoeffsActual, *innerCoeffsActual);
for(size_t i = 0; i < innerCoeffsActual->getSize(); ++i){
BOOST_CHECK_EQUAL(boundaryGridCoeffsActual.get(i), boundaryGridCoeffs.get(i));
}
}
6 changes: 6 additions & 0 deletions combigrid/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Import('moduleName')
Import('libraryTargetList')
Import('installTargetList')
Import('exampleTargetList')
Import('headerSourceList')
Import('headerDestList')

#moduleDependencies = ['sgppbase']
moduleDependencies = []
Expand Down Expand Up @@ -45,6 +47,10 @@ for currentFolder, subdirNames, fileNames in os.walk("src"):
for fileName in fnmatch.filter(fileNames, '*.cpp'):
sourceFile = os.path.join(currentFolder, fileName)
objs.append(env.SharedObject(sourceFile))
if currentFolder != 'src':
for fileName in fnmatch.filter(fileNames, '*.hpp'):
headerSourceList.append(os.path.join(moduleName, currentFolder, fileName))
headerDestList.append(os.path.join(currentFolder, fileName).split(os.sep,1)[1])

if env['USE_STATICLIB']:
libsuffix = env['LIBSUFFIX']
Expand Down
6 changes: 6 additions & 0 deletions datadriven/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Import('moduleName')
Import('libraryTargetList')
Import('installTargetList')
Import('exampleTargetList')
Import('headerSourceList')
Import('headerDestList')

avxFolders = ['src/sgpp/datadriven/operation/hash/OperationMultipleEvalSubspace/', 'src/sgpp/datadriven/operation/hash/OperationMultiEvalStreaming']

Expand Down Expand Up @@ -59,6 +61,10 @@ for currentFolder, subdirNames, fileNames in os.walk("src", topdown=True):
for fileName in fnmatch.filter(fileNames, '*.cpp'):
sourceFile = os.path.join(currentFolder, fileName)
objs.append(env.SharedObject(sourceFile))
if currentFolder != 'src':
for fileName in fnmatch.filter(fileNames, '*.hpp'):
headerSourceList.append(os.path.join(moduleName, currentFolder, fileName))
headerDestList.append(os.path.join(currentFolder, fileName).split(os.sep,1)[1])


if env['USE_STATICLIB']:
Expand Down
24 changes: 24 additions & 0 deletions datadriven/examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/batchLearnerExample
/debug
/detectPlatform
/integrationTest
/kernelTuner
/kernelTunerHelper
/learnerSGDETest
/memoryTest
/multiEvalPerformance
/multiEvalPerformanceBSpline
/multModTest
/multTest
/multTestAdaptive
/multTransposeModTest
/multTransposeTest
/multTransposeTestAdaptive
/piecewiseConstantSmoothedRegressionLearner
/piecewiseSmoothingRegressor
/regressionByInterpolation
/regressionLearner
/sampler
/samplerMod
/writeScenario
/zeroCopyTest
2 changes: 1 addition & 1 deletion datadriven/examples/learnerSGDETest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int main(int argc, char** argv) {
cout << "# loading file: " << filename << endl;
SGPP::datadriven::Dataset dataset = SGPP::datadriven::ARFFTools::readARFF(
filename);
SGPP::base::DataMatrix& samples = dataset.getTrainingData();
SGPP::base::DataMatrix& samples = dataset.getData();

// configure grid
cout << "# create grid config" << endl;
Expand Down
2 changes: 1 addition & 1 deletion datadriven/examples/multTransposeTestAdaptive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int main(int argc, char** argv) {
SGPP::datadriven::ARFFTools arffTools;
SGPP::datadriven::Dataset dataset = arffTools.readARFF(fileName);

SGPP::base::DataMatrix& trainingData = dataset.getTrainingData();
SGPP::base::DataMatrix& trainingData = dataset.getData();

size_t dim = dataset.getDimension();
SGPP::base::Grid* grid = SGPP::base::Grid::createLinearGrid(dim);
Expand Down
2 changes: 1 addition & 1 deletion datadriven/examples/multiEvalPerformance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int main(int argc, char** argv) {
SGPP::datadriven::Dataset dataset = arffTools.readARFF(fileName);

//SGPP::base::DataVector *classes = dataset.getClasses();
SGPP::base::DataMatrix& trainingData = dataset.getTrainingData();
SGPP::base::DataMatrix& trainingData = dataset.getData();

// create a two-dimensional piecewise bi-linear grid
size_t dim = dataset.getDimension();
Expand Down
2 changes: 1 addition & 1 deletion datadriven/examples/multiEvalPerformanceBSpline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main(int argc, char** argv) {
SGPP::datadriven::ARFFTools arffTools;
SGPP::datadriven::Dataset dataset = arffTools.readARFF(fileName);

SGPP::base::DataMatrix& trainingData = dataset.getTrainingData();
SGPP::base::DataMatrix& trainingData = dataset.getData();

// create a two-dimensional piecewise bi-linear grid
const size_t dim = dataset.getDimension();
Expand Down
Loading

0 comments on commit 0b504ad

Please sign in to comment.