-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
4 changed files
with
3,553 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
pkgs/by-name/ne/netgen/conditional-arm-feature-complex.patch
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,22 @@ | ||
diff --git a/libsrc/core/simd_arm64.hpp b/libsrc/core/simd_arm64.hpp | ||
index 9e0bcce..3607c4f 100644 | ||
--- a/libsrc/core/simd_arm64.hpp | ||
+++ b/libsrc/core/simd_arm64.hpp | ||
@@ -153,7 +153,7 @@ namespace ngcore | ||
{ | ||
return FNMA(SIMD<double,2> (a), b, c); | ||
} | ||
- | ||
+#ifdef __ARM_FEATURE_COMPLEX | ||
// ARM complex mult: | ||
// https://arxiv.org/pdf/1901.07294.pdf | ||
// c += a*b (a0re, a0im, a1re, a1im, ...), | ||
@@ -162,7 +162,7 @@ namespace ngcore | ||
auto tmp = vcmlaq_f64(c.Data(), a.Data(), b.Data()); // are * b | ||
c = vcmlaq_rot90_f64(tmp, a.Data(), b.Data()); // += i*aim * b | ||
} | ||
- | ||
+#endif | ||
|
||
NETGEN_INLINE SIMD<double,2> operator+ (SIMD<double,2> a, SIMD<double,2> b) | ||
{ return a.Data()+b.Data(); } |
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,196 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
fetchFromGitHub, | ||
fetchDebianPatch, | ||
git, | ||
makeWrapper, | ||
cmake, | ||
python3, | ||
mpi, | ||
mpiCheckPhaseHook, | ||
metis, | ||
opencascade-occt, | ||
libGLU, | ||
zlib, | ||
tcl, | ||
tk, | ||
xorg, | ||
libjpeg, | ||
ffmpeg, | ||
catch2, | ||
avxSupport ? stdenv.hostPlatform.avxSupport, | ||
avx2Support ? stdenv.hostPlatform.avx2Support, | ||
avx512Support ? stdenv.hostPlatform.avx512Support, | ||
}: | ||
let | ||
archFlags = toString ( | ||
lib.optional avxSupport "-mavx" | ||
++ lib.optional avx2Support "-mavx2" | ||
++ lib.optional avx512Support "-mavx512" | ||
); | ||
in | ||
stdenv.mkDerivation (finalAttrs: { | ||
pname = "netgen"; | ||
version = "6.2.2405"; | ||
__structuredAttrs = true; | ||
|
||
src = fetchFromGitHub { | ||
owner = "ngsolve"; | ||
repo = "netgen"; | ||
rev = "v${finalAttrs.version}"; | ||
hash = "sha256-y0Vol8vpccktiqOolRrAbw7JWF4o8Nh9t/fcDnBOWXE="; | ||
}; | ||
|
||
patches = [ | ||
# disable some platform specified code used by downstream ngsolve | ||
# can be enabled with -march=armv8.3-a+simd when compiling ngsolve | ||
# note compiling netgen itself is not influenced by this feature | ||
./conditional-arm-feature-complex.patch | ||
|
||
(fetchDebianPatch { | ||
inherit (finalAttrs) pname; | ||
version = "6.2.2404+dfsg1-4"; | ||
patch = "fix-national-encoding.patch"; | ||
hash = "sha256-oo29H/SN+c/yojtEkFUG99Gc+hJd5sNxZfxV5TzPtRY="; | ||
}) | ||
(fetchDebianPatch { | ||
inherit (finalAttrs) pname; | ||
version = "6.2.2404+dfsg1-4"; | ||
patch = "fix_nggui_tcl.patch"; | ||
hash = "sha256-ODDT67+RWBzPhhq/equWsu78x9L/Yrs3U8VQ1Uu0zZw="; | ||
}) | ||
(fetchDebianPatch { | ||
inherit (finalAttrs) pname; | ||
version = "6.2.2404+dfsg1-4"; | ||
patch = "ffmpeg_link_libraries.patch"; | ||
hash = "sha256-S02OPH9hbJjOnBm6JMh6uM5XptcubV24vdyEF0FusoM="; | ||
}) | ||
(fetchDebianPatch { | ||
inherit (finalAttrs) pname; | ||
version = "6.2.2404+dfsg1-4"; | ||
patch = "size_t_int32.patch"; | ||
hash = "sha256-uudf3b97J2TNq4lAzPK1bRrcQv+Z1oVxFE3tKlydJfE="; | ||
}) | ||
(fetchDebianPatch { | ||
inherit (finalAttrs) pname; | ||
version = "6.2.2404+dfsg1-4"; | ||
patch = "link_atomic.patch"; | ||
hash = "sha256-Yf0GNP4BAahWxOO0zIMVvXiROVP0hRM54Fok7jGABlY="; | ||
}) | ||
(fetchDebianPatch { | ||
inherit (finalAttrs) pname; | ||
version = "6.2.2404+dfsg1-4"; | ||
patch = "include_stdlib.patch"; | ||
hash = "sha256-W+NgGBuy/UmzVbPTSqR8FRUlyN/9dl9l9e9rxKklmIc="; | ||
}) | ||
(fetchDebianPatch { | ||
inherit (finalAttrs) pname; | ||
version = "6.2.2404+dfsg1-4"; | ||
patch = "ngappinit_no_MPI.patch"; | ||
hash = "sha256-0PSe5YB0C/goYFvnl9Z+pwM12D4s1qaTRV12/NA7c94="; | ||
}) | ||
]; | ||
|
||
postPatch = '' | ||
# get version via version.txt rather than git describe | ||
echo "v${finalAttrs.version}-0" > version.txt | ||
# create dummy catch2 target and use system catch2 | ||
echo "add_custom_target(project_catch)" > cmake/external_projects/catch.cmake | ||
''; | ||
|
||
nativeBuildInputs = [ | ||
git # dummy dependency to pass the cmake requirement | ||
cmake | ||
makeWrapper | ||
python3.pkgs.pybind11-stubgen | ||
]; | ||
|
||
buildInputs = [ | ||
metis | ||
opencascade-occt | ||
zlib | ||
tcl | ||
tk | ||
libGLU | ||
xorg.libXmu | ||
libjpeg | ||
ffmpeg | ||
mpi | ||
]; | ||
|
||
propagatedBuildInputs = with python3.pkgs; [ | ||
packaging | ||
pybind11 | ||
mpi4py | ||
numpy | ||
]; | ||
|
||
cmakeFlags = [ | ||
(lib.cmakeFeature "CMAKE_CXX_FLAGS" archFlags) | ||
# (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) | ||
(lib.cmakeBool "USE_MPI" true) | ||
(lib.cmakeBool "USE_MPI4PY" true) | ||
(lib.cmakeBool "PREFER_SYSTEM_PYBIND11" true) | ||
(lib.cmakeBool "BUILD_STUB_FILES" false) | ||
(lib.cmakeBool "USE_SUPERBUILD" false) # use system packages | ||
(lib.cmakeBool "USE_NATIVE_ARCH" false) | ||
(lib.cmakeBool "USE_JPEG" true) | ||
(lib.cmakeBool "USE_MPEG" true) | ||
(lib.cmakeBool "BUILD_TESTING" finalAttrs.finalPackage.doInstallCheck) | ||
(lib.cmakeBool "ENABLE_UNIT_TESTS" finalAttrs.finalPackage.doInstallCheck) | ||
]; | ||
|
||
postInstall = '' | ||
# upstream cmakelist.txt will reset PYTHONPATH when BUILD_STUB_FILES is enable | ||
# here we build python stub file manualy rather than utilizing cmake option | ||
export PYTHONPATH=$out/${python3.sitePackages}:$PYTHONPATH | ||
pybind11-stubgen netgen -o $out/${python3.sitePackages} | ||
wrapProgram "$out/bin/netgen" \ | ||
--set LD_LIBRARY_PATH "$out/lib"\ | ||
--set NETGENDIR "$out/share" | ||
''; | ||
|
||
doInstallCheck = true; | ||
|
||
installCheckTarget = "test"; | ||
|
||
# Mesh generation differs on x86_64 and aarch64 platform. | ||
# Replace results.json on aarch64 platform with the preset one generated on | ||
# aarch64 host by `python tests/pytest/test_tutorials.py results-aarch64.json`. | ||
preInstallCheck = lib.optionalString stdenv.hostPlatform.isAarch64 '' | ||
cp -f ${./results-aarch64.json} ../tests/pytest/results.json | ||
''; | ||
|
||
nativeInstallCheckInputs = [ | ||
catch2 | ||
python3.pkgs.pytest | ||
python3.pkgs.pytest-check | ||
python3.pkgs.pytest-mpi | ||
mpiCheckPhaseHook | ||
]; | ||
|
||
passthru = { | ||
inherit avxSupport avx2Support avx512Support; | ||
}; | ||
|
||
meta = { | ||
homepage = "https://ngsolve.org"; | ||
description = "Atomatic 3d tetrahedral mesh generator"; | ||
license = with lib.licenses; [ | ||
lgpl2Plus | ||
lgpl21Plus | ||
lgpl21Only | ||
bsd3 | ||
boost | ||
publicDomain | ||
]; | ||
platforms = [ | ||
"x86_64-linux" | ||
"aarch64-linux" | ||
]; | ||
mainProgram = "netgen"; | ||
maintainers = with lib.maintainers; [ qbisi ]; | ||
}; | ||
}) |
Oops, something went wrong.