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

reorg, CMakeLists

parent 7b473a6a
No related branches found
No related tags found
No related merge requests found
#=======================================================
# cmake utility to compile and install Parmes library
# cmake utility to compile,link and install :
# - parmes library (libparmes...)
# - parmesscales library particular solver from scales, (libparmesscales...)
#
# parmes may (optionally) depends on :
# - parmesscales (USE_SCALES=ON, default)
# - ppm-core (USE_PPM=ON, default=OFF)
# - ppm-numerics (USE_PPMNumerics, default=OFF)
#
# F. Pérignon, 17 fev 2011
#
......@@ -23,12 +30,12 @@ include(MyTools)
# User defined options
option(VERBOSE_MODE "enable verbose mode for cmake exec. Default = on" ON)
option(USE_PPM "link parmes with ppm when this mode is enable. Default = on." ON)
option(USE_MPI "compile and link parmes with mpi when this mode is enable. Default = on." ON)
option(USE_PPM "link Parmes with PPM library (core component). Default = on." ON)
option(USE_PPMNumerics "link Parmes with PPM-numerics. Default = off" ON)
option(WITH_SCALES "compile/create parmesscales lib and link it with Parmes. Default = on." ON)
option(WITH_PPM "link Parmes with PPM library (core component). Default = off." OFF)
option(WITH_PPMNumerics "link Parmes with PPM-numerics. Default = off" OFF)
option(DOUBLEPREC "set precision for real numbers to double precision when this mode is enable. Default = on." ON)
option(WITH_TESTS "Enable testing. Default = on" OFF)
option(WITH_TESTS "Enable testing. Default = off" OFF)
option(BUILD_SHARED_LIBS "Enable dynamic library build, default = ON" ON)
# cmake project name
......@@ -43,24 +50,25 @@ set(PROJECT_LIBRARY_NAME ${PROJECT_NAME})
# --- The name of the exe to be created (test purpose)
# This exe will be linked with libPROJECT_LIBRARY_NAME
set(EXE_NAME ${PROJECT_NAME}Run)
# The list of all dirs containing sources to be compiled for the Parmes lib
# Any file in those dirs will be used to create libparmes
set(${PROJECT_LIBRARY_NAME}_SRCDIRS
src
src/interfaces/Fortran2Cpp
src/poisson
#src/interfaces/Fortran2Cpp
# src/interfaces/ppm
)
# A main file to create an executable (test purpose)
# Any files in these dirs will be used to create Parmes exec (linked with libparmes)
set(${EXE_NAME}_SRCDIRS src/main src/main/poisson)
set(${EXE_NAME}_SRCDIRS src/main)
# Matching expr for files to be compiled.
set(EXTS *.cxx *.f90 *.f95)
set(EXTS *.f90 *.f95)
# Matching expr for headers (install purpose)
set(EXTS_HDRS *.hpp *.h)
# Note FP : we can also use cmake vars ${CMAKE_Fortran_SOURCE_FILE_EXTENSIONS} ${CMAKE_C_SOURCE_FILE_EXTENSIONS} ${CMAKE_CXX_SOURCE_FILE_EXTENSIONS}
# ============= The project =============
# Set project name and project languages
# => this automatically defines:
......@@ -68,7 +76,7 @@ set(EXTS_HDRS *.hpp *.h)
# - ${PROJECT_NAME}_SOURCE_DIR : where sources (.f and .h and this CMakeLists.txt) are located
# Note that because of OutOfSourceBuild, binary_dir and source_dir must be different.
project(${PROJECT_NAME} CXX C Fortran)
project(${PROJECT_NAME} Fortran)
# ============= Tests =============
if(WITH_TESTS)
......@@ -80,80 +88,69 @@ endif(WITH_TESTS)
# set the compile/link conf (-I and -L opt)
# --- Boost ---
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
#set(Boost_ADDITIONAL_VERSIONS "1.49" "1.49.0")
#set(Boost_NO_SYSTEM_PATHS ON)
#find_package(Boost REQUIRED)
#include_directories(${Boost_INCLUDE_DIRS})
# ============= Prepare compilation =============
# Force a default build type if not provided by user
# CMAKE_BUILD_TYPE = empty, Debug, Release, RelWithDebInfo or MinSizeRel.
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RELEASE CACHE STRING "Choose the type of build, options are: None, Debug, Release, RelWithDebInfo or MinSizeRel." FORCE)
endif (NOT CMAKE_BUILD_TYPE)
# If the project uses Fortran ...
# Set module files directory (i.e. where .mod will be created)
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/Modules)
# Add compilation flags:
append_Fortran_FLAGS("-Wall")
# --- MPI ---
if(USE_MPI)
# Find MPI for C++ and fortran.
find_package(MPI REQUIRED)
# -I
include_directories(${MPI_INCLUDE_PATH})
include_directories(${MPI_Fortran_INCLUDE_PATH})
# Add compilation flags
append_cxx_flags(${MPI_COMPILE_FLAGS})
set(${PROJECT_NAME}_LINK_FLAGS ${${PROJECT_NAME}_LINK_FLAGS} ${MPI_LINK_FLAGS})
set(${PROJECT_NAME}_LINK_FLAGS ${${PROJECT_NAME}_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS})
# -I
include_directories(${MPI_Fortran_INCLUDE_PATH})
# Add compilation flags
append_Fortran_flags(${MPI_Fortran_COMPILE_FLAGS})
set(${PROJECT_NAME}_LINK_FLAGS ${${PROJECT_NAME}_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS})
#endif(MPI_Fortran_COMPILER)
set(LIBS ${LIBS} ${MPI_LIBRARIES} ${MPI_Fortran_LIBRARIES} )
#set(${PROJECT_NAME}_LINK_FLAGS ${${PROJECT_NAME}_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS})
set(LIBS ${LIBS} ${MPI_Fortran_LIBRARIES} )
endif(USE_MPI)
# --- PPM Core ---
if(USE_PPM)
find_package(PPMCore 1.2 REQUIRED)
include_directories(${PPMCore_INCLUDE_DIRS})
set(LIBS ${LIBS} ${PPMCore_LIBRARY})
if(VERBOSE_MODE)
message(STATUS "Found PPM version ${PPMCore_VERSION}: ${PPMCore_LIBRARY}")
message(STATUS "PPM headers location: ${PPMCore_INCLUDE_DIRS}")
endif(VERBOSE_MODE)
# --- scales ---
if(WITH_SCALES)
add_subdirectory(src/scalesInterface)
endif()
# --- PPM Numerics ---
if(USE_PPMNumerics)
find_package(PPMNumerics 1.2 REQUIRED)
include_directories(${PPMNumerics_INCLUDE_DIRS})
# include_directories(${PPMNumerics_MODULE_DIR})
set(LIBS ${LIBS} ${PPMNumerics_LIBRARY})
if(VERBOSE_MODE)
message(STATUS "Found PPMNumerics version ${PPMNUmerics_VERSION}: ${PPMNumerics_LIBRARY}")
message(STATUS "PPMNumerics header location: ${PPMNumerics_INCLUDE_DIRS}")
endif(VERBOSE_MODE)
# --- PPM ---
if(WITH_PPM)
add_subdirectory(src/ppmInterface)
endif()
# ============= Prepare compilation =============
# Force a default build type if not provided by user
# CMAKE_BUILD_TYPE = empty, Debug, Release, RelWithDebInfo or MinSizeRel.
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RELEASE CACHE STRING "Choose the type of build, options are: None, Debug, Release, RelWithDebInfo or MinSizeRel." FORCE)
endif (NOT CMAKE_BUILD_TYPE)
# If the project uses Fortran ...
# Set module files directory (i.e. where .mod will be created)
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/Modules)
# Add compilation flags:
append_Fortran_FLAGS("-Wall")
find_package(FFTW REQUIRED)
include_directories(${FFTW_INCLUDE_DIRS})
set(LIBS ${LIBS} ${FFTW_LIBRARIES})
display(FFTW_LIBRARIES)
# ============= Generates ParmesConfig.hpp =============
# The file PROJECT_NAME_defines.hpp will be generated from config.hpp.cmake;
if(EXISTS ${CMAKE_SOURCE_DIR}/config.hpp.cmake)
if(NOT CONFIG_H_GLOBAL_CONFIGURED)
set(CONFIG_H_GLOBAL_CONFIGURED 1 CACHE BOOL "Parmes_defines.hpp generation." )
configure_file(config.hpp.cmake ${PROJECT_NAME}_defines.hpp)
endif()
include_directories(${CMAKE_BINARY_DIR})
set(CONFIG_H_GLOBAL_CONFIGURED 1 CACHE BOOL "Parmes_defines.hpp generation." )
configure_file(config.hpp.cmake ${PROJECT_NAME}_defines.hpp)
endif()
include_directories(${CMAKE_BINARY_DIR})
endif()
# ============= Source and header files list =============
# We scan all files with matching extension in directories
# containing sources.
# Source and header files list:
foreach(_DIR ${${PROJECT_LIBRARY_NAME}_SRCDIRS})
set(_DIR_FILES)
......@@ -200,10 +197,10 @@ include_directories(${CMAKE_Fortran_MODULE_DIRECTORY})
# Cmake tools to handle fortran-c interface. It will generate F2CMangle.hpp, a file
# that will contain some useful macros to deal with fortran-C name mangling.
# See cmake doc for this module.
include(FortranCInterface)
FortranCInterface_HEADER(${CMAKE_Fortran_MODULE_DIRECTORY}/F2CMangle.hpp
MACRO_NAMESPACE "F2C_"
SYMBOL_NAMESPACE "F2C_")
#include(FortranCInterface)
#FortranCInterface_HEADER(${CMAKE_Fortran_MODULE_DIRECTORY}/F2CMangle.hpp
# MACRO_NAMESPACE "F2C_"
# SYMBOL_NAMESPACE "F2C_")
# ============= Creates the library =============
if(BUILD_SHARED_LIBS) # shared library
......@@ -222,9 +219,6 @@ add_dependencies(${EXE_NAME} ${PROJECT_LIBRARY_NAME})
target_link_libraries(${EXE_NAME} ${PROJECT_LIBRARY_NAME})
target_link_libraries(${EXE_NAME} ${LIBS})
# CXX is used as linker language
set_target_properties(${EXE_NAME} ${PROJECT_LIBRARY_NAME} PROPERTIES LINKER_LANGUAGE CXX)
# ============== Add tests ==============
if(WITH_TESTS)
message(STATUS "Enable testing ...")
......@@ -232,6 +226,10 @@ if(WITH_TESTS)
new_test(testAllocatedPtr userMod.f90 wrapper.f90 testAllocatedPtr.cxx)
new_test(testNullPtr userMod.f90 wrapper.f90 testNullPtr.cxx)
end_test()
begin_test(src/tests/Particles)
new_test(testCreate3D testCreate3D.f90)
new_test(testCreate2D testCreate2D.f90)
end_test()
endif(WITH_TESTS)
# ============= Prepare install =============
......@@ -239,9 +237,9 @@ endif(WITH_TESTS)
# The library
# The library, the headers and mod files, the cmake generated files
# 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}
#RUNTIME DESTINATION bin # executables
......@@ -252,7 +250,7 @@ install_package(${PACKAGE_NAME} ${PROJECT_LIBRARY_NAME} ${${PROJECT_NAME}_HDRS})
# --------------------------------------------
# do not skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
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)
......@@ -268,7 +266,9 @@ if(VERBOSE_MODE)
message(STATUS " Compiler : ${CMAKE_Fortran_COMPILER}")
message(STATUS " Sources are in : ${CMAKE_SOURCE_DIR}")
message(STATUS " Project uses MPI : ${USE_MPI}")
message(STATUS " Project uses PPM : ${USE_PPM}")
message(STATUS " Project uses Scales : ${WITH_SCALES}")
message(STATUS " Project uses PPM : ${WITH_PPM}")
message(STATUS " Project will be installed in ${CMAKE_INSTALL_PREFIX}")
message(STATUS "====================== ======= ======================")
endif()
......@@ -613,7 +613,8 @@ WARN_LOGFILE =
# with spaces.
INPUT = ../src/main \
.
. \
../src
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
......@@ -886,13 +887,13 @@ HTML_STYLESHEET =
# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
# The allowed range is 0 to 359.
HTML_COLORSTYLE_HUE = 113
HTML_COLORSTYLE_HUE = 102
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
# the colors in the HTML output. For a value of 0 the output will use
# grayscales only. A value of 255 will produce the most vivid colors.
HTML_COLORSTYLE_SAT = 115
HTML_COLORSTYLE_SAT = 125
# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
# the luminance component of the colors in the HTML output. Values below
......@@ -901,7 +902,7 @@ HTML_COLORSTYLE_SAT = 115
# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
# and 100 does not change the gamma.
HTML_COLORSTYLE_GAMMA = 112
HTML_COLORSTYLE_GAMMA = 101
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting
......@@ -1569,7 +1570,7 @@ DOT_FONTNAME = Helvetica
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
# The default size is 10pt.
DOT_FONTSIZE = 10
DOT_FONTSIZE = 24
# By default doxygen will tell dot to use the output directory to look for the
# FreeSans.ttf font (which doxygen will put there itself). If you specify a
......
......@@ -6,11 +6,15 @@ implicit none
integer :: info
call MPI_Init(info)
call MPI_COMM_RANK(MPI_COMM_WORLD,rank,info)
call MPI_COMM_SIZE(MPI_COMM_WORLD,nbprocs,info)
print *, "hello ..."
call MPI_Finalize(info)
end program mainParmes
......@@ -5,9 +5,9 @@ module poisson
use client_data
use client_topology, only : createTopologyY,getPPMLocalResolution,topoY
!use client_topology, only : createTopologyY,getPPMLocalResolution,topoY
use ppm_module_map
!use ppm_module_map
use Domain
......@@ -92,7 +92,7 @@ contains
coefFFT = 2.*pi/lengths(1:dime)
!> Create a fftw-dedicated topology
call createTopologyY(topoFFTid,meshFFTid,physDomainLowerPoint,physDomainUpperPoint,domain_bc,resolution)
!!!! Comment to remove ppm call createTopologyY(topoFFTid,meshFFTid,physDomainLowerPoint,physDomainUpperPoint,domain_bc,resolution)
end subroutine initFFTW2D
......@@ -236,7 +236,7 @@ contains
integer,dimension(dim3) :: resolTmp
resolTmp = getPPMLocalResolution(topoY,meshFFTid)
!!!!!!! Comment to remove ppm ... resolTmp = getPPMLocalResolution(topoY,meshFFTid)
!! fftField = 0.0
!!$ ! Input field
......@@ -251,10 +251,10 @@ contains
print *, rank, "test sizes ...",shape(fftField),"///",shape(fieldIn)
call ppm_map_field_global(fromtopo,topoFFTid,frommesh,meshFFTid,info)
call ppm_map_field_push(fromtopo,frommesh,fieldIn,info)
call ppm_map_field_send(info)
call ppm_map_field_pop(topoFFTid,meshFFTid,fftField,zeros,info)
!!!!!!! Comment to remove ppm call ppm_map_field_global(fromtopo,topoFFTid,frommesh,meshFFTid,info)
!!!!!!! Comment to remove ppm call ppm_map_field_push(fromtopo,frommesh,fieldIn,info)
!!!!!!! Comment to remove ppm call ppm_map_field_send(info)
!!!!!!! Comment to remove ppm call ppm_map_field_pop(topoFFTid,meshFFTid,fftField,zeros,info)
!!$ do j = 1,grid_resolution(c_Y)
!!$ print *, rank,j, 'f in', fieldIn(:,j,1)
!!$ end do
......
......@@ -7,12 +7,12 @@
module Solver
use client_data, only: mk, dime,rank
use ppm_module_numerics_data, only: ppm_param_eq_poisson, ppm_param_smooth_rbsor
use ppm_module_poisson, only: ppm_poisson_init, ppm_poisson_plan, ppm_poisson_grn_pois_per, ppm_poisson_solve, &
ppm_poisson_drv_curl_fd2, ppm_poisson_drv_curl_fd4, ppm_poisson_drv_none
use client_topology
use ppm_module_typedef, only : ppm_param_mesh_coarsen
use ppm_module_mesh_derive, only: ppm_mesh_derive
!!!!!!! Comment to remove ppm use ppm_module_numerics_data, only: ppm_param_eq_poisson, ppm_param_smooth_rbsor
!!!!!!! Comment to remove ppm use ppm_module_poisson, only: ppm_poisson_init, ppm_poisson_plan, ppm_poisson_grn_pois_per, ppm_poisson_solve, &
!!!!!!! Comment to remove ppm ppm_poisson_drv_curl_fd2, ppm_poisson_drv_curl_fd4, ppm_poisson_drv_none
!!!!!!! Comment to remove ppm use client_topology
!!!!!!! Comment to remove ppm use ppm_module_typedef, only : ppm_param_mesh_coarsen
!!!!!!! Comment to remove ppm use ppm_module_mesh_derive, only: ppm_mesh_derive
! use ppmljk_poisson
!! All multigrid stuff ...
......@@ -23,7 +23,7 @@ module Solver
private
public :: init_poisson_solver, solve_poisson, ppm_poisson_drv_curl_fd2, ppm_poisson_drv_curl_fd4, ppm_poisson_drv_none
public :: init_poisson_solver, solve_poisson!!!, ppm_poisson_drv_curl_fd2, ppm_poisson_drv_curl_fd4, ppm_poisson_drv_none
type(ppm_poisson_plan),pointer :: fftwplanForppm => NULL()
......
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