Skip to content
Snippets Groups Projects
Commit 1fd1eb61 authored by Jean-Baptiste Keck's avatar Jean-Baptiste Keck
Browse files

clean up build files

parent 9fba365c
No related branches found
No related tags found
2 merge requests!24Resolve "Add python3.x support",!15WIP: Resolve "HySoP with tasks"
Showing
with 29 additions and 2125 deletions
...@@ -39,25 +39,22 @@ option(DOUBLEPREC "Set default HySoP floating point precision. Default = on, ie ...@@ -39,25 +39,22 @@ option(DOUBLEPREC "Set default HySoP floating point precision. Default = on, ie
option(USE_MPI "Compile and link HySoP with mpi when this mode is enable. Default = on. WARNING: off mode is bugged." ON) option(USE_MPI "Compile and link HySoP with mpi when this mode is enable. Default = on. WARNING: off mode is bugged." ON)
option(WITH_TESTS "Enable testing. Default = OFF" ON) option(WITH_TESTS "Enable testing. Default = OFF" ON)
option(BUILD_SHARED_LIBS "Enable dynamic library build, default = ON." ON) option(BUILD_SHARED_LIBS "Enable dynamic library build, default = ON." ON)
option(USE_CXX "Expand hysop with some new functions from a generated c++ to python interface, wrapped into hysop.cpp2hysop module. Default = ON." OFF)
option(WITH_SCALES "compile/create scales lib and link it with HySoP. Default = ON." ON) option(WITH_SCALES "compile/create scales lib and link it with HySoP. Default = ON." ON)
option(WITH_PARALLEL_COMPRESSED_HDF5 "Try to enable parallel compressed hdf5 interface. Default = ON." ON) option(WITH_PARALLEL_COMPRESSED_HDF5 "Try to enable parallel compressed hdf5 interface. Default = ON." ON)
option(WITH_FFTW "Link with fftw library (required for some HySoP solvers), default = ON" ON) option(WITH_FFTW "Link with fftw library (required for some HySoP solvers), default = ON" ON)
option(WITH_EXTRAS "Link with some extra fortran libraries (like arnoldi solver), default = OFF" OFF) option(WITH_EXTRAS "Link with some extra fortran libraries (like arnoldi solver), default = OFF" OFF)
option(WITH_OPENCL "Use of GPU (required for some HySoP solvers), default = ON" ON) option(WITH_OPENCL "Use of GPU (required for some HySoP solvers), default = ON" ON)
option(WITH_MAIN_FORTRAN "Create an executable (test purpose) from fortran sources in src/main, linked with libhysop, default = OFF" OFF)
option(WITH_MAIN_CXX "Create an executable (test purpose) from cxx sources in src/hysop++/main, linked with libhysop, default = OFF" OFF)
option(PROFILE "Enable profiling mode for HySoP. Can also be enabled with HYSOP_PROFILE environment variable. Default = OFF" OFF) option(PROFILE "Enable profiling mode for HySoP. Can also be enabled with HYSOP_PROFILE environment variable. Default = OFF" OFF)
option(VERBOSE "Enable verbose mode for HySoP. Can also be enabled with HYSOP_VERBOSE environment variable. Default = OFF" OFF) option(VERBOSE "Enable verbose mode for HySoP. Can also be enabled with HYSOP_VERBOSE environment variable. Default = OFF" OFF)
option(DEBUG "Enable debug mode for HySoP. Can also be enabled with HYSOP_DEBUG environment variable. Default = OFF" OFF) option(DEBUG "Enable debug mode for HySoP. Can also be enabled with HYSOP_DEBUG environment variable. Default = OFF" OFF)
option(FULL_TEST "Enable all test options (pep8, mpi ...) - Default = OFF" OFF) option(FULL_TEST "Enable all test options (pep8, mpi ...) - Default = OFF" OFF)
option(OPTIM "To allow python -OO run, some packages must be deactivated. Set this option to 'ON' to do so. Default = OFF" OFF) option(OPTIM "To allow python -OO run, some packages must be deactivated. Set this option to 'ON' to do so. Default = OFF" OFF)
option(WITH_MPI_TESTS "Enable mpi tests. Default = OFF." OFF) option(WITH_MPI_TESTS "Enable mpi tests. Default = OFF." OFF)
option(WITH_GOOGLE_TESTS "Enable google tests (c++). Default = OFF." OFF)
option(FORTRAN_LAYOUT "Choose default data layout ('fortran', column-major or 'C' order, row-major) for arrays. Default = column-major." OFF) option(FORTRAN_LAYOUT "Choose default data layout ('fortran', column-major or 'C' order, row-major) for arrays. Default = column-major." OFF)
option(WITH_DOCUMENTATION "Build Documentation. Default = OFF" OFF) option(WITH_DOCUMENTATION "Build Documentation. Default = OFF" OFF)
option(ENABLE_LONG_TESTS "Enable tests that may run for long time with important memory print. Default = OFF." OFF) option(ENABLE_LONG_TESTS "Enable tests that may run for long time with important memory print. Default = OFF." OFF)
option(DEV_MODE "Enable devel mode (aggressive checking of warnings ..). Default = ON." ON) option(DEV_MODE "Enable devel mode (aggressive checking of warnings ..). Default = ON." ON)
# Set python install mode: # Set python install mode:
# - user --> behave as 'python setup.py install --user' # - user --> behave as 'python setup.py install --user'
# - standard --> install in python site-package (ie behave as python setup.py install) # - standard --> install in python site-package (ie behave as python setup.py install)
...@@ -68,6 +65,7 @@ set(HYSOP_INSTALL "user" CACHE STRING "Install mode for hysop python package") ...@@ -68,6 +65,7 @@ set(HYSOP_INSTALL "user" CACHE STRING "Install mode for hysop python package")
# http://public.kitware.com/Bug/view.php?id=11964 # http://public.kitware.com/Bug/view.php?id=11964
# See also http://www.cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html?highlight=gnuinstalldirs # See also http://www.cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html?highlight=gnuinstalldirs
include(GNUInstallDirs) include(GNUInstallDirs)
# Set prefix path for libraries installation # Set prefix path for libraries installation
# --> means that any library target will be installed # --> means that any library target will be installed
# in CMAKE_INSTALL_PREFIX/_install_lib # in CMAKE_INSTALL_PREFIX/_install_lib
...@@ -89,11 +87,6 @@ if(WITH_FFTW OR WITH_SCALES OR WITH_EXTRAS) ...@@ -89,11 +87,6 @@ if(WITH_FFTW OR WITH_SCALES OR WITH_EXTRAS)
set(USE_FORTRAN "ON") set(USE_FORTRAN "ON")
endif() endif()
if(NOT USE_CXX)
set(WITH_MAIN_CXX "OFF")
set(WITH_GOOGLE_TESTS "OFF")
endif()
# Force a default build type if not provided by user # Force a default build type if not provided by user
# CMAKE_BUILD_TYPE = empty, Debug, Release, RelWithDebInfo or MinSizeRel. # CMAKE_BUILD_TYPE = empty, Debug, Release, RelWithDebInfo or MinSizeRel.
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
...@@ -104,11 +97,13 @@ endif() ...@@ -104,11 +97,13 @@ endif()
# cmake project name # cmake project name
set(PROJECT_NAME hysop) set(PROJECT_NAME hysop)
# --- Name for the package ---
# This name will be used as the Python Package name # This name will be used as the Python Package name
set(PACKAGE_NAME "hysop") set(PACKAGE_NAME "hysop")
# --- The name (without extension) of the lib to be created --- # --- The name (without extension) of the lib to be created ---
set(PROJECT_LIBRARY_NAME ${PROJECT_NAME}) set(PROJECT_LIBRARY_NAME ${PROJECT_NAME})
# ============= The project ============= # ============= The project =============
# Set project name and project languages # Set project name and project languages
# => this automatically defines: # => this automatically defines:
...@@ -117,10 +112,6 @@ set(PROJECT_LIBRARY_NAME ${PROJECT_NAME}) ...@@ -117,10 +112,6 @@ set(PROJECT_LIBRARY_NAME ${PROJECT_NAME})
# Note that because of OutOfSourceBuild, binary_dir and source_dir must be different. # Note that because of OutOfSourceBuild, binary_dir and source_dir must be different.
set(LANGLIST) set(LANGLIST)
if(USE_CXX)
set(LANGLIST ${LANGLIST} C CXX)
endif()
if(USE_FORTRAN) if(USE_FORTRAN)
set(LANGLIST ${LANGLIST} C Fortran) set(LANGLIST ${LANGLIST} C Fortran)
endif() endif()
...@@ -137,6 +128,7 @@ set(HYSOP_LINK_LIBRARIES CACHE INTERNAL "List of external libraries.") ...@@ -137,6 +128,7 @@ set(HYSOP_LINK_LIBRARIES CACHE INTERNAL "List of external libraries.")
# - Global setup (interp and lib) - # - Global setup (interp and lib) -
find_package(PythonFull REQUIRED) find_package(PythonFull REQUIRED)
include(FindPythonModule) include(FindPythonModule)
# - python packages - # - python packages -
find_python_module(numpy REQUIRED) find_python_module(numpy REQUIRED)
find_python_module(scipy REQUIRED) find_python_module(scipy REQUIRED)
...@@ -156,33 +148,27 @@ find_python_module(pyfftw REQUIRED) ...@@ -156,33 +148,27 @@ find_python_module(pyfftw REQUIRED)
find_python_module(matplotlib OPTIONAL) find_python_module(matplotlib OPTIONAL)
find_python_module(pyvis OPTIONAL) find_python_module(pyvis OPTIONAL)
# Some opencl related python package fails to import on non OpenCL machines (cluster's frontend for instance)
find_package( OpenCL ) find_package( OpenCL )
if(${OpenCL_LIBRARY}) # Some opencl related python package fails to import on non OpenCL machines (cluster's frontend for instance) if(${OpenCL_LIBRARY})
find_python_module(pyopencl REQUIRED) find_python_module(pyopencl REQUIRED)
find_python_module(gpyfft REQUIRED) find_python_module(gpyfft REQUIRED)
else() else()
find_python_module(pyopencl ) find_python_module(pyopencl)
find_python_module(gpyfft ) find_python_module(gpyfft)
endif() endif()
# --- MPI --- # --- MPI ---
if(USE_MPI) if(USE_MPI)
find_package(MPI REQUIRED) find_package(MPI REQUIRED)
find_python_module(mpi4py REQUIRED) find_python_module(mpi4py REQUIRED)
endif() endif()
# --- Wheel, required for a proper build/install process --- # --- Wheel, required for a proper build/install process ---
find_python_module(wheel REQUIRED) find_python_module(wheel REQUIRED)
if(USE_CXX)
find_package(SWIG 3.0.2 REQUIRED)
# WARNING FP : for cmake < 3.0 UseSWIG.cmake
# does not work properly (bug for swig outdir)
if(CMAKE_VERSION VERSION_LESS 3.0.0)
set(SWIG_USE_FILE ${CMAKE_SOURCE_DIR}/cmake/UseSWIG.cmake)
endif()
include(${SWIG_USE_FILE})
endif()
# Find python build dir name --> needed for tests and doc # Find python build dir name --> needed for tests and doc
if(USE_CXX OR USE_FORTRAN) if(USE_FORTRAN)
execute_process( execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.util as ut ; import distutils.sysconfig as sy; print('lib.'+ut.get_platform()+'-'+sy.get_python_version())" COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.util as ut ; import distutils.sysconfig as sy; print('lib.'+ut.get_platform()+'-'+sy.get_python_version())"
OUTPUT_VARIABLE ${PROJECT_NAME}_PYTHON_BUILD_DIR) OUTPUT_VARIABLE ${PROJECT_NAME}_PYTHON_BUILD_DIR)
...@@ -218,10 +204,6 @@ if(WITH_FFTW) ...@@ -218,10 +204,6 @@ if(WITH_FFTW)
add_definitions(${FFTW_DEFINES}) add_definitions(${FFTW_DEFINES})
endif() endif()
if(USE_CXX)
compile_with(Boost REQUIRED)
endif()
if(WITH_EXTRAS) if(WITH_EXTRAS)
# Arnoldi solver needs zgeev, which means lapack # Arnoldi solver needs zgeev, which means lapack
compile_with(LAPACK) compile_with(LAPACK)
...@@ -233,7 +215,6 @@ if(WITH_EXTRAS) ...@@ -233,7 +215,6 @@ if(WITH_EXTRAS)
endif() endif()
endforeach() endforeach()
set(EXTRASLIB ${dirlist} CACHE PATH "extras libraries dir") set(EXTRASLIB ${dirlist} CACHE PATH "extras libraries dir")
endif() endif()
# ========= Check parallel hdf5 availability ========= # ========= Check parallel hdf5 availability =========
...@@ -259,15 +240,15 @@ endif() ...@@ -259,15 +240,15 @@ endif()
# ========= Check which opencl devices are available on the system ========= # ========= Check which opencl devices are available on the system =========
if(WITH_OPENCL) if(WITH_OPENCL)
execute_process( execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/opencl_explore.py "EXPLORE") COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/opencl_explore.py "EXPLORE")
execute_process( execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/opencl_explore.py COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/opencl_explore.py
OUTPUT_VARIABLE OPENCL_DEFAULT_OPENCL_ID) OUTPUT_VARIABLE OPENCL_DEFAULT_OPENCL_ID)
else() else()
execute_process( execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/opencl_explore.py "EXPLORE" CPU) COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/opencl_explore.py "EXPLORE" CPU)
execute_process( execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/opencl_explore.py CPU COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/opencl_explore.py CPU
OUTPUT_VARIABLE OPENCL_DEFAULT_OPENCL_ID) OUTPUT_VARIABLE OPENCL_DEFAULT_OPENCL_ID)
endif() endif()
...@@ -276,6 +257,8 @@ list(GET MY_LIST 0 OPENCL_DEFAULT_OPENCL_PLATFORM_ID) ...@@ -276,6 +257,8 @@ list(GET MY_LIST 0 OPENCL_DEFAULT_OPENCL_PLATFORM_ID)
list(GET MY_LIST 1 OPENCL_DEFAULT_OPENCL_DEVICE_ID) list(GET MY_LIST 1 OPENCL_DEFAULT_OPENCL_DEVICE_ID)
display(OPENCL_DEFAULT_OPENCL_PLATFORM_ID) display(OPENCL_DEFAULT_OPENCL_PLATFORM_ID)
display(OPENCL_DEFAULT_OPENCL_DEVICE_ID) display(OPENCL_DEFAULT_OPENCL_DEVICE_ID)
# =========== RPATH stuff =========== # =========== RPATH stuff ===========
# Doc : # Doc :
# - https://cmake.org/Wiki/CMake_RPATH_handling # - https://cmake.org/Wiki/CMake_RPATH_handling
...@@ -323,7 +306,6 @@ else() ...@@ -323,7 +306,6 @@ else()
endif() endif()
# ====== Create (and setup) install/uninstall targets ====== # ====== Create (and setup) install/uninstall targets ======
#
# --> set installation dir # --> set installation dir
# --> set options for python install # --> set options for python install
# --> create install/uninstall targets # --> create install/uninstall targets
...@@ -365,19 +347,17 @@ endif() ...@@ -365,19 +347,17 @@ endif()
if(USE_FORTRAN) if(USE_FORTRAN)
# Path to fortran-related generated files (.pyf, precision ...) # Path to fortran-related generated files (.pyf, precision ...)
set(GENERATED_FORTRAN_FILES_DIR ${CMAKE_BINARY_DIR}/generated_fortran/) set(GENERATED_FORTRAN_FILES_DIR ${CMAKE_BINARY_DIR}/generated_fortran/)
# --- copy sort_f90 file to build --- # --- copy sort_f90 file to build ---
# Required for setup.py to handle fortran files dependencies # Required for setup.py to handle fortran files dependencies
configure_file(${CMAKE_SOURCE_DIR}/sort_f90.py ${CMAKE_BINARY_DIR}/sort_f90.py) configure_file(${CMAKE_SOURCE_DIR}/cmake/sort_f90.py ${CMAKE_BINARY_DIR}/sort_f90.py)
# --- Generate f2py_f2cmap file --- # --- Generate f2py_f2cmap file ---
if(EXISTS ${CMAKE_SOURCE_DIR}/f2py_f2cmap.in) if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/f2py_f2cmap.in)
message(STATUS "Generate f2py map file ...") message(STATUS "Generate f2py map file ...")
configure_file(${CMAKE_SOURCE_DIR}/f2py_f2cmap.in configure_file(${CMAKE_SOURCE_DIR}/cmake/f2py_f2cmap.in
${CMAKE_BINARY_DIR}/.f2py_f2cmap) ${CMAKE_BINARY_DIR}/.f2py_f2cmap)
endif() endif()
...@@ -420,11 +400,11 @@ if(USE_FORTRAN) ...@@ -420,11 +400,11 @@ if(USE_FORTRAN)
set(Fortran_FLAGS ${CMAKE_Fortran_FLAGS}) set(Fortran_FLAGS ${CMAKE_Fortran_FLAGS})
append_flags(Fortran_FLAGS ${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}}) append_flags(Fortran_FLAGS ${CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE}})
# --- Generate precision.f95 and precision.pyf files --- # --- Generate precision.f95 and precision.pyf files ---
if(EXISTS ${CMAKE_SOURCE_DIR}/precision.conf.in) if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/precision.conf.in)
message(STATUS "Generate precision.f95 file ...") message(STATUS "Generate precision.f95 file ...")
configure_file(${CMAKE_SOURCE_DIR}/precision.conf.in configure_file(${CMAKE_SOURCE_DIR}/cmake/precision.conf.in
${GENERATED_FORTRAN_FILES_DIR}/precision.f95) ${GENERATED_FORTRAN_FILES_DIR}/precision.f95)
configure_file(${CMAKE_SOURCE_DIR}/precision.conf.in configure_file(${CMAKE_SOURCE_DIR}/cmake/precision.conf.in
${GENERATED_FORTRAN_FILES_DIR}/precision.pyf) ${GENERATED_FORTRAN_FILES_DIR}/precision.pyf)
endif() endif()
endif() endif()
...@@ -434,42 +414,6 @@ if(USE_FORTRAN) ...@@ -434,42 +414,6 @@ if(USE_FORTRAN)
set(FORTRAN_INCLUDE_DIRS ${FFTW_INCLUDE_DIRS}) set(FORTRAN_INCLUDE_DIRS ${FFTW_INCLUDE_DIRS})
endif() endif()
if(USE_CXX)
#C++ variables used by setup.py.in for swig
if(DEV_MODE)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CXX_WARNING_FLAGS "-W -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-missing-braces")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CXX_WARNING_FLAGS "-W -Wall -Wextra -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-deprecated-declarations")
#elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
#elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
else()
set(CXX_WARNING_FLAGS "")
endif()
endif()
list(APPEND CMAKE_CXX_FLAGS "${CXX_WARNING_FLAGS} ${FFTW_COMPILE_FLAGS} -fPIC -std=c++11")
if(APPLE)
list(APPEND CMAKE_EXE_LINKER_FLAGS "-ldl -lutil")
else()
list(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed -ldl -lutil")
endif()
set(CXX_FLAGS ${CMAKE_CXX_FLAGS})
set(CXX_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
set(CXX_EXTRA_DEFINES ${FFTW_DEFINES} "-DHAS_EXTERN_TEMPLATES")
set(CXX_EXT_INCLUDES ${Boost_INCLUDE_DIR} ${PYTHON_INCLUDE_DIR} ${FFTW_INCLUDE_DIRS})
set(CXX_EXT_LIBS ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${FFTW_LIBRARIES})
set(CXX_EXT_LIB_DIR ${Boost_LIBRARY_DIRS} ${PYTHON_LIBRARY_DIRS} ${FFTW_LIBRARY_DIRS})
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
#swig package name (lib name generated by swig)
set(CPP_2_HYSOP "cpp2hysop")
endif()
# Append pythonlib to hysop link floags # Append pythonlib to hysop link floags
list(APPEND HYSOP_LINK_LIBRARIES ${PYTHON_LIBRARIES} ) list(APPEND HYSOP_LINK_LIBRARIES ${PYTHON_LIBRARIES} )
...@@ -487,65 +431,6 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/hysop/__init__.py.in) ...@@ -487,65 +431,6 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/hysop/__init__.py.in)
configure_file(hysop/__init__.py.in ${CMAKE_SOURCE_DIR}/hysop/__init__.py) configure_file(hysop/__init__.py.in ${CMAKE_SOURCE_DIR}/hysop/__init__.py)
endif() endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/hysop/mpi/__init__.py.in)
message(STATUS "Generate mpi/__init__.py file ...")
file(REMOVE ${CMAKE_SOURCE_DIR}/hysop/mpi/__init__.py)
configure_file(hysop/mpi/__init__.py.in ${CMAKE_SOURCE_DIR}/hysop/mpi/__init__.py)
endif()
# Hysop C++ library is generated in setup.py by swig
# --- C++ main and tests ---
if(USE_CXX)
get_filename_component(CXX_DIR "${CMAKE_SOURCE_DIR}/src/hysop++" ABSOLUTE)
get_filename_component(CXX_MAIN_DIR "${CXX_DIR}/main" ABSOLUTE)
get_filename_component(CXX_TEST_DIR "${CXX_DIR}/tests" ABSOLUTE)
get_filename_component(CXX_SOURCE_DIR "${CXX_DIR}/src" ABSOLUTE)
include_directories(${CXX_SOURCE_DIR})
include_directories(SYSTEM ${CXX_EXT_INCLUDES})
link_directories(${CXX_EXT_LIB_DIRS})
add_definitions(${CXX_EXTRA_DEFINES})
if(WITH_MAIN_CXX OR WITH_GOOGLE_TESTS)
if(APPLE) #swig only generates a bundle, need to generate another static library...
set(HYSOP_CXX_LIBRARY_DYLIB "cpp2hysop_dylib")
file(GLOB_RECURSE source_files ${CXX_SOURCE_DIR}/*.cpp)
add_library(${HYSOP_CXX_LIBRARY_DYLIB} STATIC ${source_files})
target_link_libraries(${HYSOP_CXX_LIBRARY_DYLIB} ${EXT_LIBRARIES})
set(HYSOP_CXX_LIBRARY ${HYSOP_CXX_LIBRARY_DYLIB})
set(HYSOP_CXX_LIBRARY_DEP cpp2hysop_dylib)
else() #nothing to do on other platforms bundle <=> dynamic libraries, so just copy the swig generated one
set(HYSOP_CXX_LIBRARY_BUNDLE "${CMAKE_CURRENT_BINARY_DIR}/libcpp2hysop_bundle.so")
add_custom_target(cpp2hysop_bundle
DEPENDS wheel
COMMAND cp `find ${CMAKE_CURRENT_BINARY_DIR}/build -name _${CPP_2_HYSOP}.so` ${HYSOP_CXX_LIBRARY_BUNDLE}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "Copy swig c++ library to link")
set(HYSOP_CXX_LIBRARY ${HYSOP_CXX_LIBRARY_BUNDLE})
set(HYSOP_CXX_LIBRARY_DEP cpp2hysop_bundle)
endif()
endif()
if(WITH_MAIN_CXX)
list(APPEND cxx_executable_sources "${CXX_MAIN_DIR}/planner.cpp")
list(APPEND cxx_executable_sources "${CXX_MAIN_DIR}/diffSolver.cpp")
list(APPEND cxx_executable_sources "${CXX_MAIN_DIR}/poissonSolver.cpp")
foreach(cxx_main_source ${cxx_executable_sources})
get_filename_component(cxx_exec_name "${cxx_main_source}" NAME_WE)
add_executable(${cxx_exec_name} ${cxx_main_source})
add_dependencies(${cxx_exec_name} ${HYSOP_CXX_LIBRARY_DEP})
target_link_libraries(${cxx_exec_name} ${HYSOP_CXX_LIBRARY} ${CXX_EXT_LIBS})
endforeach()
endif()
if(WITH_GOOGLE_TESTS)
add_subdirectory(${CXX_TEST_DIR})
endif()
endif()
# =========== RPATH stuff =========== # =========== RPATH stuff ===========
# Doc : # Doc :
# - https://cmake.org/Wiki/CMake_RPATH_handling # - https://cmake.org/Wiki/CMake_RPATH_handling
...@@ -631,11 +516,6 @@ if(VERBOSE_MODE) ...@@ -631,11 +516,6 @@ if(VERBOSE_MODE)
else() else()
message(WARNING "You deactivate fortran to python interface generation. This will disable the fortran interface, including fftw and scales fonctionnalities.") message(WARNING "You deactivate fortran to python interface generation. This will disable the fortran interface, including fftw and scales fonctionnalities.")
endif() endif()
if(USE_CXX)
message(STATUS " CXX compiler : ${CMAKE_CXX_COMPILER}")
else()
message(WARNING "You deactivate c++ to python interface generation. This will disable the Aitken-Schwarz Poisson solver.")
endif()
message(STATUS " Sources are in : ${CMAKE_SOURCE_DIR}") message(STATUS " Sources are in : ${CMAKE_SOURCE_DIR}")
message(STATUS " Build is done in : ${CMAKE_BINARY_DIR}") message(STATUS " Build is done in : ${CMAKE_BINARY_DIR}")
message(STATUS " Project uses MPI : ${USE_MPI}") message(STATUS " Project uses MPI : ${USE_MPI}")
...@@ -664,11 +544,3 @@ if(VERBOSE_MODE) ...@@ -664,11 +544,3 @@ if(VERBOSE_MODE)
message("Try to run python -c 'import hysop'. If it fails, add ${HYSOP_PYTHON_INSTALL_DIR} to PYTHONPATH environment variable.") message("Try to run python -c 'import hysop'. If it fails, add ${HYSOP_PYTHON_INSTALL_DIR} to PYTHONPATH environment variable.")
message("Example : \n export PYTHONPATH=${HYSOP_PYTHON_INSTALL_DIR}/:\${PYTHONPATH}\n") message("Example : \n export PYTHONPATH=${HYSOP_PYTHON_INSTALL_DIR}/:\${PYTHONPATH}\n")
endif() endif()
# Add custom target to install compiled libraries locally
add_custom_target(update_libs
COMMAND find ${CMAKE_SOURCE_DIR}/hysop/ -name '*.so' -type f -delete
COMMAND find ${CMAKE_BINARY_DIR} -name '*.so' -type f -print0 | xargs -0 cp -t ${CMAKE_SOURCE_DIR}/hysop/
COMMAND [ -f "$ENV{HOME}/.hysop.__init__.py" ] && rm ${CMAKE_SOURCE_DIR}/hysop/__init__.py
COMMAND [ -f "$ENV{HOME}/.hysop.__init__.py" ] && cp $ENV{HOME}/.hysop.__init__.py ${CMAKE_SOURCE_DIR}/hysop/__init__.py
DEPENDS wheel)
set(CTEST_PROJECT_NAME "HySoP")
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=HySoP")
set(CTEST_DROP_SITE_CDASH TRUE)
# - config file for @PACKAGE_NAME@ package
# Written by F. Pérignon, 2011 march
#
# This file generates @PACKAGE_NAME@Config.cmake, that may be used by another cmake project
# to retrieve all the configuration variables from @PACKAGE_NAME@
#
# It defines the following variables
#
# @PACKAGE_NAME@_INCLUDE_DIRS - include directories for ppmcore
# @PACKAGE_NAME@_EXTRA_INCLUDE_DIRS - path to extra headers needed for @PACKAGE_NAME@ (metis.h ...)
# @PACKAGE_NAME@_LIBRARY_DIRS - path to @PACKAGE_NAME@ library(ies)
# @PACKAGE_NAME@_LIBRARIES - libraries to link against to use ppmcore
# @PACKAGE_NAME@_USE_XXX - value of option "USE_XXX" (for example USE_MPI, USE_Metis ... = ON or OFF)
# Tell the user where to find ppmcore headers
# Tell the user project where to find our headers and libraries
set(@PACKAGE_NAME@_INCLUDE_DIRS "${${PACKAGE_SHORT_NAME}_INCLUDE_DIRS}")
set(@PACKAGE_NAME@_EXTRA_INCLUDE_DIRS "${${PACKAGE_NAME}_EXTRA_INCLUDE_DIRS}")
set(@PACKAGE_NAME@_LIBRARY_DIRS "${${PACKAGE_NAME}_LIB_DIR}")
set(@PACKAGE_NAME@_MODULE_DIR "${${PACKAGE_NAME}_INCLUDE_DIRS}/Modules")
# Our library dependencies (contains definitions for IMPORTED targets)
include("${${PACKAGE_NAME}_CMAKE_DIR}/@PACKAGE_NAME@LibraryDepends.cmake")
# These are IMPORTED targets created by FooBarLibraryDepends.cmake
set(@PACKAGE_NAME@_LIBRARIES @PROJECT_LIBRARY_NAME@)
# Set all @PACKAGE_NAME@ options
set(@PACKAGE_NAME@_USE_MPI @USE_MPI@)
set(@PACKAGE_NAME@_USE_PPM @WITH_PPM@)
set(@PACKAGE_NAME@_USE_PPM_Numerics @WITH_PPM_Numerics@)
# Set var for compilers used by @PACKAGE_NAME@
#set(@PACKAGE_NAME@_Fortran_COMPILER @CMAKE_Fortran_COMPILER@)
# Fortran flags
#set(@PACKAGE_NAME@_Fortran_FLAGS @CMAKE_Fortran_FLAGS@)
set(PACKAGE_VERSION "@HySoP_version@")
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
...@@ -22,14 +22,6 @@ macro(append_flags) ...@@ -22,14 +22,6 @@ macro(append_flags)
endmacro(append_flags) endmacro(append_flags)
# The use of ADD_DEFINITION results in a warning with Fortran compiler # The use of ADD_DEFINITION results in a warning with Fortran compiler
macro(APPEND_C_FLAGS)
append_flags(CMAKE_C_FLAGS ${ARGV})
endmacro(APPEND_C_FLAGS)
macro(APPEND_CXX_FLAGS)
append_flags(CMAKE_CXX_FLAGS ${ARGV})
endmacro(APPEND_CXX_FLAGS)
macro(APPEND_Fortran_FLAGS) macro(APPEND_Fortran_FLAGS)
append_flags(CMAKE_Fortran_FLAGS ${ARGV}) append_flags(CMAKE_Fortran_FLAGS ${ARGV})
endmacro(APPEND_Fortran_FLAGS) endmacro(APPEND_Fortran_FLAGS)
......
File moved
File moved
File moved
File moved
File moved
.ipynb_checkpoints
interactive
This diff is collapsed.
%% Cell type:markdown id: tags:
# HySoP: Time dependent analytical fields
In this notebook we will see how to define analytical fields that evolve with time
and how to dump their values to disk at a given dump frequency.
* __Level:__ easy
* __Recommended lecture:__ 00_introduction notebook
In this notebook you will learn how to create, setup and apply operators embedded into a computational graph.
Two operators are discussed here:
* __PythonAnalyticField:__ update a field with a python method at each simulation step.
* __HDF_Writer:__ write a field to disk as an hdf file.
## Setting up HySoP
Like in the last notebook we need to import the library and
required types.
%% Cell type:code id: tags:
``` python
import hysop
from hysop.deps import np
from hysop import Box, Discretization, CartesianTopology, \
Field, Simulation, Problem
from hysop.defaults import TimeParameters
from hysop.operators import HDF_Writer
from hysop.backend.host.python.operator.analytic import PythonAnalyticField
```
%% Cell type:markdown id: tags:
## Domain and topology
First we define a domain, a discretization and finally our topology.
%% Cell type:code id: tags:
``` python
# chose the dimensionality of the domain
dim = 2
# define the domain
box = Box(length=(2*np.pi,)*dim)
# discretization parameters (here we choose 64^dim, without ghosts)
discretization = Discretization((65,)*dim)
# finally create a cartesian topology
topo = CartesianTopology(domain=box, discretization=discretization)
print topo
```
%% Output
======== CartesianTopology::t0 ========
*on task: 999
*backend: HostArrayBackend::bk1
*shape: [1 1]
*process of coords [0 0] and of ranks cart_rank=0, parent_rank=0
*cartesian ranks map:
[0]
*cartesian to parent comm ranks mapping:
[[0]]
*neighbours ranks (left, right) x direction
[[-1 0]
[-1 0]]
*BoxView::d0 | 2D rectangular box domain:
*origin: [0. 0.]
*max_pos: [6.28318531 6.28318531]
*length: [6.28318531 6.28318531]
*left boundary conditions: [PERIODIC(1), PERIODIC(1)]
*right boundary conditions: [PERIODIC(1), PERIODIC(1)]
*CartesianMeshView::m0:
*proc coords: [0 0]
*global start: [0 0]
*local resolution: [64 64]
*compute resolution: [64 64]
*ghosts: [0 0]
*local boundaries: left => [PERIODIC(1) PERIODIC(1)]
right => [PERIODIC(1) PERIODIC(1)]
=================================
%% Cell type:markdown id: tags:
## Define the scalar field and time parameters
Here we will define the field that will be updated at each time step.
%% Cell type:code id: tags:
``` python
t,dt = TimeParameters(dtype=np.float32)
f0 = Field(name='F0', domain=box, dtype=np.float32)
```
%% Cell type:markdown id: tags:
## Define all required operators
### Python analytic operator
%% Cell type:code id: tags:
``` python
def compute_scalar(data, coords, t):
data[0][...] = (1.0/(1.0+0.1*t()))
for x in coords[0]:
data[0][...] *= np.cos(x-t())
# Analytic operator
op0 = PythonAnalyticField(name='analytic', field=f0,
formula=compute_scalar,
variables={f0: topo},
extra_input_kwds={'t':t}) # <= here we pass all extra keyword arguments required by formula
```
%% Cell type:markdown id: tags:
### The HDF writer operator:
%% Cell type:code id: tags:
``` python
# HDF Writer
# by default fields will be dumped to the notebook interactive folder
op1 = HDF_Writer(name='dumped_scalar_field',
variables={f0:topo})
```
%% Cell type:markdown id: tags:
## Build the computational operator graph
Build computational operator graph:
%% Cell type:code id: tags:
``` python
# Create a problem and build it
problem = Problem()
problem.insert(op0, op1)
problem.build()
```
%% Cell type:markdown id: tags:
## Solve and finalize
%% Cell type:code id: tags:
``` python
# Create a simulation and solve the problem
# (do not forget to specify the time parameter here)
simu = Simulation(start=0.0, end=2*np.pi,
nb_iter=100, t=t, dt=dt)
# Finally solve the problem
problem.solve(simu)
# Finalize
problem.finalize()
```
%% Cell type:markdown id: tags:
You can use paraview to visualize the evolution of our scalar field by opening the 'dumped_scalar_field.xmf' file contained in the interactive folder of your current working directory.
This is what the result should look like:
<video controls src="videos/analytic.ogv" />
File deleted
...@@ -18,12 +18,6 @@ import sys ...@@ -18,12 +18,6 @@ import sys
sys.path.append('@CMAKE_BINARY_DIR@/') sys.path.append('@CMAKE_BINARY_DIR@/')
import sort_f90 import sort_f90
# --- Check if c++ interface is enabled ---
enable_cpp = "@USE_CXX@"
if enable_cpp:
swig_executable = find_executable("@SWIG_EXECUTABLE@")
def parseCMakeVar(var, sep=';'): def parseCMakeVar(var, sep=';'):
""" """
Post-process cmake list-like variables. Post-process cmake list-like variables.
...@@ -162,79 +156,6 @@ def create_fortran_extension(name, pyf_file=None, src_dirs=None, sources=None, ...@@ -162,79 +156,6 @@ def create_fortran_extension(name, pyf_file=None, src_dirs=None, sources=None,
return ext_fort return ext_fort
def create_swig_extension(name, inc_dirs, src_dirs=None, sources=None):
"""Create a python module from C++ files, using swig
Parameters
----------
name: string
module name
inc_dirs: list
list of directories for includes (-I ...), absolute path
containing headers (.hpp) and swig files (.i)
sources: list, optional
all c++ files that must be taken into account
src_dirs: list, optional
all directories containing fortran sources (absolute path)
that must be taken into account. Warning: no recursive scan
in src_dirs.
Notes
-----
* either sources, src_dirs or inc_dirs is required but all
can be used simultaneously.
* only .cpp files are taken into account.
* main config file for swig is assumed to be
name.i in CMAKE_SOURCE_DIR/swig/
"""
swig_dir = os.path.join('@CMAKE_SOURCE_DIR@', 'swig')
swig_config_file = os.path.join(swig_dir, name + '.i')
include_dirs = set(inc_dirs)
if sources is None:
sources = []
assert (src_dirs is not None) or (inc_dirs is not None)
if(src_dirs is None):
assert(inc_dirs is not None)
for idir in inc_dirs:
for root, dirnames, filenames in os.walk(idir):
for filename in fnmatch.filter(filenames, '*.cpp'):
sources.append(os.path.join(root, filename))
else:
for sdir in src_dirs:
sources += glob.glob(os.path.join(sdir, '*.cpp'))
sources.insert(0, swig_config_file)
include_dirs = list(include_dirs)
name = 'hysop._' + name
swig_opts = ['-I' + swig_dir,
'-O', '-Wextra', '-Werror',
'-c++', '-extranative', '-safecstrings']
extern_includes = parseCMakeVar("@CXX_EXT_INCLUDES@")
for exti in extern_includes:
include_dirs.append(exti)
libraries = parseCMakeVar("@CXX_EXT_LIBS@")
library_dirs = parseCMakeVar("@CXX_EXT_LIB_DIRS@")
extra_compile_args = parseCMakeVar("@CXX_FLAGS@", sep=' ')
extra_link_args = parseCMakeVar("@CXX_LINKER_FLAGS@", sep=' ')
define_macros = parseCMakeDefines("@CXX_EXTRA_DEFINES@")
swig_ext = Extension(name, sources=sources, language='c++',
swig_opts=swig_opts,
include_dirs=include_dirs,
library_dirs=library_dirs,
libraries=libraries,
define_macros=define_macros,
runtime_library_dirs=library_dirs,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args)
return swig_ext
# ------------ Set list of packages required to build the module ------------- # ------------ Set list of packages required to build the module -------------
# List of modules (directories) to be included # List of modules (directories) to be included
with_test = "@WITH_TESTS@" == "ON" with_test = "@WITH_TESTS@" == "ON"
...@@ -324,28 +245,10 @@ if enable_fortran == "ON": ...@@ -324,28 +245,10 @@ if enable_fortran == "ON":
for ex in ext: for ex in ext:
ext_modules.append(ext[ex]) ext_modules.append(ext[ex])
# --- C++ files and swig interface --
if enable_cpp == "ON":
# path to .i files
swig_include_dirs = [os.path.join('@CMAKE_SOURCE_DIR@','swig')]
cpp_include_dirs = ['src/fftw','src/hysop++/src']
for d in cpp_include_dirs:
swig_include_dirs.append(os.path.join('@CMAKE_SOURCE_DIR@', d))
ext = {}
cpp2hysop = "@CPP_2_HYSOP@"
ext[cpp2hysop] = create_swig_extension(name=cpp2hysop,
inc_dirs=swig_include_dirs)
for ex in ext:
ext_modules.append(ext[ex])
data_files = [] data_files = []
descr = 'Hybrid Computation with Particles.' descr = 'Hybrid Computation with Particles.'
authors = 'G.H Cottet, J.M Etancelin, J.B Keck, C.Mimeau, F.Pérignon, C. Picard' authors = 'G.H Cottet, J.M Etancelin, J.B Keck, C.Mimeau, F.Pérignon, C. Picard'
# authors = 'HySoP development team'
config = Configuration( config = Configuration(
name='@PACKAGE_NAME@', name='@PACKAGE_NAME@',
version='@HYSOP_VERSION@', version='@HYSOP_VERSION@',
......
...@@ -48,8 +48,8 @@ set(${HYSOP_LIBRARY_NAME}_HDRS ${HDRS_FILES}) ...@@ -48,8 +48,8 @@ set(${HYSOP_LIBRARY_NAME}_HDRS ${HDRS_FILES})
# ============= Generates HySoPConfig.hpp ============= # ============= Generates HySoPConfig.hpp =============
# The file HYSOP_LIBRARY_NAME_defines.hpp will be generated from config.hpp.cmake; # The file HYSOP_LIBRARY_NAME_defines.hpp will be generated from config.hpp.cmake;
if(EXISTS ${CMAKE_SOURCE_DIR}/config.hpp.cmake) if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/config.hpp.cmake)
configure_file(${CMAKE_SOURCE_DIR}/config.hpp.cmake ${HYSOP_LIBRARY_NAME}_defines.hpp) configure_file(${CMAKE_SOURCE_DIR}/cmake/config.hpp.cmake ${HYSOP_LIBRARY_NAME}_defines.hpp)
include_directories(${CMAKE_BINARY_DIR}) include_directories(${CMAKE_BINARY_DIR})
endif() endif()
...@@ -67,34 +67,3 @@ include_directories(${HYSOP_INCLUDE_DIRECTORIES}) ...@@ -67,34 +67,3 @@ include_directories(${HYSOP_INCLUDE_DIRECTORIES})
add_library(${HYSOP_LIBRARY_NAME} STATIC ${${HYSOP_LIBRARY_NAME}_SRCS}) add_library(${HYSOP_LIBRARY_NAME} STATIC ${${HYSOP_LIBRARY_NAME}_SRCS})
target_link_libraries(${HYSOP_LIBRARY_NAME} PRIVATE ${HYSOP_LINK_LIBRARIES}) target_link_libraries(${HYSOP_LIBRARY_NAME} PRIVATE ${HYSOP_LINK_LIBRARIES})
#install(TARGETS ${HYSOP_LIBRARY_NAME}
# LIBRARY DESTINATION ${HYSOP_PYTHON_INSTALL_DIR}/${PACKAGE_NAME})
# ============= Create an executable linked with libhysop =============
# This part is optional and only useful to test libhysop in a
# way that does not depends on python.
# At the time it only includes fftw tests.
if(WITH_FORTRAN_TESTS)
# if(WITH_FFTW)
# # Set the name of a executable file that will be linked with libHYSOP_LIBRARY_NAME.
# # Useful to test libhysop in a way that does not depend on python.
# set(EXE_NAME ${HYSOP_LIBRARY_NAME}Run)
# # A main file to create an executable (test purpose)
# # Any files in these dirs will be used to create HySoP exec (linked with libhysop)
# set(${EXE_NAME}_SRCDIRS main)
# # Source and header files list, to generate a working executable based on libhysop.
# get_sources("${${EXE_NAME}_SRCDIRS}")
# get_headers("${${EXE_NAME}_SRCDIRS}")
# set(${EXE_NAME}_SRCS ${SOURCES_FILES})
# set(${EXE_NAME}_HDRS ${HDRS_FILES})
# list(APPEND ${EXE_NAME}_SRC ${${EXE_NAME}_HDRS})
# include_directories(${${EXE_NAME}_HDRS})
# add_executable(${EXE_NAME} ${${EXE_NAME}_SRCS})
# add_dependencies(${EXE_NAME} ${HYSOP_LIBRARY_NAME})
# # libs to link with EXE_NAME
# target_link_libraries(${EXE_NAME} ${HYSOP_LIBRARY_NAME})
# target_link_libraries(${EXE_NAME} ${HYSOP_LINK_LIBRARIES})
# endif()
endif()
// -*- C++ -*-
%module cpp2hysop
%include start.i
%include hysop++/hysop++.i
%module domain
// -*- C++ -*-
%{
#include "domain/boundary.h"
#include "domain/domainConfiguration.h"
%}
/* domain boundary */
%ignore hysop::domain::operator<<;
%include "domain/boundary.h"
/* domain configuration */
%ignore hysop::domain::operator<<;
%ignore hysop::domain::DomainConfiguration::operator[];
%include "domain/domainConfiguration.h"
%define INSTANTIATE_DOMAIN_CONFIG_IMPL(CLASS_NAME,CLASS_TEMPLATE)
%template(CLASS_NAME) CLASS_TEMPLATE;
%extend CLASS_TEMPLATE {
CLASS_TEMPLATE::BoundaryPair __get_item__(unsigned int k) const {
return $self->operator[](k);
}
const char* __str__() const {
std::stringstream ss;
ss << *($self);
return ss.str().c_str();
}
}
%enddef
%define INSTANTIATE_DOMAIN_CONFIG(INT)
INSTANTIATE_DOMAIN_CONFIG_IMPL(DomainConfiguration ## INT ## D, hysop::domain::DomainConfiguration<INT>)
%enddef
%formacro(INSTANTIATE_DOMAIN_CONFIG, INSTANTIATED_DIMENSIONS)
%module fft
// -*- C++ -*-
%{
#include "fftw3.h"
#include "fft/fftw3.h"
#include "fft/extension.h"
#include "fft/transform.h"
#include "fft/fftDomainConfiguration.h"
%}
/* fftw3.h */
#if !defined(FFTW_HAS_FFTW3F_THREADS) || !defined(FFTW_HAS_FFTW3F_OMP)
%ignore fftwf_init_threads();
%ignore fftwf_plan_with_nthreads(int);
%ignore fftwf_make_planner_thread_safe();
%ignore fftwf_cleanup_threads();
#endif
#if !defined(FFTW_HAS_FFTW3D_THREADS) || !defined(FFTW_HAS_FFTW3D_OMP)
%ignore fftw_init_threads();
%ignore fftw_plan_with_nthreads(int);
%ignore fftw_make_planner_thread_safe();
%ignore fftw_cleanup_threads();
#endif
#if !defined(FFTW_HAS_FFTW3L_THREADS) || !defined(FFTW_HAS_FFTW3L_OMP)
%ignore fftwl_init_threads();
%ignore fftwl_plan_with_nthreads(int);
%ignore fftwl_make_planner_thread_safe();
%ignore fftwl_cleanup_threads();
#endif
#if !defined(FFTW_HAS_FFTW3Q_THREADS) || !defined(FFTW_HAS_FFTW3Q_OMP)
%ignore fftwq_init_threads();
%ignore fftwq_plan_with_nthreads(int);
%ignore fftwq_make_planner_thread_safe();
%ignore fftwq_cleanup_threads();
#endif
%rename(is_) fftw_iodim_do_not_use_me::is;
%rename(is_) fftw_iodim64_do_not_use_me::is;
%include "fftw3.h"
/* fftw3 c++ wrappers */
%include "fft/fftw3.h"
%template(Fftw3f) hysop::fft::Fftw3<float>;
%template(Fftw3d) hysop::fft::Fftw3<double>;
%template(Fftw3l) hysop::fft::Fftw3<long double>;
#ifdef HAS_QUADMATHS
%template(Fftw3q) hysop::fft::Fftw3<__float128>;
#endif
/* fft transforms */
%ignore hysop::fft::operator<<;
%include "fft/transform.h"
%extend hysop::fft::Transform {
const char* __str__() const {
return $self->toString().c_str();
}
}
/* fft extensions */
%ignore hysop::fft::operator<<;
%include "fft/extension.h"
/* fft domain configuration */
%ignore hysop::fft::operator<<;
%ignore hysop::fft::FftDomainConfiguration::operator[];
%include "fft/fftDomainConfiguration.h"
%define INSTANTIATE_FFT_DOMAIN_CONFIG_IMPL(CLASS_NAME,CLASS_TEMPLATE...)
%template(CLASS_NAME) CLASS_TEMPLATE;
%extend CLASS_TEMPLATE {
CLASS_TEMPLATE::ExtensionPair __get_item__(unsigned int k) const {
return $self->operator[](k);
}
const char* __str__() const {
std::stringstream ss;
ss << *($self);
return ss.str().c_str();
}
}
%enddef
%define INSTANTIATE_FFT_DOMAIN_CONFIG(INT)
INSTANTIATE_FFT_DOMAIN_CONFIG_IMPL(FftDomainConfiguration ## INT ## D, hysop::fft::FftDomainConfiguration<INT>)
%enddef
%formacro(INSTANTIATE_FFT_DOMAIN_CONFIG, INSTANTIATED_DIMENSIONS)
/* hysop++ */
%include "utils.i"
%include "domain.i"
%include "fft.i"
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