Commit 871fcd90 authored by Michel Henry's avatar Michel Henry
Browse files

resolve merge conflict

parents 77e28f41 9b980cb4
Pipeline #9858 passed with stages
in 49 minutes and 52 seconds
......@@ -20,28 +20,30 @@
# see <http://www.gnu.org/licenses/>.
mfbuild :
image : immc/migflow-build:v0.6
image : immc/migflow-build:v0.14
stage : build
script:
# linux
- mkdir build
- cd build/
- cmake ..
- cmake .. -DCMAKE_SKIP_BUILD_RPATH=FALSE -DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE -DCMAKE_INSTALL_RPATH='${ORIGIN}'
- make -j4
- echo 'cp $(ldd migflow/libmbfluid3.so | awk "/(blas|gomp|gfortran|quadmath)/ {print \$3}") migflow'| bash
- python3 setup.py bdist_wheel --plat-name=manylinux1_x86_64 -d ../dist
- cd ..
- cd ..
# windows
- mkdir build-mingw
- cd build-mingw
- cmake .. -DCMAKE_TOOLCHAIN_FILE=/cmake-mingw
- cmake .. -DCMAKE_TOOLCHAIN_FILE=/cmake-mingw -DBLAS_LIBRARIES=/mingw64/bin/libopenblas.dll -DLAPACK_LIBRARIES=/mingw64/bin/libopenblas.dll
- make -j4
- mv */*.dll */*.dll.a migflow
- cp /mingw64/bin/libopenblas.dll migflow
- python3 setup.py bdist_wheel --plat-name=win_amd64 -d ../dist
- cd ..
# OSX
- mkdir build-osxcross
- cd build-osxcross
- $(osxcross-conf) && cmake .. -DCMAKE_TOOLCHAIN_FILE=/osxcross/target/toolchain.cmake
- $(osxcross-conf) && cmake .. -DCMAKE_TOOLCHAIN_FILE=/osxcross/target/toolchain-gcc.cmake
- make -j4
- python3 setup.py bdist_wheel --plat-name=macosx_10_9_x86_64 -d ../dist
- cd ..
......
......@@ -21,7 +21,7 @@
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
Project(MigFlow C)
option(BUILD_MUMPS "Build Mumps library and its dependencies" ON)
## Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
......@@ -32,6 +32,35 @@ endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_C_STANDARD 99)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(MUMPS_PACH_COMMAND "")
if(${CMAKE_VERSION} VERSION_LESS "3.20.0")
set(MUMPS_PATCH_COMMAND patch -p1 < ${PROJECT_SOURCE_DIR}/cmake/CMakeMumpsPre3.20.diff)
else()
set(MUMPS_PATCH_COMMAND patch -p1 < ${PROJECT_SOURCE_DIR}/cmake/CMakeMumps.diff)
endif()
if(BUILD_MUMPS)
include(ExternalProject)
find_package(BLAS)
find_package(LAPACK)
ExternalProject_Add(mumps
URL https://github.com/scivision/mumps/archive/refs/tags/v5.4.1.2.tar.gz
PATCH_COMMAND ${MUMPS_PATCH_COMMAND}
CMAKE_ARGS -Dopenmp=true -Darith=d -Dparallel=false -Dscotch=false
-DBUILD_TESTING=false
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/mumps-prefix
-DLAPACK_LIBRARY=${LAPACK_LIBRARIES}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_BUILD_TYPE={CMAKE_BUILD_TYPE}
BUILD_BYPRODUCTS ${MUMPS_LIBRARIES} ${MUMPS_MPISEQ_LIBRARIES})
set(MUMPS_DIR ${CMAKE_BINARY_DIR}/mumps-prefix/)
set(MUMPS_LIB_DIR ${MUMPS_DIR}/lib)
set(MUMPS_INCLUDE_DIR ${MUMPS_DIR}/include)
find_library(GFORTRAN_LIB gfortran)
find_library(QUADMATH_LIB quadmath)
find_package(OpenMP)
set(MUMPS_LIBS ${MUMPS_LIB_DIR}/libdmumps.a ${MUMPS_LIB_DIR}/libmumps_common.a ${MUMPS_LIB_DIR}/libpord.a ${MUMPS_LIB_DIR}/libmpiseq.a ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${METIS_LIBRARY} ${OpenMP_C_LIBRARIES} gfortran quadmath)
endif(BUILD_MUMPS)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/migflow)
......
diff -ruN mumps/CMakeLists.txt mumps-ok/CMakeLists.txt
--- mumps/CMakeLists.txt 2021-10-04 14:31:04.000000000 +0000
+++ mumps-ok/CMakeLists.txt 2021-10-08 14:38:20.823214013 +0000
@@ -47,6 +47,10 @@
configure_file(libseq/CMakeLists.txt ${mumps_SOURCE_DIR}/libseq/ COPYONLY)
add_subdirectory(${mumps_SOURCE_DIR}/libseq ${mumps_BINARY_DIR}/libseq)
set(NUMERIC_LIBS mpiseq)
+ if(openmp)
+ find_package(OpenMP COMPONENTS C Fortran REQUIRED)
+ list(APPEND NUMERIC_LIBS OpenMP::OpenMP_Fortran OpenMP::OpenMP_C)
+ endif()
endif(parallel)
list(APPEND NUMERIC_LIBS LAPACK::LAPACK ${CMAKE_THREAD_LIBS_INIT})
diff -ruN mumps/CMakeLists.txt mumps-ok/CMakeLists.txt
--- mumps/CMakeLists.txt 2021-10-04 14:31:04.000000000 +0000
+++ mumps-ok/CMakeLists.txt 2021-10-08 14:38:20.823214013 +0000
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.20...3.21)
+cmake_minimum_required(VERSION 3.0...3.21)
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/VERSION PROJECT_VERSION
REGEX "^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)" LIMIT_INPUT 16 LENGTH_MAXIMUM 16 LIMIT_COUNT 1)
@@ -47,6 +47,10 @@
configure_file(libseq/CMakeLists.txt ${mumps_SOURCE_DIR}/libseq/ COPYONLY)
add_subdirectory(${mumps_SOURCE_DIR}/libseq ${mumps_BINARY_DIR}/libseq)
set(NUMERIC_LIBS mpiseq)
+ if(openmp)
+ find_package(OpenMP COMPONENTS C Fortran REQUIRED)
+ list(APPEND NUMERIC_LIBS OpenMP::OpenMP_Fortran OpenMP::OpenMP_C)
+ endif()
endif(parallel)
list(APPEND NUMERIC_LIBS LAPACK::LAPACK ${CMAKE_THREAD_LIBS_INIT})
diff -ruN mumps/cmake/Modules/CheckSourceCompiles.cmake mumps-ok/cmake/Modules/CheckSourceCompiles.cmake
--- mumps/cmake/Modules/CheckSourceCompiles.cmake 1970-01-01 00:00:00.000000000 +0000
+++ mumps-ok/cmake/Modules/CheckSourceCompiles.cmake 2021-10-08 14:38:20.823214013 +0000
@@ -0,0 +1,134 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+include_guard(GLOBAL)
+
+cmake_policy(PUSH)
+cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
+cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST
+
+function(CMAKE_CHECK_SOURCE_COMPILES _lang _source _var)
+ if(NOT DEFINED "${_var}")
+
+ if(_lang STREQUAL "C")
+ set(_lang_textual "C")
+ set(_lang_ext "c")
+ elseif(_lang STREQUAL "CXX")
+ set(_lang_textual "C++")
+ set(_lang_ext "cxx")
+ elseif(_lang STREQUAL "CUDA")
+ set(_lang_textual "CUDA")
+ set(_lang_ext "cu")
+ elseif(_lang STREQUAL "Fortran")
+ set(_lang_textual "Fortran")
+ set(_lang_ext "F90")
+ elseif(_lang STREQUAL "HIP")
+ set(_lang_textual "HIP")
+ set(_lang_ext "hip")
+ elseif(_lang STREQUAL "ISPC")
+ set(_lang_textual "ISPC")
+ set(_lang_ext "ispc")
+ elseif(_lang STREQUAL "OBJC")
+ set(_lang_textual "Objective-C")
+ set(_lang_ext "m")
+ elseif(_lang STREQUAL "OBJCXX")
+ set(_lang_textual "Objective-C++")
+ set(_lang_ext "mm")
+ else()
+ message (SEND_ERROR "check_source_compiles: ${_lang}: unknown language.")
+ return()
+ endif()
+
+ get_property (_supported_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
+ if (NOT _lang IN_LIST _supported_languages)
+ message (SEND_ERROR "check_source_compiles: ${_lang}: needs to be enabled before use.")
+ return()
+ endif()
+
+ set(_FAIL_REGEX)
+ set(_SRC_EXT)
+ set(_key)
+ foreach(arg ${ARGN})
+ if("${arg}" MATCHES "^(FAIL_REGEX|SRC_EXT)$")
+ set(_key "${arg}")
+ elseif(_key STREQUAL "FAIL_REGEX")
+ list(APPEND _FAIL_REGEX "${arg}")
+ elseif(_key STREQUAL "SRC_EXT")
+ set(_SRC_EXT "${arg}")
+ set(_key "")
+ else()
+ message(FATAL_ERROR "Unknown argument:\n ${arg}\n")
+ endif()
+ endforeach()
+
+ if(NOT _SRC_EXT)
+ set(_SRC_EXT ${_lang_ext})
+ endif()
+
+ if(CMAKE_REQUIRED_LINK_OPTIONS)
+ set(CHECK_${LANG}_SOURCE_COMPILES_ADD_LINK_OPTIONS
+ LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS})
+ else()
+ set(CHECK_${LANG}_SOURCE_COMPILES_ADD_LINK_OPTIONS)
+ endif()
+ if(CMAKE_REQUIRED_LIBRARIES)
+ set(CHECK_${LANG}_SOURCE_COMPILES_ADD_LIBRARIES
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
+ else()
+ set(CHECK_${LANG}_SOURCE_COMPILES_ADD_LIBRARIES)
+ endif()
+ if(CMAKE_REQUIRED_INCLUDES)
+ set(CHECK_${LANG}_SOURCE_COMPILES_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ else()
+ set(CHECK_${LANG}_SOURCE_COMPILES_ADD_INCLUDES)
+ endif()
+ file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}"
+ "${_source}\n")
+
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(CHECK_START "Performing Test ${_var}")
+ endif()
+ try_compile(${_var}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
+ COMPILE_DEFINITIONS -D${_var} ${CMAKE_REQUIRED_DEFINITIONS}
+ ${CHECK_${LANG}_SOURCE_COMPILES_ADD_LINK_OPTIONS}
+ ${CHECK_${LANG}_SOURCE_COMPILES_ADD_LIBRARIES}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CMAKE_REQUIRED_FLAGS}
+ "${CHECK_${LANG}_SOURCE_COMPILES_ADD_INCLUDES}"
+ OUTPUT_VARIABLE OUTPUT)
+
+ foreach(_regex ${_FAIL_REGEX})
+ if("${OUTPUT}" MATCHES "${_regex}")
+ set(${_var} 0)
+ endif()
+ endforeach()
+
+ if(${_var})
+ set(${_var} 1 CACHE INTERNAL "Test ${_var}")
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(CHECK_PASS "Success")
+ endif()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Performing ${_lang_textual} SOURCE FILE Test ${_var} succeeded with the following output:\n"
+ "${OUTPUT}\n"
+ "Source file was:\n${_source}\n")
+ else()
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(CHECK_FAIL "Failed")
+ endif()
+ set(${_var} "" CACHE INTERNAL "Test ${_var}")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Performing ${_lang_textual} SOURCE FILE Test ${_var} failed with the following output:\n"
+ "${OUTPUT}\n"
+ "Source file was:\n${_source}\n")
+ endif()
+ endif()
+endfunction()
+
+cmake_policy(POP)
+function(CHECK_SOURCE_COMPILES _lang _source _var)
+ cmake_check_source_compiles(${_lang} "${_source}" ${_var} ${ARGN})
+endfunction()
+
diff -ruN mumps/cmake/get_mumps.cmake mumps-ok/cmake/get_mumps.cmake
--- mumps/cmake/get_mumps.cmake 2021-10-04 14:31:04.000000000 +0000
+++ mumps-ok/cmake/get_mumps.cmake 2021-10-08 14:38:20.823214013 +0000
@@ -2,16 +2,18 @@
file(READ ${CMAKE_CURRENT_LIST_DIR}/libraries.json json)
+string(REGEX MATCH "\"mumps\": {.*\"${MUMPS_UPSTREAM_VERSION}\": {([^}]*)}" _ ${json})
+set(info ${CMAKE_MATCH_1})
+string(REGEX MATCH "\"sha256\": \"([^\"]*)\"" _ ${info})
+set(mumps_sha256 ${CMAKE_MATCH_1})
+string(REGEX MATCH "\"urls\": [\[]([^\]]*)" _ ${info})
+string(REGEX MATCHALL "\"([^\"]*)\"" urllist ${CMAKE_MATCH_1})
set(mumps_urls)
-string(JSON N LENGTH ${json} mumps ${MUMPS_UPSTREAM_VERSION} urls)
-math(EXPR N "${N}-1")
-foreach(i RANGE ${N})
- string(JSON _u GET ${json} mumps ${MUMPS_UPSTREAM_VERSION} urls ${i})
- list(APPEND mumps_urls ${_u})
+foreach(url ${urllist})
+ string(REPLACE "\"" "" urlstrip ${url})
+ list(APPEND mumps_urls ${urlstrip})
endforeach()
-string(JSON mumps_sha256 GET ${json} mumps ${MUMPS_UPSTREAM_VERSION} sha256)
-
FetchContent_Declare(mumps
URL ${mumps_urls}
URL_HASH SHA256=${mumps_sha256}
diff -ruN mumps/cmake/libraries.cmake mumps-ok/cmake/libraries.cmake
--- mumps/cmake/libraries.cmake 2021-10-04 14:31:04.000000000 +0000
+++ mumps-ok/cmake/libraries.cmake 2021-10-08 14:38:20.823214013 +0000
@@ -1,12 +1,13 @@
set(names lapack scalapack)
-file(READ ${CMAKE_CURRENT_LIST_DIR}/libraries.json _libj)
+file(READ ${CMAKE_CURRENT_LIST_DIR}/libraries.json json)
foreach(n ${names})
- foreach(t git tag)
- string(JSON m ERROR_VARIABLE e GET ${_libj} ${n} ${t})
- if(m)
- set(${n}_${t} ${m})
- endif()
+ string(REGEX MATCH "\"${n}\": {([^\}]*)}" _ ${json})
+ string(REGEX MATCHALL "\"[^\"]*\": \"[^\"]*" info_list ${CMAKE_MATCH_1})
+ foreach(info ${info_list})
+ string(REGEX MATCH "\"([^\"]*)\": \"([^\"]*)" INFO_LIST ${info})
+ set(${n}_${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
+ message("${n}_${CMAKE_MATCH_1} ${CMAKE_MATCH_2}")
endforeach()
endforeach()
diff -ruN mumps/cmake/mumps_patch.cmake mumps-ok/cmake/mumps_patch.cmake
--- mumps/cmake/mumps_patch.cmake 2021-10-04 14:31:04.000000000 +0000
+++ mumps-ok/cmake/mumps_patch.cmake 2021-10-08 14:38:20.823214013 +0000
@@ -13,26 +13,22 @@
execute_process(COMMAND ${WSL} wslpath ${mumps_orig}
TIMEOUT 5
OUTPUT_VARIABLE mumps_orig_path
- COMMAND_ERROR_IS_FATAL ANY
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(COMMAND ${WSL} wslpath ${mumps_patch}
TIMEOUT 5
OUTPUT_VARIABLE mumps_patch_path
- COMMAND_ERROR_IS_FATAL ANY
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(COMMAND ${WSL} patch ${mumps_orig_path} ${mumps_patch_path}
TIMEOUT 10
- COMMAND_ERROR_IS_FATAL ANY
)
else()
find_program(PATCH NAMES patch REQUIRED)
execute_process(COMMAND ${PATCH} ${mumps_orig} ${mumps_patch}
TIMEOUT 10
- COMMAND_ERROR_IS_FATAL ANY
)
endif()
# MigFlow - Copyright (C) <2010-2020>
# <Universite catholique de Louvain (UCL), Belgium
# Universite de Montpellier, France>
#
# List of the contributors to the development of MigFlow: see AUTHORS file.
# Description and complete License: see LICENSE file.
#
# This program (MigFlow) is free software:
# you can redistribute it and/or modify it under the terms of the GNU Lesser General
# Public License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program (see COPYING and COPYING.LESSER files). If not,
# see <http://www.gnu.org/licenses/>.
# - Try to find PETSc
# Once done this will define
#
# PETSC_INC - the PETSc include directories
# PETSC_LIBS - Link these to use PETSc
option(PETSC_DIR "petsc installation directory" NOTSET)
option(PETSC_ARCH "petsc architecture" NOTSET)
if(PETSC_DIR)
else(PETSC_DIR)
message("set PETSC_DIR to $ENV{PETSC_DIR}")
set(PETSC_DIR $ENV{PETSC_DIR} CACHE PATH "PETSc installation directory" FORCE)
endif(PETSC_DIR)
if(PETSC_ARCH)
else(PETSC_ARCH)
set(PETSC_ARCH $ENV{PETSC_ARCH} CACHE STRING "PETSc architecture" FORCE)
endif(PETSC_ARCH)
message("PETSC : ${PETSC_DIR} ${PETSC_ARCH}")
set(PETSC_LIBDIR "${PETSC_DIR}/${PETSC_ARCH}/lib")
set(PETSC_POSSIBLE_CONF_FILES
${PETSC_DIR}/${PETSC_ARCH}/conf/petscvariables
${PETSC_DIR}/${PETSC_ARCH}/lib/petsc-conf/petscvariables
${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/petscvariables)
foreach(FILE ${PETSC_POSSIBLE_CONF_FILES})
if(EXISTS ${FILE})
# old-style PETSc installations (using PETSC_DIR and PETSC_ARCH)
message(STATUS "Using PETSc dir: ${PETSC_DIR}")
message(STATUS "Using PETSc arch: ${PETSC_ARCH}")
# find includes by parsing the petscvariables file
file(STRINGS ${FILE} PETSC_VARIABLES NEWLINE_CONSUME)
endif(EXISTS ${FILE})
endforeach(FILE)
set(PETSC_CFLAGS "")
if(PETSC_VARIABLES)
# try to find PETSC_CC_INCLUDES for PETSc >= 3.4
string(REGEX MATCH "PETSC_CC_INCLUDES = [^\n\r]*" PETSC_PACKAGES_INCLUDES
${PETSC_VARIABLES})
if(PETSC_PACKAGES_INCLUDES)
string(REPLACE "PETSC_CC_INCLUDES = " "" PETSC_PACKAGES_INCLUDES
${PETSC_PACKAGES_INCLUDES})
else(PETSC_PACKAGES_INCLUDES)
# try to find PETSC_PACKAGES_INCLUDES in older versions
list(APPEND PETSC_INC ${PETSC_DIR}/include)
list(APPEND PETSC_INC ${PETSC_DIR}/${PETSC_ARCH}/include)
string(REGEX MATCH "PACKAGES_INCLUDES = [^\n\r]*" PETSC_PACKAGES_INCLUDES
${PETSC_VARIABLES})
string(REPLACE "PACKAGES_INCLUDES = " "" PETSC_PACKAGES_INCLUDES
${PETSC_PACKAGES_INCLUDES})
endif(PETSC_PACKAGES_INCLUDES)
if(PETSC_PACKAGES_INCLUDES)
string(REPLACE "-I" "" PETSC_PACKAGES_INCLUDES ${PETSC_PACKAGES_INCLUDES})
string(REPLACE " " ";" PETSC_PACKAGES_INCLUDES ${PETSC_PACKAGES_INCLUDES})
foreach(VAR ${PETSC_PACKAGES_INCLUDES})
# seem to include unexisting directories (/usr/include/lib64)
# check to avoid warnings
if(EXISTS ${VAR})
list(APPEND PETSC_INC ${VAR})
endif(EXISTS ${VAR})
endforeach(VAR)
endif(PETSC_PACKAGES_INCLUDES)
string(REGEX MATCHALL "\nCC = [^\n\r]*" PETSC_CC ${PETSC_VARIABLES})
if(PETSC_CC)
string(REPLACE "\nCC = " "" PETSC_CC ${PETSC_CC})
string(STRIP ${PETSC_CC} PETSC_CC)
execute_process(COMMAND ${PETSC_CC} --showme:compile RESULT_VARIABLE PETSCCR OUTPUT_VARIABLE PETSCCO ERROR_QUIET)
if(NOT PETSCCR)
string(STRIP "${PETSCCO}" PETSC_CFLAGS)
endif(NOT PETSCCR)
endif(PETSC_CC)
string(REGEX MATCHALL "\nPETSC_WITH_EXTERNAL_LIB = [^\n\r]*" PETSC_LIBS ${PETSC_VARIABLES})
if(PETSC_LIBS)
string(REPLACE "\nPETSC_WITH_EXTERNAL_LIB = " "" PETSC_LIBS ${PETSC_LIBS})
string(REPLACE "\${PETSC_DIR}" "${PETSC_DIR}" PETSC_LIBS ${PETSC_LIBS})
string(REPLACE "\${PETSC_ARCH}" "${PETSC_ARCH}" PETSC_LIBS ${PETSC_LIBS})
string(STRIP ${PETSC_LIBS} PETSC_LIBS)
endif(PETSC_LIBS)
endif(PETSC_VARIABLES)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PETSc DEFAULT_MSG PETSC_LIBS PETSC_INC)
mark_as_advanced(PETSC_LIBS PETSC_INC PETSC_CFLAGS)
......@@ -2,9 +2,9 @@ FROM ubuntu:20.04
env DEBIAN_FRONTEND=noninteractive
#linux
RUN apt update && apt install -y git python3 make cmake gcc
RUN apt update && apt install -y git python3 make cmake gcc gfortran g++ libopenblas-dev
#windows
RUN apt update && apt install -y mingw-w64 mingw-w64-tools
RUN apt update && apt install -y mingw-w64 mingw-w64-tools gfortran-mingw-w64 zstd curl
run echo "\
SET(CMAKE_SYSTEM_NAME Windows)\n\
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)\n\
......@@ -30,9 +30,21 @@ RUN mkdir -p /osxcross && chown validator /osxcross
USER validator
RUN git clone https://github.com/tpoechtrager/osxcross.git /osxcross
COPY MacOSX10.15.sdk.tar.xz /osxcross/tarballs/MacOSX10.15.sdk.tar.xz
RUN cd /osxcross && SDK_VERSION=10.15 UNATTENDED=1 ./build.sh
RUN cd /osxcross && SDK_VERSION=10.15 UNATTENDED=1 ENABLE_FORTRAN=1 ./build.sh
user root
RUN apt update && apt install -y libmpfr-dev libmpc-dev libgmp-dev
USER validator
RUN cd /osxcross && SDK_VERSION=10.15 UNATTENDED=1 ENABLE_FORTRAN=1 ./build_gcc.sh
RUN rm -rf /osxcross/build
ENV PATH=/osxcross/target/bin/:$PATH
ENV OSXCROSS_HOST=x86_64-apple-darwin19
COPY /toolchain-gcc.cmake /osxcross/target/toolchain-gcc.cmake
USER root
RUN cd / &&\
curl -O https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-openblas-0.3.13-2-any.pkg.tar.zst && \
tar xf mingw-w64-x86_64-openblas-0.3.13-2-any.pkg.tar.zst
USER validator
VOLUME ["/etc/gitlab-runner"]
......
# OSXCross toolchain
macro(osxcross_getconf VAR)
if(NOT ${VAR})
set(${VAR} "$ENV{${VAR}}")
if(${VAR})
set(${VAR} "${${VAR}}" CACHE STRING "${VAR}")
message(STATUS "Found ${VAR}: ${${VAR}}")
else()
message(FATAL_ERROR "Cannot determine \"${VAR}\"")
endif()
endif()
endmacro()
osxcross_getconf(OSXCROSS_HOST)
osxcross_getconf(OSXCROSS_TARGET_DIR)
osxcross_getconf(OSXCROSS_TARGET)
osxcross_getconf(OSXCROSS_SDK)
set(CMAKE_SYSTEM_NAME "Darwin")
string(REGEX REPLACE "-.*" "" CMAKE_SYSTEM_PROCESSOR "${OSXCROSS_HOST}")
# specify the cross compiler
set(CMAKE_C_COMPILER "${OSXCROSS_TARGET_DIR}/bin/${OSXCROSS_HOST}-gcc")
set(CMAKE_CXX_COMPILER "${OSXCROSS_TARGET_DIR}/bin/${OSXCROSS_HOST}-g++")
# where is the target environment
set(CMAKE_FIND_ROOT_PATH
"${OSXCROSS_SDK}"
"${OSXCROSS_TARGET_DIR}/macports/pkgs/opt/local")
# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_AR "${OSXCROSS_TARGET_DIR}/bin/${OSXCROSS_HOST}-ar" CACHE FILEPATH "ar")
set(CMAKE_RANLIB "${OSXCROSS_TARGET_DIR}/bin/${OSXCROSS_HOST}-ranlib" CACHE FILEPATH "ranlib")
set(CMAKE_INSTALL_NAME_TOOL "${OSXCROSS_TARGET_DIR}/bin/${OSXCROSS_HOST}-install_name_tool" CACHE FILEPATH "install_name_tool")
set(ENV{PKG_CONFIG_LIBDIR} "${OSXCROSS_TARGET_DIR}/macports/pkgs/opt/local/lib/pkgconfig")
set(ENV{PKG_CONFIG_SYSROOT_DIR} "${OSXCROSS_TARGET_DIR}/macports/pkgs")
set(CMAKE_Fortran_COMPILER "${OSXCROSS_TARGET_DIR}/bin/${OSXCROSS_HOST}-gfortran")
......@@ -27,6 +27,13 @@ set(SRC
mesh_find.c
../tools/quadtree.c
)
if(BUILD_MUMPS)
set(SRC
${SRC}
mumps_solver.c
)
endif(BUILD_MUMPS)
include_directories(. ${CMAKE_SOURCE_DIR}/tools ${EXTERNAL_INCLUDES})
add_library(mbfluid2 SHARED ${SRC})
......@@ -34,3 +41,11 @@ target_compile_definitions(mbfluid2 PUBLIC "-DDIMENSION=2")
add_library(mbfluid3 SHARED ${SRC})
target_compile_definitions(mbfluid3 PUBLIC "-DDIMENSION=3")
if(BUILD_MUMPS)
include_directories(${MUMPS_INCLUDE_DIR})
target_link_libraries(mbfluid2 ${MUMPS_LIBS})
add_dependencies(mbfluid2 mumps)
target_link_libraries(mbfluid3 ${MUMPS_LIBS})
add_dependencies(mbfluid3 mumps)
endif(BUILD_MUMPS)
......@@ -245,7 +245,7 @@ static void f_boundary(WeakBoundary *wbnd, FluidProblem *problem,const double *n
else if(vid>0) unbnd = (unold+unext)/2;
if (unbnd - unmesh < 0) {
for (int id = 0; id < D; ++id) {
f0[U+id] += ((unbnd - unmesh)*(vid<0?0:uext[id])-(unold-unmesh)*u[id])*rho/c;
f0[U+id] += ((unbnd - unmesh)*(vid<0?0:uext[id])-(unold - unmesh)*u[id])*rho/c;
f00[(U+id)*n_fields+U+id] -= (unold-unmesh)*rho/c;
}
}
......@@ -1140,7 +1140,7 @@ static void fluid_problem_dg_to_cg_grad(FluidProblem *problem, const double *dg,
}
}
void fluid_problem_assemble_system(FluidProblem *problem, double *rhs, const double *solution_old, double dt, double *all_local_vector, double *all_local_matrix)
void fluid_problem_assemble_system(FluidProblem *problem, const double *solution_old, double dt, double *all_local_vector, double *all_local_matrix)
{
const Mesh *mesh = problem->mesh;
......
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mpi.h"
#include "dmumps_c.h"
#include "string.h"
#define JOB_INIT -1
#define JOB_END -2
#define USE_COMM_WORLD -987654
#define ICNTL(I) icntl[(I)-1] /*macro s.t. indices match documentation*/
void mumps_set_options(DMUMPS_STRUC_C *id, int *options, int n){
for(int i = 0; i < n; ++i){
id->ICNTL(options[2*i+0]) = options[2*i+1];
}
}
DMUMPS_STRUC_C *mumps_element_new(int n, int nelt, int *eltptr, int *eltvar, double *a_elt, double *rhs) {
DMUMPS_STRUC_C *id = malloc(sizeof(DMUMPS_STRUC_C));
int myid, ierr;
ierr = MPI_Init(NULL, NULL);
//ierr = MPI_Comm_rank(MPI_COMM_WORLD, &myid);
/*Initialize a MUMPS instance. Use MPI_COMM_WORLD.*/
id->job=JOB_INIT;
id->par=1;
id->sym=0;
id->comm_fortran=USE_COMM_WORLD;
dmumps_c(id);
/*Define the problem on the host*/
id->n = n;
id->nelt = nelt;
id->eltptr = malloc(sizeof(int)*(nelt+1));
memcpy(id->eltptr, eltptr, sizeof(int)*(nelt+1));
id->eltvar = eltvar;
id->eltvar = malloc(sizeof(int)*(eltptr[nelt]-1));
memcpy(id->eltvar, eltvar, sizeof(int)*(eltptr[nelt]-1));
/*No outputs*/
/*id->ICNTL(1)=-1;
id->ICNTL(2)=-1;
id->ICNTL(3)=-1;*/
/* output level */
id->ICNTL(4)=-1;
// id->ICNTL(4)=2;
/* element format */
id->ICNTL(5)=1;
/* permutes the matrix to a zero-free diagonal */
id->ICNTL(6)=2;
/* reordering metis */
id->ICNTL(7)=5;
/* transpose matrix (local matrices c->f) */
id->ICNTL(9)=0;
/* no scaling */