Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • am-dept/amfe
  • Paul.Dechamps/amfe
2 results
Show changes
Commits on Source (43)
Showing with 66 additions and 235 deletions
default:
image: rboman/waves-py3:2020.3
image: rboman/waves-py3:latest
before_script:
- source /opt/intel/mkl/bin/mklvars.sh intel64
- source /opt/intel/tbb/bin/tbbvars.sh intel64
- source /opt/intel/oneapi/mkl/latest/env/vars.sh
- source /opt/intel/oneapi/tbb/latest/env/vars.sh
- echo $(nproc)
- printenv | sort
......@@ -19,7 +19,7 @@ format:
<<: *global_tag_def
stage: build
script:
- clang-format --version # we use clang-format-10 exclusively
- clang-format --version # the user should use this version too!
- ./scripts/format_code.py
- mkdir -p patches
- if git diff --patch --exit-code > patches/clang-format.patch; then echo "Clang format changed nothing"; else echo "Clang format found changes to make!"; false; fi
......
# Copyright 2020 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if(NOT MPI4PY_INCLUDE_DIR)
execute_process(COMMAND
"${PYTHON_EXECUTABLE}" "-c" "import mpi4py; print(mpi4py.get_include())"
OUTPUT_VARIABLE MPI4PY_INCLUDE_DIR
RESULT_VARIABLE MPI4PY_COMMAND_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(MPI4PY_COMMAND_RESULT)
message("waves/CMake/FindMPI4PY: mpi4py not found")
set(MPI4PY_FOUND FALSE)
else(MPI4PY_COMMAND_RESULT)
if (MPI4PY_INCLUDE_DIR MATCHES "Traceback")
message("waves/CMake/FindMPI4PY: mpi4py matches traceback")
## Did not successfully include MPI4PY
set(MPI4PY_FOUND FALSE)
else (MPI4PY_INCLUDE_DIR MATCHES "Traceback")
## successful
set(MPI4PY_FOUND TRUE)
set(MPI4PY_INCLUDE_DIR ${MPI4PY_INCLUDE_DIR} CACHE STRING "mpi4py include path")
endif (MPI4PY_INCLUDE_DIR MATCHES "Traceback")
endif(MPI4PY_COMMAND_RESULT)
else(NOT MPI4PY_INCLUDE_DIR)
set(MPI4PY_FOUND TRUE)
endif(NOT MPI4PY_INCLUDE_DIR)
# ----------------------------------------------------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPI4PY DEFAULT_MSG
MPI4PY_INCLUDE_DIR)
......@@ -78,7 +78,7 @@ SET(TBB_CXX_FLAGS_DEBUG "-DTBB_USE_THREADING_TOOLS=1 -DTBB_USE_DEBUG=1")
# --- List of libraries to be found ---
IF(DEFINED ENV{ONEAPI_ROOT})
IF(DEFINED ENV{ONEAPI_ROOT} AND MSVC)
set(_TBB_TBBLIB_NAME "tbb12")
ELSE()
set(_TBB_TBBLIB_NAME "tbb")
......@@ -245,37 +245,37 @@ unset(_TBB_INCLUDE_DIRS CACHE)
# Versions
# ----------------------------------------------------------------------------
SET(_TBB_VERSION_INTERFACE ${TBB_VERSION_INTERFACE})
IF( (NOT TBB_VERSION_INTERFACE) AND TBB_INCLUDE_DIRS AND NOT DEFINED ENV{ONEAPI_ROOT})
FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _FILE)
set(_TBB_VERSION_MAJOR 0)
set(_TBB_VERSION_MINOR 0)
STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" _TBB_VERSION_INTERFACE "${_FILE}")
# Find file containing version info and read the version
IF(EXISTS "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h")
FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _FILE) # older TBB
STRING(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" _TBB_VERSION_MAJOR "${_FILE}")
STRING(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" _TBB_VERSION_MINOR "${_FILE}")
set(_TBB_VERSION_STRING "${_TBB_VERSION_MAJOR}.${_TBB_VERSION_MINOR}")
unset(_FILE)
SET(TBB_VERSION ${_TBB_VERSION_MAJOR}.${_TBB_VERSION_MINOR})
ELSEIF(EXISTS "${TBB_INCLUDE_DIRS}/oneapi/tbb/version.h")
FILE(READ "${TBB_INCLUDE_DIRS}/oneapi/tbb/version.h" _FILE) # newer oneTBB
STRING(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" _TBB_VERSION_MAJOR "${_FILE}")
STRING(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" _TBB_VERSION_MINOR "${_FILE}")
STRING(REGEX REPLACE ".*#define TBB_VERSION_PATCH ([0-9]+).*" "\\1" _TBB_VERSION_PATCH "${_FILE}")
SET(TBB_VERSION ${_TBB_VERSION_MAJOR}.${_TBB_VERSION_MINOR}.${_TBB_VERSION_PATCH})
ELSE()
MESSAGE(STATUS "TBB_LIBRARIES: ${TBB_LIBRARIES}")
MESSAGE(STATUS "TBB_INCLUDE_DIRS: ${TBB_INCLUDE_DIRS}")
MESSAGE(FATAL_ERROR "Cannot find version file in ${TBB_INCLUDE_DIRS}/tbb.")
ENDIF()
IF(NOT TBB_VERSION_INTERFACE)
SET(TBB_VERSION_INTERFACE ${_TBB_VERSION_INTERFACE} CACHE STRING "" FORCE)
SET(TBB_VERSION_MAJOR ${_TBB_VERSION_MAJOR} CACHE INTERNAL "" FORCE)
SET(TBB_VERSION_MINOR ${_TBB_VERSION_MINOR} CACHE INTERNAL "" FORCE)
SET(TBB_VERSION_STRING ${_TBB_VERSION_STRING} CACHE STRING "" FORCE)
mark_as_advanced(TBB_VERSION_INTERFACE)
mark_as_advanced(TBB_VERSION_MAJOR)
mark_as_advanced(TBB_VERSION_MINOR)
mark_as_advanced(TBB_VERSION_STRING)
# If file has been found, also read the interface version
STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" _TBB_INTERFACE_VERSION "${_FILE}")
SET(TBB_INTERFACE_VERSION ${_TBB_INTERFACE_VERSION} CACHE STRING "" FORCE)
IF (_VERB)
MESSAGE(STATUS "TBB version: ${TBB_VERSION} (${TBB_INTERFACE_VERSION})")
ENDIF()
# ----------------------------------------------------------------------------
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set TBB_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(TBB DEFAULT_MSG
TBB_LIBRARIES TBB_INCLUDE_DIRS
TBB_LIB_PATH TBB_LIB_PATH_DEBUG)
#MESSAGE(STATUS "TBB_FOUND = ${TBB_FOUND}")
find_package_handle_standard_args(TBB
REQUIRED_VARS TBB_LIBRARIES TBB_INCLUDE_DIRS TBB_LIB_PATH TBB_LIB_PATH_DEBUG
VERSION_VAR TBB_VERSION)
# ----------------------------------------------------------------------------
unset(_VERB)
# Copyright 2020 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#SET(CMAKE_GENERATOR "CodeBlocks - Unix Makefiles" CACHE INTERNAL "" FORCE)
SET(MKL_LIB_PATH "/opt/intel/mkl/lib/intel64;/opt/intel/lib/intel64" CACHE PATH "" FORCE)
SET(MKL_INCLUDE_PATH "/opt/intel/mkl/include" CACHE PATH "" FORCE)
# Copyright 2020 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SET(CMAKE_CXX_COMPILER "icpc" CACHE FILEPATH "" FORCE)
SET(CMAKE_C_COMPILER "icc" CACHE FILEPATH "" FORCE)
SET(MKL_LIB_PATH "/opt/intel/composerxe/mkl/lib/intel64;/opt/intel/composerxe/lib/intel64" CACHE PATH "" FORCE)
SET(MKL_INCLUDE_PATH "/opt/intel/composerxe/mkl/include" CACHE PATH "" FORCE)
# Copyright 2020 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SET(CMAKE_CXX_COMPILER "icpc" CACHE FILEPATH "" FORCE)
SET(CMAKE_C_COMPILER "icc" CACHE FILEPATH "" FORCE)
SET(MKL_LIB_PATH "/opt/intel/composerxe/mkl/lib/intel64;/opt/intel/composerxe/lib/intel64" CACHE PATH "" FORCE)
SET(MKL_INCLUDE_PATH "/opt/intel/composerxe/mkl/include" CACHE PATH "" FORCE)
......@@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
find_path(NUMPY_INCLUDE_DIR "numpy/arrayobject.h")
# "maclam" is the mac of R Boman
# ----------------------------------------------------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(NUMPY DEFAULT_MSG
NUMPY_INCLUDE_DIR)
# set custom python
SET(Python3_ROOT_DIR "/Library/Frameworks/Python.framework/Versions/3.7" CACHE PATH "" FORCE)
# Copyright 2020 University of Liège
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FIND_PROGRAM(CMAKE_CXX_COMPILER NAMES icpc)
FIND_PROGRAM(CMAKE_C_COMPILER NAMES icc)
# force to look for mkl
SET(BLA_VENDOR "Intel10_64lp" CACHE STRING "" FORCE)
# Trilinos not available on spring
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
INCLUDE(disable-trilinos)
......@@ -14,8 +14,3 @@
FIND_PROGRAM(CMAKE_CXX_COMPILER NAMES clang++)
FIND_PROGRAM(CMAKE_C_COMPILER NAMES clang)
# vtk for py3
SET(VTK_DIR "/opt/vtk/lib/cmake/vtk-7.1" CACHE PATH "" FORCE)
# Trilinos not compiling with clang (check to wiki to fix)
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
INCLUDE(disable-trilinos)
......@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Disable Trilinos (we should test with Trilinos/clang)
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
INCLUDE(disable-trilinos)
SET(CMAKE_CXX_COMPILER "icpc" CACHE FILEPATH "" FORCE)
SET(CMAKE_C_COMPILER "icc" CACHE FILEPATH "" FORCE)
# This file is used when PFEM is compiled on Windows x64
# with Luc Papeleux's precompiled libraries
SET(CMAKE_INSTALL_PREFIX "../waves_INSTALL" CACHE PATH "" FORCE)
STRING(REGEX REPLACE "\\\\" "/" MYLIBS $ENV{METAFORLIBS})
SET(CMAKE_GENERATOR "Visual Studio 15 2017 Win64" CACHE INTERNAL "" FORCE)
SET(PYTHON_INCLUDE_DIR "${MYLIBS}/Python/include" CACHE PATH "" FORCE)
SET(PYTHON_LIBRARY "${MYLIBS}/Python/Libs/python37.lib" CACHE FILEPATH "" FORCE)
SET(PYTHON_RELEASE_LIBRARY "${MYLIBS}/Python/Libs/python37.lib" CACHE FILEPATH "" FORCE)
SET(PYTHON_DEBUG_LIBRARY "${MYLIBS}/Python/Libs/python37_d.lib" CACHE FILEPATH "" FORCE)
# Disable Trilinos (we should test with Trilinos/clang)
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
INCLUDE(disable-trilinos)
......@@ -15,11 +15,7 @@
# ----------------------------------------------------------------------------
PROJECT(amfe)
# ----------------------------------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
IF(${CMAKE_VERSION} VERSION_GREATER "3.14.0") # we might want to update the project and use the NEW behavior here
cmake_policy(SET CMP0078 OLD)
cmake_policy(SET CMP0086 OLD)
ENDIF()
CMAKE_MINIMUM_REQUIRED(VERSION 3.14)
# -- I/O
# Lib/Exe dir
......@@ -66,17 +62,12 @@ OPTION(USE_MUMPS "Compile with MUMPS" ON)
# -- DEPENDENCIES
# Python
IF (CMAKE_VERSION VERSION_LESS 3.12.0)
FIND_PACKAGE(PythonInterp 3.6 REQUIRED)
FIND_PACKAGE(PythonLibs 3.6 REQUIRED)
ELSE()
FIND_PACKAGE(Python3 COMPONENTS Interpreter Development)
# use Python3_ROOT_DIR if wrong python found (e.g. anaconda)
SET(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
SET(PYTHON_LIBRARIES ${Python3_LIBRARIES})
SET(PYTHON_INCLUDE_PATH ${Python3_INCLUDE_DIRS})
SET(PYTHONLIBS_VERSION_STRING ${Python3_VERSION})
ENDIF()
# use Python3_ROOT_DIR if wrong python found (e.g. anaconda)
FIND_PACKAGE(Python3 COMPONENTS Interpreter Development)
SET(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
SET(PYTHON_LIBRARIES ${Python3_LIBRARIES})
SET(PYTHON_INCLUDE_PATH ${Python3_INCLUDE_DIRS})
SET(PYTHONLIBS_VERSION_STRING ${Python3_VERSION})
MESSAGE(STATUS "PYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE}")
MESSAGE(STATUS "PYTHON_LIBRARIES:FILEPATH=${PYTHON_LIBRARIES}")
MESSAGE(STATUS "PYTHON_INCLUDE_PATH:FILEPATH=${PYTHON_INCLUDE_PATH}")
......@@ -87,7 +78,7 @@ MESSAGE(STATUS "Python_FRAMEWORKS=${Python_FRAMEWORKS}")
# SWIG
FIND_PACKAGE(SWIG REQUIRED)
IF(CMAKE_GENERATOR MATCHES "Visual Studio") # not MSVC because of nmake & jom
SET(CMAKE_SWIG_OUTDIR "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/")
SET(CMAKE_SWIG_OUTDIR "${EXECUTABLE_OUTPUT_PATH}/$(Configuration)/")
ELSE()
SET(CMAKE_SWIG_OUTDIR "${EXECUTABLE_OUTPUT_PATH}")
ENDIF()
......@@ -123,6 +114,7 @@ ENABLE_TESTING()
# Default install location -> user's python site-packages
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -m site --user-site OUTPUT_VARIABLE PY_SITE OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REGEX REPLACE "\\\\" "/" PY_SITE ${PY_SITE})
SET(CMAKE_INSTALL_PREFIX "${PY_SITE}/amfe" CACHE STRING "Install location" FORCE)
ENDIF()
# RPATH for Linux
......
......@@ -19,28 +19,16 @@ INCLUDE(${SWIG_USE_FILE})
FILE(GLOB SRCS *.h *.cpp *.inl *.swg)
FILE(GLOB ISRCS *.i)
SET(CMAKE_SWIG_FLAGS "")
SET_SOURCE_FILES_PROPERTIES(${ISRCS} PROPERTIES CPLUSPLUS ON)
SET(SWINCFLAGS
-I${PROJECT_SOURCE_DIR}/fwk/src
)
SET_SOURCE_FILES_PROPERTIES(${ISRCS} PROPERTIES SWIG_FLAGS "${SWINCFLAGS}")
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
SWIG_ADD_MODULE(fwkw python ${ISRCS} ${SRCS})
else()
SWIG_ADD_LIBRARY(fwkw LANGUAGE python SOURCES ${ISRCS} ${SRCS})
endif()
MACRO_DebugPostfix(_fwkw)
TARGET_INCLUDE_DIRECTORIES(_fwkw PRIVATE ${PROJECT_SOURCE_DIR}/fwk/_src
${PYTHON_INCLUDE_PATH}
)
SWIG_LINK_LIBRARIES(fwkw
fwk ${PYTHON_LIBRARIES}
)
INSTALL(FILES ${CMAKE_SWIG_OUTDIR}/fwkw.py DESTINATION ${CMAKE_INSTALL_PREFIX})
INSTALL(TARGETS _fwkw DESTINATION ${CMAKE_INSTALL_PREFIX})
SET(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} "-interface" "_fwkw") # avoids "import _module_d" with MSVC/Debug
SWIG_ADD_LIBRARY(fwkw LANGUAGE python SOURCES ${ISRCS} ${SRCS})
SET_PROPERTY(TARGET fwkw PROPERTY SWIG_USE_TARGET_INCLUDE_DIRECTORIES ON)
MACRO_DebugPostfix(fwkw)
TARGET_INCLUDE_DIRECTORIES(fwkw PRIVATE ${PROJECT_SOURCE_DIR}/fwk/_src
${PYTHON_INCLUDE_PATH})
TARGET_LINK_LIBRARIES(fwkw PRIVATE fwk ${PYTHON_LIBRARIES})
INSTALL(FILES "${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE}/fwkw.py"
DESTINATION ${CMAKE_INSTALL_PREFIX})
INSTALL(TARGETS fwkw DESTINATION ${CMAKE_INSTALL_PREFIX})
......@@ -43,6 +43,11 @@ threads="1"
%include "fwkw.swg"
// Instantiate some std templates
namespace std {
%template(std_vector_double) std::vector<double>;
}
%include "fwk.h"
//%#define SHARED_PTR_DISOWN $disown
......
......@@ -49,7 +49,7 @@ protected:
virtual std::streamsize xsputn(const char *s, std::streamsize n);
virtual int_type overflow(int c);
};
#endif //SWIG
#endif // SWIG
/**
* @brief redirect std::cout/std::cerr to python sys.stdout/sys.stderr
......@@ -66,4 +66,4 @@ public:
static void test();
};
#endif //CPPBUF2PY_H
#endif // CPPBUF2PY_H
......@@ -34,7 +34,7 @@ FWK_API void testswig(bool i) // testswig(3.0) displays 1 (no error and cast flo
/**
* @brief Enable Floating Point Exception
*
*
* Imported from Metafor
* @authors Adrien Crovato
*/
......@@ -55,7 +55,7 @@ FWK_API void enableFpe()
#else // defined(WIN32)
std::cout << ANSI_COLOR_YELLOW << "Floating-Point Exceptions not implemented for this compiler!" << ANSI_COLOR_RESET << std::endl;
#endif
#endif //!defined(__MINGW32__)
#endif //! defined(__MINGW32__)
}
/**
......
......@@ -64,4 +64,4 @@ FWK_API void testswig(bool i);
FWK_API void enableFpe();
FWK_API void disableFpe();
#endif //FWK_H
#endif // FWK_H
......@@ -41,4 +41,4 @@ public:
} // namespace fwk
#endif //WEXTRACT_H
#endif // WEXTRACT_H
......@@ -43,4 +43,4 @@ public:
};
} // namespace fwk
#endif //WHMSTIME_H
#endif // WHMSTIME_H
......@@ -71,4 +71,4 @@ public:
} // namespace fwk
#endif //WOBJECT_H
#endif // WOBJECT_H