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

CMakeLists for python

parent aa206dfd
No related branches found
No related tags found
No related merge requests found
...@@ -55,7 +55,7 @@ set(EXE_NAME ${PROJECT_NAME}Run) ...@@ -55,7 +55,7 @@ set(EXE_NAME ${PROJECT_NAME}Run)
# Any file in those dirs will be used to create libparmes # Any file in those dirs will be used to create libparmes
set(${PROJECT_LIBRARY_NAME}_SRCDIRS set(${PROJECT_LIBRARY_NAME}_SRCDIRS
src src
src/poisson # src/poisson
#src/interfaces/Fortran2Cpp #src/interfaces/Fortran2Cpp
# src/interfaces/ppm # src/interfaces/ppm
) )
...@@ -237,14 +237,25 @@ endif(WITH_TESTS) ...@@ -237,14 +237,25 @@ endif(WITH_TESTS)
# The library # The library
# The library, the headers and mod files, the cmake generated files # The library, the headers and mod files, the cmake generated files
# will be install in CMAKE_INSTALL_PREFIX/lib include and share # will be install in CMAKE_INSTALL_PREFIX/lib include and share
#include(InstallPackage) include(InstallPackage)
#install_package(${PACKAGE_NAME} ${PROJECT_LIBRARY_NAME} ${${PROJECT_NAME}_HDRS}) install_package(${PACKAGE_NAME} ${PROJECT_LIBRARY_NAME} ${${PROJECT_NAME}_HDRS})
#install(TARGETS ${EXE_NAME} #install(TARGETS ${EXE_NAME}
#RUNTIME DESTINATION bin # executables #RUNTIME DESTINATION bin # executables
# ) # )
#configure_file(${PACKAGE_NAME}Config.cmake.in
# "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake")
#configure_file(${PACKAGE_NAME}ConfigVersion.cmake.in
# "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}ConfigVersion.cmake" @ONLY)
#install(FILES
# "${PROJECT_BINARY_DIR}/InstallFiles/${_PACK}Config.cmake"
# "${PROJECT_BINARY_DIR}/InstallFiles/${_PACK}ConfigVersion.cmake"
# DESTINATION "${${PACKAGE_NAME}_CMAKE_DIR}" COMPONENT dev)
# ============= RPATH ============= # ============= RPATH =============
# Concerning rpath see for example http://www.itk.org/Wiki/CMake_RPATH_handling # Concerning rpath see for example http://www.itk.org/Wiki/CMake_RPATH_handling
......
...@@ -27,8 +27,8 @@ set(@PACKAGE_NAME@_LIBRARIES @PROJECT_LIBRARY_NAME@) ...@@ -27,8 +27,8 @@ set(@PACKAGE_NAME@_LIBRARIES @PROJECT_LIBRARY_NAME@)
# Set all @PACKAGE_NAME@ options # Set all @PACKAGE_NAME@ options
set(@PACKAGE_NAME@_USE_MPI @USE_MPI@) set(@PACKAGE_NAME@_USE_MPI @USE_MPI@)
set(@PACKAGE_NAME@_USE_PPM @USE_PPM@) set(@PACKAGE_NAME@_USE_PPM @WITH_PPM@)
set(@PACKAGE_NAME@_USE_PPM_Numerics @USE_PPM_Numerics@) set(@PACKAGE_NAME@_USE_PPM_Numerics @WITH_PPM_Numerics@)
# Set var for compilers used by @PACKAGE_NAME@ # Set var for compilers used by @PACKAGE_NAME@
......
../CMake
\ No newline at end of file
#=======================================================
# cmake utility to compile and install parmepy python modules and libraries
#
# F. Pérignon, june 2012
#
#=======================================================
# ============= Global cmake Settings =============
# Set minimum version for cmake
cmake_minimum_required(VERSION 2.8.7)
# Set cmake modules directory (i.e. the one which contains all user-defined FindXXX.cmake files among other things)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake)
# Force out-of-source build
include(OutOfSourceBuild)
# Some usefull macros
include(MyTools)
# User defined options
option(VERBOSE_MODE "enable verbose mode for cmake exec. Default = on" ON)
option(DOUBLEPREC "set precision for real numbers to double precision when this mode is enable. Default = on." ON)
# cmake project name
set(PROJECT_NAME parmespy)
# --- Name for the package ---
# This name will be used as the Python Package name
set(PYPACKAGE_NAME "parmespy")
# --- Set a version number for the package ---
set(${PYPACKAGE_NAME}_version 1.0.0)
# --- The name (without extension) of the lib to be created ---
set(PROJECT_LIBRARY_NAME ${PROJECT_NAME})
project(${PROJECT_NAME} Fortran)
# ============= Search for libraries =============
# We search for libraries Parmes depends on and
# set the compile/link conf (-I and -L opt)
# --- Parmes ---
find_package(Parmes REQUIRED)
# ============= Generates setup.py =============
# The file setup.py will be generated from setup.py.in.
if(EXISTS ${CMAKE_SOURCE_DIR}/setup.py.in)
if(NOT CONFIG_H_GLOBAL_CONFIGURED)
set(CONFIG_H_GLOBAL_CONFIGURED 1 CACHE BOOL "setup.py generation." )
configure_file(setup.py.in setup.py)
endif()
endif()
set(PYTHON_EXECUTABLE python)
ADD_CUSTOM_TARGET(python-build COMMAND python ${CMAKE_CURRENT_BINARY_DIR}/setup.py build --user config_fc --f90exec=${CMAKE_Fortran_COMPILER}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "build parmepy package")
ADD_CUSTOM_TARGET(python-install ALL 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")
import Domain """
import Discretization @package ParMePy
import Problems
import numpy as np
Python package dedicated to flow simulation using particular methods on hybrid architectures (MPI-GPU)
"""
__version__=1.00
__all__=['Box','CartesianTopology','ScalarField']
#import constants
import domain.box
## Box-type physical domain
Box = domain.box.Box
## MPI topologies and associated meshes
import domain.topology
CartesianTopology = domain.topology.CartesianTopology
## Fields
import fields.discrete
ScalarField = fields.discrete.ScalarField
/** \mainpage ParMeSPy
\anchor doxyParmes
\section doxyParmesIntro Introduction
ParMeS (Particular Methods Software) is a library dedicated to flow simulation based on particular methods, on hybrid (multi CPU-GPU) architecture.
It is written in Python (high level functionnalities) and Fortran.
The library is also supposed to provide a common framework to the following libraries :
- PPM (Parallel Particles Mesh) (No more ...)
- the library of Adrien Magni (split3D and 2D for remeshing methods tests)
- a spectral soft from LEGI
- ...
\section parmepyInstall Install :
- Download parmepy.tgz
- untar and change to directory
- run python install :
\code
tar -zxvf parmepy.tgz
cd parmepy
python setup.py install --user
\endcode
\section parmepyuse Use
Use as a classical python package :
\code
import ParMePy as PP
print PP.Box
\endcode
and so on ...
Several examples are available in the directory "examples" of the tgz distribution.
You can download them with "import examples.NAME"
To get the list of available NAMES, try
\code
import examples
help examples
\endcode
To run a parallel simulation try :
\code
mpirun -np 4 python ns3d.py
\endcode
*/
...@@ -15,7 +15,7 @@ ctx = cl.Context([device]) ...@@ -15,7 +15,7 @@ ctx = cl.Context([device])
queue = cl.CommandQueue(ctx, properties=cl.command_queue_properties.PROFILING_ENABLE) queue = cl.CommandQueue(ctx, properties=cl.command_queue_properties.PROFILING_ENABLE)
nb_runs = 100 nb_runs = 100
nb = 3 * 256 ** 3 nb = 2*288 ** 3
nb_strides = 33 nb_strides = 33
strides = np.zeros(nb_strides - 1) strides = np.zeros(nb_strides - 1)
......
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
setup.py file for pyParMeS setup.py file for @PYPACKAGE_NAME@
""" """
from numpy.distutils.core import setup, Extension from numpy.distutils.core import setup, Extension
...@@ -11,41 +11,50 @@ import os, glob ...@@ -11,41 +11,50 @@ import os, glob
#os.listdir(os.path.join('ParMePy','New_ParmePy')) #os.listdir(os.path.join('ParMePy','New_ParmePy'))
# Full package name # Full package name
name = 'pyparmes' name = '@PYPACKAGE_NAME@'
# List of modules (directories) to be included # List of modules (directories) to be included
packages = ['ParMePy', packages = ['ParMePy','ParMePy.domain','ParMePy.fields']
'new_ParMePy', # 'examples']
'new_ParMePy/Domain', # 'new_ParMePy',
'new_ParMePy/Operator', # 'new_ParMePy/Domain',
'new_ParMePy/Problem', # 'new_ParMePy/Operator',
'new_ParMePy/Utils', # 'new_ParMePy/Problem',
'new_ParMePy/Variable'] # 'new_ParMePy/Utils',
# 'new_ParMePy/Variable']
#f2py_sources = glob.glob('fortran_src/*.f90')
#print 'Fortran sources :', f2py_sources
#include_mpi='/Users/Franck/Softs/install-gnu/openmpi-1.5.3/lib/'
#include_mpi=['/usr/lib/openmpi/lib']
#ppm_dir=os.environ.get('PPMCore_DIR')
#ppm_include=[os.path.join(ppm_dir,'include/Modules'),os.path.join(ppm_dir,'include')]
#ppm_lib_dir=[os.path.join(ppm_dir,'lib')]
#ppm_lib=['ppm_core']
#f2pyopt=['--f90exec=/Users/Franck/Softs/install-gnu/openmpi-1.5.3/bin/mpif90']
#pyParMesModule=Extension(name=name,sources=sources,include_dirs=[include_mpi],libraries=libraries,library_dirs=[library_dir])
#pyParMesModule=Extension(name=name,sources=sources,include_dirs=[include_mpi],libraries=libraries,library_dirs=[library_dir])
##pyParMesModule=Extension(name=name,sources=f2py_sources,include_dirs=ppm_include,library_dirs=ppm_lib_dir,libraries=ppm_lib)
# Enable this to get debug info # Enable this to get debug info
# DISTUTILS_DEBUG=1 # DISTUTILS_DEBUG=1
fortran_src = glob.glob('@CMAKE_SOURCE_DIR@/ParMePy/parmesfftw2py/*.f90')
parmes_dir=['@Parmes_INCLUDE_DIRS@/Modules']
parmes_libdir=['@Parmes_LIBRARY_DIRS@']
parmeslib=['@Parmes_LIBRARIES@']
#,f2py_options=['-c --f90exec=/Users/Franck/Softs/install-gnu/openmpi-1.5.3/bin/mpif90'])
#f2py_options=['skip: discretisation_init :']
# Example with include and link :
#include_mpi='/Users/Franck/Softs/install-gnu/openmpi-1.5.3/lib/'
#fortran_dir='./ParMePy/scales2py'
#legi_dir =os.path.join(fortran_dir,'srcLegi')
#legi_lib = [os.path.join(fortran_dir,'.')]
#print legi_lib
#parpyModule=Extension(name='ParMePy.scales2py',sources=fortran_src,include_dirs=[legi_dir],library_dirs=legi_lib,libraries=['parmeslegi'])
#parpyModule=Extension(name='parpy',sources=fortran_src)#,f2py_options=f2py_options)
parpyModule=Extension(name='ParMePy.fftw2py',sources=fortran_src,include_dirs=parmes_dir,library_dirs=parmes_libdir,libraries=parmeslib)
#ppm_lib_dir=[os.path.join(ppm_dir,'lib')]
#ppm_lib=['ppm_core']
#pyParMesModule=Extension(name=name,sources=f2py_sources,include_dirs=[include_mpi],library_dirs=ppm_lib_dir,libraries=ppm_lib)
setup(name=name, setup(name=name,
version='1.0.0', version='1.0.0',
description='Particular Methods implementation in Python', description='Particular Methods implementation in Python',
author='Franck Pérignon, Christophe Picard', author='Jean-Matthieu Etancelin, Franck Pérignon, Christophe Picard',
author_email='parmes-devel@lists.forge.imag.fr', author_email='parmes-devel@lists.forge.imag.fr',
url='https://forge.imag.fr/projects/parmes/', url='https://forge.imag.fr/projects/parmes/',
license='GNU public license', license='GNU public license',
# ext_modules=[pyParMesModule], package_dir = {'': '@CMAKE_SOURCE_DIR@'},
packages=packages, ext_modules=[parpyModule],
data_files=[('new_ParMePy/Utils', ['./new_ParMePy/Utils/gpu_src.cl'])] packages=packages
#data_files=[('new_ParMePy/Utils', ['./new_ParMePy/Utils/gpu_src.cl'])]
) )
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