Skip to content

Commit

Permalink
- compiles, build pysgpp for base correctly and runs unittests for ba…
Browse files Browse the repository at this point in the history
…se correctly

- the unittests for base still fail, the imports for the unittests don't yet work

git-svn-id: https://ipvs.informatik.uni-stuttgart.de/SGpp/repos/branches/SGppCodingDays@4067 4eea3252-f0fb-4393-894d-40516dce545b
  • Loading branch information
David Pfander committed Jan 28, 2015
1 parent 4dadb59 commit b76040f
Show file tree
Hide file tree
Showing 109 changed files with 378 additions and 4,073 deletions.
20 changes: 11 additions & 9 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export LIBPATH=$LD_LIBRARY_PATH
---------------------------------------------------------------------
Parameters are:
""" +
""" +
vars.GenerateHelpText(env))

# adds trailing slashes were required and if not present
Expand Down Expand Up @@ -179,22 +179,24 @@ if not env['NO_UNIT_TESTS'] and env['SG_PYTHON']:

moduleTest = env.Test(os.path.join("#", moduleFolder, 'tests', 'test_%s.py' % moduleFolder))
moduleSharedLibFile = os.path.join("#", PYSGPP_BUILD_PATH, moduleFolder, "_%s.so" % moduleFolder)
env.Requires(moduleTest, moduleSharedLibFile)
#env.Requires(moduleTest, moduleSharedLibFile)
env.Requires(moduleTest, installTargetList)

# run minimal test after compilation
pysgppSimpleImportTest = env.SimpleTest(os.path.join('#', moduleFolder, 'tests', 'test_import.py'))
env.Requires(pysgppSimpleImportTest, moduleSharedLibFile)
env.Requires(pysgppSimpleImportTest, installTargetList)
env.Requires(pysgppSimpleImportTest, libraryTargetList)
env.AlwaysBuild(pysgppSimpleImportTest)
env.Depends(moduleTest, pysgppSimpleImportTest)
# pysgppSimpleImportTest = env.SimpleTest(os.path.join('#', moduleFolder, 'tests', 'test_import.py'))
# env.Requires(pysgppSimpleImportTest, moduleSharedLibFile)
# env.Requires(pysgppSimpleImportTest, installTargetList)
# env.Requires(pysgppSimpleImportTest, libraryTargetList)
# env.AlwaysBuild(pysgppSimpleImportTest)
# env.Depends(moduleTest, pysgppSimpleImportTest)

env.AlwaysBuild(moduleTest)
if dependency is None:
dependency = moduleTest
else:
env.Depends(moduleTest, dependency)
dependency = moduleTest

pysgppTestTargets.append(moduleTest)
else:
print "Warning: Skipping python unit tests"
Expand Down
21 changes: 13 additions & 8 deletions base/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ libStatic = env.StaticLibrary(target="sgpp%sstatic" % moduleName,
libStaticInstall = env.Install(BUILD_DIR, libStatic)
env.Depends(libInstall, libStaticInstall)

Import('libraryTargetList')
Import('installTargetList')

if env['SG_PYTHON']:
py_env = env.Clone()

Expand All @@ -45,19 +48,21 @@ if env['SG_PYTHON']:
py_env.AppendUnique(SWIGFLAGS=['-c++', '-python'] + \
['-D' + c for c in py_env['CPPDEFINES']],
CPPPATH=['#/%s' % moduleName])
py_env.SharedLibrary(target=os.path.join('#', PYSGPP_BUILD_PATH, moduleName),
source= [os.path.join("build", "pysgpp", "%s.i" % moduleName)],
libPython = py_env.SharedLibrary(target="base",
source= [os.path.join("build", "pysgpp", moduleName + ".i")],
SHLIBPREFIX='_',
CPPFLAGS=['--std=c++11', '-Wno-cast-qual'],
LIBPATH = [BUILD_DIR],
LIBS=['sgppbase'])
libInstallPython = py_env.Install(os.path.join('#', PYSGPP_BUILD_PATH), os.path.join("build", "pysgpp", "%s.py" % moduleName))

Import('libraryTargetList')
Import('installTargetList')

packageInit = File(os.path.join("build", "pysgpp", '__init__.py'))
installPackageInit = py_env.Install(os.path.join('#', PYSGPP_BUILD_PATH), packageInit)
installLibPython = py_env.Install(os.path.join('#', PYSGPP_BUILD_PATH), libPython)
installLibWrapperPython = py_env.Install(os.path.join('#', PYSGPP_BUILD_PATH), os.path.join("build/pysgpp/", moduleName + ".py"))
py_env.Depends(installLibPython, installLibWrapperPython)
py_env.Depends(installLibPython, installPackageInit)
installTargetList.append(installLibPython)

libraryTargetList.append(lib)
installTargetList.append(libInstall)

if env['SG_PYTHON']:
installTargetList.append(libInstallPython)
Empty file added base/build/pysgpp/__init__.py
Empty file.
87 changes: 0 additions & 87 deletions base/examples/Copy of python_simple.py

This file was deleted.

2 changes: 1 addition & 1 deletion base/examples/python_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sys
# append trunk/bin to search path for modules
sys.path.append('../lib/pysgpp')
from pysgpp import DataVector, Grid, createOperationHierarchisation, createOperationEval
from pysgpp.base import DataVector, Grid, createOperationHierarchisation, createOperationEval

# create a two-dimensional piecewise bi-linear grid
dim = 2
Expand Down
2 changes: 1 addition & 1 deletion base/examples/python_simple_quadrature.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sys
# append trunk/bin to search path for modules
sys.path.append('../lib/pysgpp')
from pysgpp import *
from pysgpp.base import *

# the standard parabola (arbitrary-dimensional)
def f(x):
Expand Down
2 changes: 1 addition & 1 deletion base/examples/python_simple_refinement.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sys
# append trunk/bin to search path for modules
sys.path.append('../lib/pysgpp')
from pysgpp import *
from pysgpp.base import *

# create a two-dimensional piecewise bi-linear grid
dim = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace base {

HashGridStorage::HashGridStorage(size_t dim) :
// GridStorage(dim),
list(), map(), algoDims()
list(), map(), algoDims(), DIM(dim)
{
for (size_t i = 0; i < DIM; i++) {
algoDims.push_back(i);
Expand Down
2 changes: 1 addition & 1 deletion base/tests/algorithm/test_AlgorithmEvaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import unittest
import math
import random
from pysgpp import Grid, DataVector, DataMatrix, DimensionBoundary, BoundingBox
from pysgpp.base import Grid, DataVector, DataMatrix, DimensionBoundary, BoundingBox

class TestAlgorithmEvaluation(unittest.TestCase):

Expand Down
2 changes: 1 addition & 1 deletion base/tests/algorithm/test_AlgorithmMultipleEval.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import unittest
import math
import random
from pysgpp import Grid, DataVector, DataMatrix, DimensionBoundary, BoundingBox, createOperationMultipleEval
from pysgpp.base import Grid, DataVector, DataMatrix, DimensionBoundary, BoundingBox, createOperationMultipleEval

class TestAlgorithmMultipleEval(unittest.TestCase):

Expand Down
2 changes: 1 addition & 1 deletion base/tests/online-pred-ref-dim/automatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import numpy
import collections

from pysgpp import Grid, DataVector, DataMatrix, OnlinePredictiveRefinementDimension, HashRefinement, refinement_map, createOperationMultipleEval, GridIndex, PredictiveRefinementDimensionIndicator
from pysgpp.base import Grid, DataVector, DataMatrix, OnlinePredictiveRefinementDimension, HashRefinement, refinement_map, createOperationMultipleEval, GridIndex, PredictiveRefinementDimensionIndicator

class TestOnlinePredictiveRefinementDimension(unittest.TestCase):

Expand Down
2 changes: 1 addition & 1 deletion base/tests/online-pred-ref-dim/manual.boundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import random
import numpy

from pysgpp import Grid, DataVector, DataMatrix, OnlinePredictiveRefinementDimension, HashRefinement, refinement_map, createOperationMultipleEval, GridIndex
from pysgpp.base import Grid, DataVector, DataMatrix, OnlinePredictiveRefinementDimension, HashRefinement, refinement_map, createOperationMultipleEval, GridIndex

class TestOnlinePredictiveRefinementDimension(unittest.TestCase):

Expand Down
2 changes: 1 addition & 1 deletion base/tests/online-pred-ref-dim/manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import random
import numpy

from pysgpp import Grid, DataVector, DataMatrix, OnlinePredictiveRefinementDimension, HashRefinement, refinement_map, createOperationMultipleEval, GridIndex
from pysgpp.base import Grid, DataVector, DataMatrix, OnlinePredictiveRefinementDimension, HashRefinement, refinement_map, createOperationMultipleEval, GridIndex

class TestOnlinePredictiveRefinementDimension(unittest.TestCase):

Expand Down
2 changes: 1 addition & 1 deletion base/tests/online-pred-ref-dim/single.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import random
import numpy

from pysgpp import Grid, DataVector, DataMatrix, OnlinePredictiveRefinementDimension, HashRefinement, refinement_map, createOperationMultipleEval, GridIndex
from pysgpp.base import Grid, DataVector, DataMatrix, OnlinePredictiveRefinementDimension, HashRefinement, refinement_map, createOperationMultipleEval, GridIndex

print "Expected:"
print "(1, 0): 4.04"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import unittest
import math
import random
from pysgpp import Grid, DataVector, DataMatrix, PersistentErrorRefinementFunctor
from pysgpp.base import Grid, DataVector, DataMatrix, PersistentErrorRefinementFunctor

BETA = 0.1
DIM = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import unittest
import math
import random
from pysgpp import Grid, DataVector, DataMatrix, WeightedErrorRefinementFunctor
from pysgpp.base import Grid, DataVector, DataMatrix, WeightedErrorRefinementFunctor

class TestWeightedRefinementOperator(unittest.TestCase):

Expand Down
2 changes: 1 addition & 1 deletion base/tests/refinement-strategy/python_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# append trunk/bin to search path for modules
#sys.path.append('../lib/pysgpp')
print(sys.path)
from pysgpp import DataVector, Grid, createOperationHierarchisation, createOperationEval
from pysgpp.base import DataVector, Grid, createOperationHierarchisation, createOperationEval
import matplotlib.pyplot as plotter
import numpy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sys
# append trunk/bin to search path for modules
sys.path.append('../lib/pysgpp')
from pysgpp import *
from pysgpp.base import *
import matplotlib.pyplot as plotter

# create a two-dimensional piecewise bi-linear grid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import math
# append trunk/bin to search path for modules
sys.path.append('../lib/pysgpp')
from pysgpp import *
from pysgpp.base import *
import matplotlib.pyplot as plotter
from mpl_toolkits.mplot3d import Axes3D

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import math
# append trunk/bin to search path for modules
sys.path.append('../lib/pysgpp')
from pysgpp import *
from pysgpp.base import *
import matplotlib.pyplot as plotter
from mpl_toolkits.mplot3d import Axes3D

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import math
# append trunk/bin to search path for modules
sys.path.append('../lib/pysgpp')
from pysgpp import *
from pysgpp.base import *
import matplotlib.pyplot as plotter
from mpl_toolkits.mplot3d import Axes3D
from numpy import random
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import math
# append trunk/bin to search path for modules
sys.path.append('../lib/pysgpp')
from pysgpp import *
from pysgpp.base import *
import matplotlib.pyplot as plotter
from mpl_toolkits.mplot3d import Axes3D

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import math
# append trunk/bin to search path for modules
sys.path.append('../lib/pysgpp')
from pysgpp import *
from pysgpp.base import *
import matplotlib.pyplot as plotter
from mpl_toolkits.mplot3d import Axes3D
from numpy import random
Expand Down
2 changes: 1 addition & 1 deletion base/tests/refinement-strategy/python_simple_quadrature.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sys
# append trunk/bin to search path for modules
sys.path.append('../lib/pysgpp')
from pysgpp import *
from pysgpp.base import *

# the standard parabola (arbitrary-dimensional)
def f(x):
Expand Down
2 changes: 1 addition & 1 deletion base/tests/refinement-strategy/python_simple_refinement.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sys
# append trunk/bin to search path for modules
sys.path.append('../lib/pysgpp')
from pysgpp import *
from pysgpp.base import *
import matplotlib.pyplot as plotter
from mpl_toolkits.mplot3d import Axes3D
import math
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sys
# append trunk/bin to search path for modules
sys.path.append('../lib/pysgpp')
from pysgpp import *
from pysgpp.base import *
import matplotlib.pyplot as plotter
from mpl_toolkits.mplot3d import Axes3D
import math
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from Crypto.Util.number import size
# append trunk/bin to search path for modules
sys.path.append('../lib/pysgpp')
from pysgpp import *
from pysgpp.base import *
import matplotlib.pyplot as plotter
import numpy
import csv
Expand Down
2 changes: 1 addition & 1 deletion base/tests/refinement-strategy/test_ANOVARefinement.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# sgpp.sparsegrids.org

import unittest
from pysgpp import Grid, HashRefinement, GridIndex, \
from pysgpp.base import Grid, HashRefinement, GridIndex, \
SurplusRefinementFunctor, DataVector, SurplusVolumeRefinementFunctor,\
ANOVARefinement

Expand Down
2 changes: 1 addition & 1 deletion base/tests/refinement-strategy/test_GSGRefinement.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# sgpp.sparsegrids.org

import unittest
from pysgpp import Grid, HashRefinement, GridIndex, \
from pysgpp.base import Grid, HashRefinement, GridIndex, \
SurplusRefinementFunctor, DataVector, SurplusVolumeRefinementFunctor,\
GSGRefinement, HashCoarsening, SurplusCoarseningFunctor

Expand Down
Loading

0 comments on commit b76040f

Please sign in to comment.