Skip to content
Snippets Groups Projects
Commit 8891d02a authored by Franck Pérignon's avatar Franck Pérignon
Browse files

fix dynamic loading bug + reorg

parent bb745d01
No related branches found
No related tags found
No related merge requests found
Showing
with 107 additions and 234 deletions
../CMake
\ No newline at end of file
......@@ -63,6 +63,13 @@ endif(WITH_TESTS)
# We search for libraries Parmes depends on and
# set the compile/link conf (-I and -L opt)
#Install dir for python (default = --user)
execute_process(
COMMAND python -c "import site ; print site.USER_SITE"
OUTPUT_VARIABLE ${PROJECT_NAME}_INSTALL_DIR)
string(STRIP ${${PROJECT_NAME}_INSTALL_DIR} ${PROJECT_NAME}_INSTALL_DIR)
set(CMAKE_INSTALL_PREFIX ${${PROJECT_NAME}_INSTALL_DIR}/${PROJECT_NAME})
set(PARMES_LIBRARY_NAME parmes)
set(PACKAGE_NAME Parmes)
add_subdirectory(src)
......@@ -74,13 +81,6 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/setup.py.in)
configure_file(setup.py.in setup.py)
endif()
#Install dir for python (default = --user)
execute_process(
COMMAND python -c "import site ; print site.USER_SITE"
OUTPUT_VARIABLE ${PROJECT_NAME}_INSTALL_DIR)
string(STRIP ${${PROJECT_NAME}_INSTALL_DIR} ${PROJECT_NAME}_INSTALL_DIR)
set(CMAKE_INSTALL_PREFIX ${${PROJECT_NAME}_INSTALL_DIR})
# The file __init__.py will be generated from __init__.py.in.
if(EXISTS ${CMAKE_SOURCE_DIR}/parmepy/__init__.py.in)
message(STATUS "Generate __init__.py file ...")
......@@ -94,8 +94,10 @@ set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_BINARY_D
ADD_CUSTOM_TARGET(python-build ALL COMMAND python ${CMAKE_CURRENT_BINARY_DIR}/setup.py build config_fc --f90exec=${CMAKE_Fortran_COMPILER}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "build parmepy package")
# To install python package AND parmes library and modules
ADD_CUSTOM_TARGET(python-install COMMAND python ${CMAKE_CURRENT_BINARY_DIR}/setup.py install --user config_fc --f90exec=${CMAKE_Fortran_COMPILER}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "build/install parmepy package")
COMMAND make install
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "build/install parmepy package")
ADD_CUSTOM_TARGET(python-cleaninstall COMMAND rm -rf ${${PROJECT_NAME}_INSTALL_DIR}/${PROJECT_NAME}*
COMMENT "remove parmepy package and its dependencies")
......@@ -103,6 +105,7 @@ ADD_CUSTOM_TARGET(python-cleaninstall COMMAND rm -rf ${${PROJECT_NAME}_INSTALL_D
add_dependencies(python-build ${PARMES_LIBRARY_NAME})
add_dependencies(python-install ${PARMES_LIBRARY_NAME})
# ============= RPATH =============
# Concerning rpath see for example http://www.itk.org/Wiki/CMake_RPATH_handling
......@@ -111,7 +114,7 @@ add_dependencies(python-install ${PARMES_LIBRARY_NAME})
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# the RPATH to be used when installing
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
......
This diff is collapsed.
......@@ -4,26 +4,21 @@
Python package dedicated to flow simulation using particular methods on hybrid architectures (MPI-GPU)
"""
__version__ = 1.00
__all__ = ['Box', 'CartesianTopology', 'ScalarField']
__version__=1.00
__all__=['Box','CartesianTopology','ScalarField']
import os
import site
import mpi4py.MPI as MPI
if 'LD_LIBRARY_PATH' in os.environ:
os.environ['LD_LIBRARY_PATH'] = os.environ['LD_LIBRARY_PATH'] + ':' + "@CMAKE_INSTALL_PREFIX@"
else:
os.environ['LD_LIBRARY_PATH'] = "@CMAKE_INSTALL_PREFIX@"
rank_world = MPI.COMM_WORLD.Get_rank()
if(rank_world == 0):
print "Starting @PACKAGE_NAME@ version " + str(__version__) + ".\n"
print "Starting @PACKAGE_NAME@ version "+str(__version__)+".\n"
import constants
import domain.box
## Box-type physical domain
## Box-type physical domain
Box = domain.box.Box
## Cartesian grid
......@@ -35,23 +30,5 @@ CartesianTopology = fields.topology.CartesianTopology
## Fields
import fields.discrete
import fields.continuous
import fields.analytical
ScalarField = fields.discrete.ScalarField
ContinuousField = fields.continuous.ContinuousField
AnalyticalField = fields.analytical.AnalyticalField
## Operators
import operator.Transport
Transport = operator.Transport.Transport
## Problem
import problem.problem
Problem = problem.problem.Problem
## Solver
import ParticularSolvers.basic
ParticularSolver = ParticularSolvers.basic.ParticularSolver
## Tools
import tools.printer
Printer = tools.printer.Printer
......@@ -13,15 +13,14 @@ class CartesianGrid(DiscreteDomain):
def __init__(self, resolution, domain):
DiscreteDomain.__init__(self, domain)
assert(self.dimension == len(resolution))
## lowest point of the grid
self.origin = domain.origin
## size of the grid in each direction
self.length = domain.length
## number of points in each direction
self.resolution = resolution
self.size = self.length / self.resolution
## self.elementNumber = spec
## self.elementSize = box.length / self.elementNumber
## ## Grid length.
## self.length = box.length
## space step size
self.step = self.length/(self.resolution-1)
## self.axes = [np.asarray(np.arange(self.min[i], self.max[i], self.elementSize[i]), dtype=dtype_real, order=order) for i in xrange(self.dimension)]
def update(start):
......@@ -46,7 +45,7 @@ class CartesianGrid(DiscreteDomain):
@param index list : index to get
@return point with given index
"""
return self.__coords.__getitem__(i)
return self.__coords.__getitem__(index)
def __str__(self):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment