Skip to content

Commit

Permalink
- merged with trunk
Browse files Browse the repository at this point in the history
- first compiling version of OCL streaming with demo application

git-svn-id: https://ipvs.informatik.uni-stuttgart.de/SGpp/repos/branches/SGppAutoTune@4220 4eea3252-f0fb-4393-894d-40516dce545b
  • Loading branch information
David Pfander committed Mar 12, 2015
2 parents 1e93158 + 60020d6 commit 455c422
Show file tree
Hide file tree
Showing 263 changed files with 5,939 additions and 2,967 deletions.
42 changes: 9 additions & 33 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ EnsurePythonVersion(2, 7)
EnsureSConsVersion(2, 0)
print "Using SCons", SCons.__version__

ignoreFolders = ['tests', 'jsgpp'] #, 'pysgpp'
# to ignore folders containing a SConscript file, do the following:
# ignoreFolders = ["jsgpp"]
ignoreFolders = []

# find all modules
moduleFolders, languageSupport = getModules(ignoreFolders)
Expand Down Expand Up @@ -66,23 +68,7 @@ vars.Add(BoolVariable('VERBOSE', 'Set output verbosity', False))
vars.Add('CMD_LOGFILE', 'Specifies a file to capture the build log', 'build.log')

# initialize environment
# print "ARGUMENTS:", ARGUMENTS
# allDefines = ''
# for key, value in ARGLIST:
# if key == 'CPPDEFINES':
# allDefines = value
# allDefines = allDefines.split(" ")
# print allDefines
# allDefinesMap = {}
# for define in allDefines:
# splitted = define.split("=")
# allDefinesMap[splitted[0]] = splitted[1]
# print allDefinesMap

#env = Environment(variables=vars, ENV=os.environ, CPPDEFINES = allDefines)
env = Environment(variables=vars)
# for key, value in os.environ.iteritems():
# env[key] = value
env = Environment(variables=vars, ENV=os.environ)
if 'CXX' in ARGUMENTS:
env['CXX'] = ARGUMENTS['CXX']
if 'CC' in ARGUMENTS:
Expand Down Expand Up @@ -130,12 +116,10 @@ vars.GenerateHelpText(env))
# adds trailing slashes were required and if not present
BUILD_DIR = Dir(os.path.join(env['OUTPUT_PATH'], 'lib', 'sgpp'))
Export('BUILD_DIR')
PYSGPP_BUILD_PATH = os.path.join(env['OUTPUT_PATH'], 'lib', 'pysgpp')
PYSGPP_BUILD_PATH = Dir(os.path.join(env['OUTPUT_PATH'], 'lib', 'pysgpp'))
Export('PYSGPP_BUILD_PATH')
PYSGPP_BUILD_DIR = Dir(PYSGPP_BUILD_PATH)
Export('PYSGPP_BUILD_DIR')
JAVASGPP_BUILD_DIR = Dir(os.path.join(env['OUTPUT_PATH'], 'lib', 'jsgpp'))
Export('JAVASGPP_BUILD_DIR')
JSGPP_BUILD_PATH = Dir(os.path.join(env['OUTPUT_PATH'], 'lib', 'jsgpp'))
Export('JSGPP_BUILD_PATH')
EXAMPLE_DIR = Dir(os.path.join(env['OUTPUT_PATH'], 'bin', 'examples'))
Export('EXAMPLE_DIR')

Expand Down Expand Up @@ -188,19 +172,11 @@ for moduleFolder in moduleFolders:
env.SConscript('#/' + moduleFolder + '/SConscript', {'env': env, 'moduleName': moduleFolder})

if env['SG_PYTHON']:
env.SConscript('#/pysgpp/SConscript', {'env': env, 'moduleName': moduleFolder})
env.SConscript('#/pysgpp/SConscript', {'env': env, 'moduleName': "pysgpp"})

#TODO: ask julian
if env['SG_JAVA']:
env.SConscript('#/jsgpp/SConscript', {'env': env, 'moduleName': moduleFolder})

# build java lib
if env['SG_JAVA']:
libjsgpp = env.SConscript('#/jsgpp/SConscript',
variant_dir='tmp/build_jsgpp', duplicate=0)
# install
jinst = env.Install(os.path.join(env['OUTPUT_PATH'], 'lib', 'jsgpp'),
[libjsgpp])
env.SConscript('#/jsgpp/SConscript', {'env': env, 'moduleName': "jsgpp"})

# Unit tests
#########################################################################
Expand Down
111 changes: 111 additions & 0 deletions base/build/jsgpp/GridFactory.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// Copyright (C) 2008-today The SG++ project
// This file is part of the SG++ project. For conditions of distribution and
// use, please see the copyright notice provided with SG++ or at
// sgpp.sparsegrids.org

%include "std_string.i"

%newobject SGPP::base::Grid::createLinearGrid(size_t dim);
%newobject SGPP::base::Grid::createLinearStretchedGrid(size_t dim);
%newobject SGPP::base::Grid::createLinearBoundaryGrid(size_t dim);
%newobject SGPP::base::Grid::createLinearClenshawCurtisGrid(size_t dim);
%newobject SGPP::base::Grid::createLinearTruncatedBoundaryGrid(size_t dim);
%newobject SGPP::base::Grid::createLinearTruncatedBoundaryGrid(SGPP::base::BoudingBox& BB);
%newobject SGPP::base::Grid::createLinearStretchedTruncatedBoundaryGrid(size_t dim);
%newobject SGPP::base::Grid::createLinearStretchedTruncatedBoundaryGrid(SGPP::base::Stretching& BB);
%newobject SGPP::base::Grid::createModLinearGrid(size_t dim);
%newobject SGPP::base::Grid::createPolyGrid(size_t dim, size_t degree);
%newobject SGPP::base::Grid::createModPolyGrid(size_t dim, size_t degree);
%newobject SGPP::base::Grid::createWaveletGrid(size_t dim);
%newobject SGPP::base::Grid::createWaveletTruncatedBoundaryGrid(size_t dim);
%newobject SGPP::base::Grid::createModWaveletGrid(size_t dim);
%newobject SGPP::base::Grid::createBsplineGrid(size_t dim, size_t degree);
%newobject SGPP::base::Grid::createBsplineTruncatedBoundaryGrid(size_t dim, size_t degree);
%newobject SGPP::base::Grid::createBsplineClenshawCurtisGrid(size_t dim, size_t degree);
%newobject SGPP::base::Grid::createModBsplineGrid(size_t dim, size_t degree);
%newobject SGPP::base::Grid::createLinearGeneralizedTruncatedBoundaryGrid(size_t dim);
%newobject SGPP::base::Grid::createSquareRootGrid(size_t dim);
%newobject SGPP::base::Grid::createPrewaveletGrid(size_t dim);
%newobject SGPP::base::Grid::createPeriodicGrid(size_t dim);

%newobject SGPP::base::Grid::unserialize(std::string& istr);

%newobject SGPP::base::Grid::createGridGenerator();

%include "stl.i"
%include "typemaps.i"

//%apply std::string *OUTPUT { std::string& ostr };
//%apply std::string *INPUT { std::string& istr };


using namespace SGPP;
namespace SGPP
{
namespace base
{

class Grid
{
public:
static Grid* createLinearGrid(size_t dim);
static Grid* createLinearStretchedGrid(size_t dim);
static Grid* createLinearBoundaryGrid(size_t dim);
static Grid* createLinearClenshawCurtisGrid(size_t dim);
static Grid* createLinearTruncatedBoundaryGrid(size_t dim);
static Grid* createLinearStretchedTruncatedBoundaryGrid(size_t dim);
static Grid* createModLinearGrid(size_t dim);
static Grid* createPolyGrid(size_t dim, size_t degree);
static Grid* createModPolyGrid(size_t dim, size_t degree);
static Grid* createWaveletGrid(size_t dim);
static Grid* createWaveletTruncatedBoundaryGrid(size_t dim);
static Grid* createModWaveletGrid(size_t dim);
static Grid* createBsplineGrid(size_t dim, size_t degree);
static Grid* createBsplineTruncatedBoundaryGrid(size_t dim, size_t degree);
static Grid* createBsplineClenshawCurtisGrid(size_t dim, size_t degree);
static Grid* createModBsplineGrid(size_t dim, size_t degree);
static Grid* createSquareRootGrid(size_t dim);
static Grid* createLinearGeneralizedTruncatedBoundaryGrid(size_t dim);
static Grid* createPrewaveletGrid(size_t dim);
static Grid* createLinearGridStencil(size_t dim);
static Grid* createModLinearGridStencil(size_t dim);
static Grid* createPeriodicGrid(size_t dim);

static Grid* unserialize(std::string& istr);

protected:
Grid();
Grid(Grid& o);

public:
virtual ~Grid();

public:
virtual SGPP::base::GridGenerator* createGridGenerator() = 0;
virtual SGPP::base::GridStorage* getStorage();
virtual SGPP::base::BoundingBox* getBoundingBox();
virtual SGPP::base::Stretching* getStretching();

virtual const char* getType() = 0;
virtual const SBasis& getBasis() = 0;
virtual void serialize(std::string& ostr);
void refine(SGPP::base::DataVector* vector, int num);
float_t eval(SGPP::base::DataVector& alpha, SGPP::base::DataVector& point);
void insertPoint(size_t dim, unsigned int levels[], unsigned int indeces[], bool isLeaf);
int getSize();
};
}
}

//these are just two new interfaces for consistency with Memento design pattern
%extend SGPP::base::Grid{
SGPP::base::Grid* createMemento(){
return $self;
}

static SGPP::base::Grid* setMemento(std::string& istr){
return SGPP::base::Grid::unserialize(istr);
}
};


124 changes: 124 additions & 0 deletions base/build/jsgpp/Operations.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
// Copyright (C) 2008-today The SG++ project
// This file is part of the SG++ project. For conditions of distribution and
// use, please see the copyright notice provided with SG++ or at
// sgpp.sparsegrids.org

namespace SGPP
{
namespace base
{

class RefinementFunctor
{
public:
typedef float_t value_type;

virtual float_t operator()(SGPP::base::GridStorage* storage, size_t seq) = 0;
virtual float_t start() = 0;
};

class CoarseningFunctor
{
public:
typedef float_t value_type;

virtual float_t operator()(SGPP::base::GridStorage* storage, size_t seq) = 0;
virtual float_t start() = 0;
};

class GridGenerator
{
public:
virtual void regular(size_t level) = 0;
virtual void cliques(int level, size_t clique_size) = 0;
virtual void full(size_t level) = 0;
virtual void truncated(size_t level,size_t l_user) = 0;
virtual void refine(SGPP::base::RefinementFunctor* func) = 0;
virtual void coarsen(SGPP::base::CoarseningFunctor* func, SGPP::base::DataVector* alpha) = 0;
virtual void coarsenNFirstOnly(SGPP::base::CoarseningFunctor* func, SGPP::base::DataVector* alpha, size_t numFirstOnly) = 0;
virtual int getNumberOfRefinablePoints() = 0;
virtual int getNumberOfRemovablePoints() = 0;
virtual void refineMaxLevel(SGPP::base::RefinementFunctor* func, unsigned int maxLevel) = 0;
virtual int getNumberOfRefinablePointsToMaxLevel(unsigned int maxLevel) = 0;
};

class OperationMultipleEval
{
public:
virtual void mult(SGPP::base::DataVector& alpha, SGPP::base::DataVector& result) = 0;
virtual void multTranspose(SGPP::base::DataVector& soruce, SGPP::base::DataVector& result) = 0;
};

class OperationMatrix
{
public:
virtual void mult(SGPP::base::DataVector& alpha, SGPP::base::DataVector& result) = 0;
};*/
/*
class OperationConvert
{
public:
virtual void doConvertToLinear(SGPP::base::DataVector& alpha) = 0;
virtual void doConvertFromLinear(SGPP::base::DataVector& alpha) = 0;
};
class OperationEval
{
public:
virtual float_t eval(SGPP::base::DataVector& alpha, SGPP::base::DataVector& point) = 0;
};
class OperationNaiveEval
{
public:
virtual float_t eval(SGPP::base::DataVector& alpha, SGPP::base::DataVector& point) = 0;
};
class OperationNaiveEvalGradient
{
public:
virtual float_t eval(SGPP::base::DataVector& alpha, SGPP::base::DataVector& point, SGPP::base::DataVector& gradient) = 0;
};
class OperationNaiveEvalHessian
{
public:
virtual float_t eval(SGPP::base::DataVector& alpha, SGPP::base::DataVector& point, SGPP::base::DataVector& gradient, SGPP::base::DataMatrix& hessian) = 0;
};
class OperationNaiveEvalPartialDerivative
{
public:
virtual float_t eval(SGPP::base::DataVector& alpha, SGPP::base::DataVector& point, size_t deriv_dim) = 0;
};
class OperationHierarchisation
{
public:
virtual void doHierarchisation(SGPP::base::DataVector& node_values) = 0;
virtual void doDehierarchisation(SGPP::base::DataVector& alpha) = 0;
};
class OperationQuadrature
{
public:
virtual float_t doQuadrature(SGPP::base::DataVector& alpha) = 0;
};
}
//- namespace parallel --------------------------------------------
/*namespace parallel {
class OperationMultipleEvalVectorized
{
public:
virtual double multVectorized(sg::base::DataVector& alpha, sg::base::DataVector& result) = 0;
virtual double multTransposeVectorized(sg::base::DataVector& source, sg::base::DataVector& result) = 0;
virtual void rebuildLevelAndIndex() = 0;
};
}*/
//- end namespace parallel --------------------------------------------

}
Loading

0 comments on commit 455c422

Please sign in to comment.