-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
220 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
diff --git a/cmake/cmake_modules/FindMUMPS.cmake b/cmake/cmake_modules/FindMUMPS.cmake | ||
index b3f880b46..b70481cd0 100644 | ||
--- a/cmake/cmake_modules/FindMUMPS.cmake | ||
+++ b/cmake/cmake_modules/FindMUMPS.cmake | ||
@@ -8,14 +8,14 @@ if(EXISTS ${MUMPS_DIR}/include/zmumps_c.h) | ||
find_library(LIB_MUMPS_D dmumps PATHS ${MUMPS_DIR}/lib) | ||
find_library(LIB_MUMPS_Z zmumps PATHS ${MUMPS_DIR}/lib) | ||
find_library(LIB_PORD pord PATHS ${MUMPS_DIR}/lib) | ||
- find_library(LIB_PARMETIS parmetis HINTS ${PARMETIS_DIR}/lib REQUIRED) | ||
- find_library(LIB_METIS metis HINTS ${PARMETIS_DIR}/lib REQUIRED) | ||
+ # find_library(LIB_PARMETIS parmetis HINTS ${PARMETIS_DIR}/lib REQUIRED) | ||
+ # find_library(LIB_METIS metis HINTS ${PARMETIS_DIR}/lib REQUIRED) | ||
|
||
- if (NOT USE_MKL) | ||
- find_library(LIB_SCALAPACK scalapack HINTS ${SCALAPACK_DIR}/lib REQUIRED) | ||
- endif() | ||
+ # if (NOT USE_MKL) | ||
+ # find_library(LIB_SCALAPACK scalapack HINTS ${SCALAPACK_DIR}/lib REQUIRED) | ||
+ # endif() | ||
|
||
- set(MUMPS_LIBRARIES ${LIB_MUMPS_D} ${LIB_MUMPS_Z} ${LIB_MUMPS_COMMON} ${LIB_PARMETIS} ${LIB_METIS} ${LIB_SCALAPACK}) | ||
+ set(MUMPS_LIBRARIES ${LIB_MUMPS_D} ${LIB_MUMPS_Z} ${LIB_MUMPS_COMMON}) | ||
|
||
if (LIB_PORD) | ||
list(APPEND MUMPS_LIBRARIES ${LIB_PORD}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/comp/hypre_precond.hpp b/comp/hypre_precond.hpp | ||
index 8ebf4921f..61278bd9d 100644 | ||
--- a/comp/hypre_precond.hpp | ||
+++ b/comp/hypre_precond.hpp | ||
@@ -16,7 +16,7 @@ | ||
|
||
#include "HYPRE.h" | ||
#include "HYPRE_parcsr_ls.h" | ||
- | ||
+#include <paralleldofs.hpp> | ||
|
||
namespace ngcomp | ||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
fetchFromGitHub, | ||
gfortran, | ||
mpi, | ||
git, | ||
cmake, | ||
python3Packages, | ||
blas, | ||
lapack, | ||
mumps_par, | ||
hypre, | ||
suitesparse, | ||
catch2, | ||
mpiCheckPhaseHook, | ||
avxSupport ? python3Packages.netgen.avxSupport, | ||
avx2Support ? python3Packages.netgen.avx2Support, | ||
avx512Support ? python3Packages.netgen.avx512Support, | ||
advSimdSupport ? false, | ||
}: | ||
assert advSimdSupport -> stdenv.hostPlatform.isAarch64; | ||
let | ||
ngscxxInclude = toString [ | ||
"-I${python3Packages.pybind11}/include" | ||
"-I${python3Packages.netgen}/include" | ||
"-I${python3Packages.netgen}/include/include" | ||
]; | ||
ngsldFlags = toString [ | ||
"-L${python3Packages.netgen}/lib" | ||
"-L${mumps_par}/lib" | ||
"-L${suitesparse}/lib" | ||
]; | ||
archFlags = toString ( | ||
lib.optional avxSupport "-mavx" | ||
++ lib.optional avx2Support "-mavx2" | ||
++ lib.optional avx512Support "-mavx512" | ||
++ lib.optional advSimdSupport "-march=armv8.3-a+simd" | ||
# disalbe some compiler warning for aarch64 specified target | ||
# https://gcc.gnu.org/gcc-10/changes.html | ||
++ lib.optional (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux) "-Wno-psabi" | ||
); | ||
in | ||
stdenv.mkDerivation (finalAttrs: { | ||
pname = "ngsolve"; | ||
version = "6.2.2501"; | ||
__structuredAttrs = true; | ||
|
||
src = fetchFromGitHub { | ||
owner = "ngsolve"; | ||
repo = "ngsolve"; | ||
tag = "v${finalAttrs.version}"; | ||
hash = "sha256-COba5y18i8PRcm3nmQDEB+H+2cbdA32wqMtxzCPOdO8="; | ||
}; | ||
|
||
patches = [ | ||
./fix-hypre.patch | ||
./use-local-catch2.patch | ||
|
||
# looks for a shared mumps library | ||
./fix-findMumps.patch | ||
]; | ||
|
||
postPatch = '' | ||
# generate version without git required | ||
substituteInPlace cmake/generate_version_file.cmake \ | ||
--replace-fail "Git REQUIRED" "Git" | ||
echo "v${finalAttrs.version}-0" > version.txt | ||
# tests on parallel mumps solver require mpi init | ||
echo -e "\nfrom mpi4py import MPI" >> tests/pytest/conftest.py | ||
# declare inverse solver explicitly | ||
substituteInPlace py_tutorials/mixed.py \ | ||
--replace-fail "fes.FreeDofs()" "fes.FreeDofs(),inverse='umfpack'" | ||
substituteInPlace tests/pytest/test_periodic.py \ | ||
--replace-fail "fes.FreeDofs()" "fes.FreeDofs(),inverse='umfpack'" | ||
# when generating python stub file utilizing system python pybind11_stubgen module | ||
# cmake need to inherit pythonpath | ||
substituteInPlace python/CMakeLists.txt \ | ||
--replace-fail ''\'''${CMAKE_INSTALL_PREFIX}/''${NGSOLVE_INSTALL_DIR_PYTHON}' \ | ||
''\'''${CMAKE_INSTALL_PREFIX}/''${NGSOLVE_INSTALL_DIR_PYTHON}:$ENV{PYTHONPATH}' | ||
''; | ||
|
||
nativeBuildInputs = [ | ||
cmake | ||
gfortran | ||
python3Packages.pybind11-stubgen | ||
]; | ||
|
||
cmakeFlags = [ | ||
(lib.cmakeFeature "ngscxx_includes" ngscxxInclude) | ||
(lib.cmakeFeature "ngsld_flags" ngsldFlags) | ||
(lib.cmakeFeature "CMAKE_CXX_FLAGS" archFlags) | ||
(lib.cmakeFeature "NETGEN_DIR" "${python3Packages.netgen}") | ||
(lib.cmakeFeature "CATCH_INCLUDE_DIR" "${catch2}/include/catch2") | ||
(lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) | ||
(lib.cmakeBool "USE_MPI" true) | ||
(lib.cmakeBool "USE_HYPRE" true) | ||
(lib.cmakeBool "USE_MUMPS" true) | ||
(lib.cmakeBool "USE_SUPERBUILD" false) | ||
(lib.cmakeBool "BUILD_STUB_FILES" true) | ||
(lib.cmakeBool "BUILD_TESTING" finalAttrs.finalPackage.doInstallCheck) | ||
(lib.cmakeBool "ENABLE_UNIT_TESTS" finalAttrs.finalPackage.doInstallCheck) | ||
]; | ||
|
||
buildInputs = [ | ||
blas | ||
lapack | ||
hypre | ||
mumps_par | ||
suitesparse | ||
mpi | ||
]; | ||
|
||
propagatedBuildInputs = with python3Packages; [ | ||
scipy | ||
netgen | ||
]; | ||
|
||
doInstallCheck = true; | ||
|
||
installCheckTarget = "test"; | ||
|
||
# Test on ngscxx/ngsld that they can compile/link without NIX_CFLAGS_COMPILE/NIX_LDFLAGS | ||
preInstallCheck = '' | ||
unset NIX_CFLAGS_COMPILE | ||
unset NIX_LDFLAGS | ||
export PYTHONPATH=$out/${python3Packages.python.sitePackages}:$PYTHONPATH | ||
export PATH=$out/bin:$PATH | ||
''; | ||
|
||
nativeInstallCheckInputs = [ | ||
catch2 | ||
python3Packages.pytest | ||
mpiCheckPhaseHook | ||
]; | ||
|
||
meta = { | ||
homepage = "https://ngsolve.org"; | ||
description = "Multi-purpose finite element library"; | ||
license = lib.licenses.lgpl21Only; | ||
platforms = [ | ||
"x86_64-linux" | ||
"aarch64-linux" | ||
]; | ||
maintainers = with lib.maintainers; [ qbisi ]; | ||
}; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index efa206a79..6bce06429 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -121,9 +121,9 @@ if(INTEL_MIC) | ||
endif(INTEL_MIC) | ||
|
||
####################################################################### | ||
-if(ENABLE_UNIT_TESTS) | ||
- include(${CMAKE_CURRENT_LIST_DIR}/cmake/external_projects/catch.cmake) | ||
-endif(ENABLE_UNIT_TESTS) | ||
+# if(ENABLE_UNIT_TESTS) | ||
+# include(${CMAKE_CURRENT_LIST_DIR}/cmake/external_projects/catch.cmake) | ||
+# endif(ENABLE_UNIT_TESTS) | ||
|
||
####################################################################### | ||
# append install paths of software in non-standard paths (e.g. openmpi, metis, intel mkl, ...) | ||
diff --git a/tests/catch/CMakeLists.txt b/tests/catch/CMakeLists.txt | ||
index 1b482f760..222c53cbf 100644 | ||
--- a/tests/catch/CMakeLists.txt | ||
+++ b/tests/catch/CMakeLists.txt | ||
@@ -10,7 +10,7 @@ include_directories(${CATCH_INCLUDE_DIR}) | ||
add_library(catch_main STATIC main.cpp) | ||
set_target_properties(catch_main PROPERTIES CXX_STANDARD 17) | ||
add_dependencies(unit_tests catch_main) | ||
-add_dependencies(catch_main project_catch) | ||
+# add_dependencies(catch_main project_catch) | ||
|
||
# ensure the test targets are built before testing | ||
add_test(NAME unit_tests_built COMMAND ${CMAKE_COMMAND} --build . --target unit_tests --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../.. ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters