Merge staging-next into staging
This commit is contained in:
@@ -13,6 +13,9 @@ on:
|
||||
headBranch:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
NIXPKGS_CI_APP_PRIVATE_KEY:
|
||||
required: true
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
updatedWithin:
|
||||
@@ -28,6 +31,10 @@ concurrency:
|
||||
# PR- and manually-triggered runs will be cancelled, but scheduled runs will be queued.
|
||||
cancel-in-progress: ${{ github.event_name != 'schedule' }}
|
||||
|
||||
# This is used as fallback without app only.
|
||||
# This happens when testing in forks without setting up that app.
|
||||
# Labels will most likely not exist in forks, yet. For this case,
|
||||
# we add the issues permission only here.
|
||||
permissions:
|
||||
issues: write # needed to create *new* labels
|
||||
pull-requests: write
|
||||
@@ -44,9 +51,20 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: npm install @actions/artifact bottleneck
|
||||
|
||||
# Use a GitHub App, because it has much higher rate limits: 12,500 instead of 5,000 req / hour.
|
||||
- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
|
||||
if: vars.NIXPKGS_CI_APP_ID
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ vars.NIXPKGS_CI_APP_ID }}
|
||||
private-key: ${{ secrets.NIXPKGS_CI_APP_PRIVATE_KEY }}
|
||||
# No issues: write permission here, because labels in Nixpkgs should
|
||||
# be created explicitly via the UI with color and description.
|
||||
permission-pull-requests: write
|
||||
|
||||
- name: Log current API rate limits
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
|
||||
run: gh api /rate_limit | jq
|
||||
|
||||
- name: Labels from API data and Eval results
|
||||
@@ -54,6 +72,7 @@ jobs:
|
||||
env:
|
||||
UPDATED_WITHIN: ${{ inputs.updatedWithin }}
|
||||
with:
|
||||
github-token: ${{ steps.app-token.outputs.token || github.token }}
|
||||
script: |
|
||||
const Bottleneck = require('bottleneck')
|
||||
const path = require('node:path')
|
||||
@@ -74,15 +93,14 @@ jobs:
|
||||
const allLimits = new Bottleneck({
|
||||
// Avoid concurrent requests
|
||||
maxConcurrent: 1,
|
||||
// Hourly limit is at 5000, but other jobs need some, too!
|
||||
// https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api
|
||||
reservoir: 500,
|
||||
reservoirRefreshAmount: 500,
|
||||
reservoirRefreshInterval: 60 * 60 * 1000
|
||||
// Will be updated with first `updateReservoir()` call below.
|
||||
reservoir: 0
|
||||
})
|
||||
// Pause between mutative requests
|
||||
const writeLimits = new Bottleneck({ minTime: 1000 }).chain(allLimits)
|
||||
github.hook.wrap('request', async (request, options) => {
|
||||
// Requests to the /rate_limit endpoint do not count against the rate limit.
|
||||
if (options.url == '/rate_limit') return request(options)
|
||||
stats.requests++
|
||||
if (['POST', 'PUT', 'PATCH', 'DELETE'].includes(options.method))
|
||||
return writeLimits.schedule(request.bind(null, options))
|
||||
@@ -90,6 +108,26 @@ jobs:
|
||||
return allLimits.schedule(request.bind(null, options))
|
||||
})
|
||||
|
||||
async function updateReservoir() {
|
||||
let response
|
||||
try {
|
||||
response = await github.rest.rateLimit.get()
|
||||
} catch (err) {
|
||||
core.error(`Failed updating reservoir:\n${err}`)
|
||||
// Keep retrying on failed rate limit requests instead of exiting the script early.
|
||||
return
|
||||
}
|
||||
// Always keep 1000 spare requests for other jobs to do their regular duty.
|
||||
// They normally use below 100, so 1000 is *plenty* of room to work with.
|
||||
const reservoir = Math.max(0, response.data.resources.core.remaining - 1000)
|
||||
core.info(`Updating reservoir to: ${reservoir}`)
|
||||
allLimits.updateSettings({ reservoir })
|
||||
}
|
||||
await updateReservoir()
|
||||
// Update remaining requests every minute to account for other jobs running in parallel.
|
||||
const reservoirUpdater = setInterval(updateReservoir, 60 * 1000)
|
||||
process.on('uncaughtException', () => clearInterval(reservoirUpdater))
|
||||
|
||||
if (process.env.UPDATED_WITHIN && !/^\d+$/.test(process.env.UPDATED_WITHIN))
|
||||
throw new Error('Please enter "updated within" as integer in hours.')
|
||||
|
||||
@@ -269,10 +307,11 @@ jobs:
|
||||
.map(({ reason }) => core.setFailed(`${reason.message}\n${reason.cause.stack}`))
|
||||
|
||||
core.notice(`Processed ${stats.prs} PRs, made ${stats.requests + stats.artifacts} API requests and downloaded ${stats.artifacts} artifacts.`)
|
||||
clearInterval(reservoirUpdater)
|
||||
|
||||
- name: Log current API rate limits
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
|
||||
run: gh api /rate_limit | jq
|
||||
|
||||
- uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
|
||||
@@ -281,7 +320,7 @@ jobs:
|
||||
github.event_name == 'pull_request_target' &&
|
||||
!contains(fromJSON(inputs.headBranch).type, 'development')
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
repo-token: ${{ steps.app-token.outputs.token }}
|
||||
configuration-path: .github/labeler.yml # default
|
||||
sync-labels: true
|
||||
|
||||
@@ -291,7 +330,7 @@ jobs:
|
||||
github.event_name == 'pull_request_target' &&
|
||||
!contains(fromJSON(inputs.headBranch).type, 'development')
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
repo-token: ${{ steps.app-token.outputs.token }}
|
||||
configuration-path: .github/labeler-no-sync.yml
|
||||
sync-labels: false
|
||||
|
||||
@@ -304,11 +343,11 @@ jobs:
|
||||
github.event_name == 'pull_request_target' &&
|
||||
contains(fromJSON(inputs.headBranch).type, 'development')
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
repo-token: ${{ steps.app-token.outputs.token }}
|
||||
configuration-path: .github/labeler-development-branches.yml
|
||||
sync-labels: true
|
||||
|
||||
- name: Log current API rate limits
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
|
||||
run: gh api /rate_limit | jq
|
||||
|
||||
@@ -103,6 +103,8 @@ jobs:
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
secrets:
|
||||
NIXPKGS_CI_APP_PRIVATE_KEY: ${{ secrets.NIXPKGS_CI_APP_PRIVATE_KEY }}
|
||||
with:
|
||||
headBranch: ${{ needs.prepare.outputs.headBranch }}
|
||||
|
||||
|
||||
@@ -144,6 +144,7 @@ stdenv.mkDerivation (
|
||||
longName
|
||||
tests
|
||||
updateScript
|
||||
vscodeVersion
|
||||
;
|
||||
fhs = fhs { };
|
||||
fhsWithPackages = f: fhs { additionalPkgs = f; };
|
||||
|
||||
@@ -18,17 +18,17 @@
|
||||
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "uv";
|
||||
version = "0.7.13";
|
||||
version = "0.7.14";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "astral-sh";
|
||||
repo = "uv";
|
||||
tag = finalAttrs.version;
|
||||
hash = "sha256-/K8zTExK6G/Rrh/4g2CLS4rBbQovb6DvAL8puS7eM5w=";
|
||||
hash = "sha256-RBcJuQ2NCFoNfhecR88fsKpdq0+YpvS7sSUkewIueEU=";
|
||||
};
|
||||
|
||||
useFetchCargoVendor = true;
|
||||
cargoHash = "sha256-GsjBTqV7GO1NNI/3EMXN0S0TwPvdtP/PTTv6NbGa9a4=";
|
||||
cargoHash = "sha256-pKANEM4XiRRRXY+AOym5mq2nrVa0iByKZ1UAkh80IrA=";
|
||||
|
||||
buildInputs = [
|
||||
rust-jemalloc-sys
|
||||
|
||||
@@ -41,7 +41,7 @@ drvArgs:
|
||||
base=$(basename "${finalAttrs.vocabName}")
|
||||
root=''${fname%$base}
|
||||
root=''${root:-.}
|
||||
find "$root" -mindepth 1 -maxdepth 1 -type -d \
|
||||
find "$root" -mindepth 1 -maxdepth 1 -type d \
|
||||
-not \( -name bin -or -name doc -or -name lib \) -exec \
|
||||
cp -r -t "$out/lib/factor/${finalAttrs.vocabRoot}" {} \+
|
||||
else
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "wadler-lindig";
|
||||
version = "0.1.6";
|
||||
version = "0.1.7";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "patrick-kidger";
|
||||
repo = "wadler_lindig";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-EO47eYZk3Hr4328liDmRfCbwi5NDJ4V9NUzk3bpY9IM=";
|
||||
hash = "sha256-qP826zdzR5BEQ8bGd45RFSLTH6Eal+b7UN+BW07/glo=";
|
||||
};
|
||||
|
||||
build-system = [
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
diff --git a/warp/build_dll.py b/warp/build_dll.py
|
||||
index 4d411e1b..a9304c6a 100644
|
||||
--- a/warp/build_dll.py
|
||||
+++ b/warp/build_dll.py
|
||||
@@ -316,6 +316,8 @@ def build_dll_for_arch(args, dll_path, cpp_paths, cu_path, libs, arch, mode=None
|
||||
cuda_includes = f' -I"{cuda_home}/include"' if cu_path else ""
|
||||
includes = cpp_includes + cuda_includes
|
||||
|
||||
+ includes += " -isystem @LIBCXX_DEV@/include/c++/v1"
|
||||
+
|
||||
if sys.platform == "darwin":
|
||||
version = f"--target={arch}-apple-macos11"
|
||||
else:
|
||||
@@ -345,6 +347,8 @@ def build_dll_for_arch(args, dll_path, cpp_paths, cu_path, libs, arch, mode=None
|
||||
build_cmd = f'g++ {cpp_flags} -c "{cpp_path}" -o "{cpp_out}"'
|
||||
run_cmd(build_cmd)
|
||||
|
||||
+ ld_inputs.append('-L"@LIBCXX_LIB@/lib" -lc++')
|
||||
+
|
||||
if cu_path:
|
||||
cu_out = cu_path + ".o"
|
||||
|
||||
diff --git a/warp/native/crt.h b/warp/native/crt.h
|
||||
index 47ef9983..89ae289b 100644
|
||||
--- a/warp/native/crt.h
|
||||
+++ b/warp/native/crt.h
|
||||
@@ -65,6 +65,12 @@ extern "C" WP_API int _wp_isinf(double);
|
||||
#include <float.h>
|
||||
#include <string.h>
|
||||
|
||||
+#undef isfinite
|
||||
+#undef isinf
|
||||
+#undef isnan
|
||||
+
|
||||
+#include <cmath>
|
||||
+
|
||||
#else
|
||||
|
||||
// These definitions are taken from Jitify: https://github.com/NVIDIA/jitify
|
||||
@@ -0,0 +1,50 @@
|
||||
diff --git a/build_llvm.py b/build_llvm.py
|
||||
index 9d5a26a7..0be02a89 100644
|
||||
--- a/build_llvm.py
|
||||
+++ b/build_llvm.py
|
||||
@@ -389,15 +389,4 @@ def build_warp_clang_for_arch(args, lib_name, arch):
|
||||
|
||||
|
||||
def build_warp_clang(args, lib_name):
|
||||
- if sys.platform == "darwin":
|
||||
- # create a universal binary by combining x86-64 and AArch64 builds
|
||||
- build_warp_clang_for_arch(args, lib_name + "-x86_64", "x86_64")
|
||||
- build_warp_clang_for_arch(args, lib_name + "-aarch64", "aarch64")
|
||||
-
|
||||
- dylib_path = os.path.join(build_path, f"bin/{lib_name}")
|
||||
- run_cmd(f"lipo -create -output {dylib_path} {dylib_path}-x86_64 {dylib_path}-aarch64")
|
||||
- os.remove(f"{dylib_path}-x86_64")
|
||||
- os.remove(f"{dylib_path}-aarch64")
|
||||
-
|
||||
- else:
|
||||
- build_warp_clang_for_arch(args, lib_name, machine_architecture())
|
||||
+ build_warp_clang_for_arch(args, lib_name, machine_architecture())
|
||||
diff --git a/warp/build_dll.py b/warp/build_dll.py
|
||||
index 4d411e1b..4cf4a6c2 100644
|
||||
--- a/warp/build_dll.py
|
||||
+++ b/warp/build_dll.py
|
||||
@@ -317,7 +317,7 @@ def build_dll_for_arch(args, dll_path, cpp_paths, cu_path, libs, arch, mode=None
|
||||
includes = cpp_includes + cuda_includes
|
||||
|
||||
if sys.platform == "darwin":
|
||||
- version = f"--target={arch}-apple-macos11"
|
||||
+ version = ""
|
||||
else:
|
||||
version = "-fabi-version=13" # GCC 8.2+
|
||||
|
||||
@@ -392,14 +392,4 @@ def build_dll(args, dll_path, cpp_paths, cu_path, libs=None):
|
||||
if libs is None:
|
||||
libs = []
|
||||
|
||||
- if sys.platform == "darwin":
|
||||
- # create a universal binary by combining x86-64 and AArch64 builds
|
||||
- build_dll_for_arch(args, dll_path + "-x86_64", cpp_paths, cu_path, libs, "x86_64")
|
||||
- build_dll_for_arch(args, dll_path + "-aarch64", cpp_paths, cu_path, libs, "aarch64")
|
||||
-
|
||||
- run_cmd(f"lipo -create -output {dll_path} {dll_path}-x86_64 {dll_path}-aarch64")
|
||||
- os.remove(f"{dll_path}-x86_64")
|
||||
- os.remove(f"{dll_path}-aarch64")
|
||||
-
|
||||
- else:
|
||||
- build_dll_for_arch(args, dll_path, cpp_paths, cu_path, libs, machine_architecture())
|
||||
+ build_dll_for_arch(args, dll_path, cpp_paths, cu_path, libs, machine_architecture())
|
||||
@@ -0,0 +1,251 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
stdenv,
|
||||
buildPythonPackage,
|
||||
fetchurl,
|
||||
fetchFromGitHub,
|
||||
replaceVars,
|
||||
build,
|
||||
setuptools,
|
||||
numpy,
|
||||
llvmPackages,
|
||||
cudaPackages,
|
||||
unittestCheckHook,
|
||||
jax,
|
||||
torch,
|
||||
nix-update-script,
|
||||
|
||||
# Use standalone LLVM-based JIT compiler and CPU device support
|
||||
standaloneSupport ? true,
|
||||
|
||||
# Use CUDA toolchain and GPU device support
|
||||
cudaSupport ? config.cudaSupport,
|
||||
|
||||
# Build Warp with MathDx support (requires CUDA support)
|
||||
# Most linear-algebra tile operations like tile_cholesky(), tile_fft(),
|
||||
# and tile_matmul() require Warp to be built with the MathDx library.
|
||||
libmathdxSupport ? cudaSupport && stdenv.hostPlatform.isLinux,
|
||||
}:
|
||||
|
||||
let
|
||||
version = "1.7.2.post1";
|
||||
|
||||
libmathdx = stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "libmathdx";
|
||||
version = "0.2.0";
|
||||
|
||||
src =
|
||||
let
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
selectSystem = attrs: attrs.${system} or (throw "Unsupported system: ${system}");
|
||||
|
||||
suffix = selectSystem {
|
||||
x86_64-linux = "Linux-x86_64";
|
||||
aarch64-linux = "Linux-aarch64";
|
||||
x86_64-windows = "win32-x86_64";
|
||||
};
|
||||
|
||||
# nix-hash --type sha256 --to-sri $(nix-prefetch-url "https://...")
|
||||
hash = selectSystem {
|
||||
x86_64-linux = "sha256-Lk+PxWFvyQGRClFdmyuo4y7HBdR7pigOhMyEzajqbmg=";
|
||||
aarch64-linux = "sha256-6tH9YH98kSvDiut9rQEU5potEpeKqma/QtrCHLxwRLo=";
|
||||
x86_64-windows = "sha256-B8qwj7UzOXEDZh2oT3ip1qW0uqtygMsyfcbhh5Dgc8U=";
|
||||
};
|
||||
in
|
||||
fetchurl {
|
||||
url = "https://developer.nvidia.com/downloads/compute/cublasdx/redist/cublasdx/libmathdx-${suffix}-${finalAttrs.version}.tar.gz";
|
||||
inherit hash;
|
||||
};
|
||||
|
||||
unpackPhase = ''
|
||||
runHook preUnpack
|
||||
|
||||
mkdir unpacked
|
||||
cd unpacked
|
||||
tar -xzf $src
|
||||
export sourceRoot=$(pwd)
|
||||
|
||||
runHook postUnpack
|
||||
'';
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cp -rT "$sourceRoot" "$out"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "library used to integrate cuBLASDx and cuFFTDx into Warp";
|
||||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||
license = with lib.licenses; [
|
||||
# By downloading and using the software, you agree to fully
|
||||
# comply with the terms and conditions of the NVIDIA Software
|
||||
# License Agreement.
|
||||
(
|
||||
nvidiaCudaRedist
|
||||
// {
|
||||
url = "https://developer.download.nvidia.cn/compute/mathdx/License.txt";
|
||||
}
|
||||
)
|
||||
|
||||
# Some of the libmathdx routines were written by or derived
|
||||
# from code written by Meta Platforms, Inc. and affiliates and
|
||||
# are subject to the BSD License.
|
||||
bsd
|
||||
];
|
||||
platforms = with lib.platforms; linux ++ [ "x86_64-windows" ];
|
||||
maintainers = with lib.maintainers; [ yzx9 ];
|
||||
};
|
||||
});
|
||||
in
|
||||
buildPythonPackage {
|
||||
pname = "warp-lang";
|
||||
inherit version;
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "NVIDIA";
|
||||
repo = "warp";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-cT0CrD71nNZnQMimGrmnSQl6RQx4MiUv2xBFPWNI/0s=";
|
||||
};
|
||||
|
||||
patches =
|
||||
lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
(replaceVars ./darwin-libcxx.patch {
|
||||
LIBCXX_DEV = llvmPackages.libcxx.dev;
|
||||
LIBCXX_LIB = llvmPackages.libcxx;
|
||||
})
|
||||
./darwin-single-target.patch
|
||||
]
|
||||
++ lib.optionals standaloneSupport [
|
||||
(replaceVars ./standalone-llvm.patch {
|
||||
LLVM_DEV = llvmPackages.llvm.dev;
|
||||
LLVM_LIB = llvmPackages.llvm.lib;
|
||||
LIBCLANG_DEV = llvmPackages.libclang.dev;
|
||||
LIBCLANG_LIB = llvmPackages.libclang.lib;
|
||||
})
|
||||
./standalone-cxx11-abi.patch
|
||||
];
|
||||
|
||||
postPatch =
|
||||
lib.optionalString (!stdenv.cc.isGNU) ''
|
||||
substituteInPlace warp/build_dll.py \
|
||||
--replace-fail "g++" "${lib.getExe stdenv.cc}"
|
||||
''
|
||||
# Broken tests on aarch64. Since unittest doesn't support disabling a
|
||||
# single test, and pytest isn't compatible, we patch the test file directly
|
||||
# instead.
|
||||
#
|
||||
# See: https://github.com/NVIDIA/warp/issues/552
|
||||
+ lib.optionalString stdenv.hostPlatform.isAarch64 ''
|
||||
substituteInPlace warp/tests/test_fem.py \
|
||||
--replace-fail "add_function_test(TestFem, \"test_integrate_gradient\", test_integrate_gradient, devices=devices)" ""
|
||||
'';
|
||||
|
||||
build-system = [
|
||||
build
|
||||
setuptools
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
numpy
|
||||
];
|
||||
|
||||
nativeBuildInputs = lib.optionals libmathdxSupport [
|
||||
libmathdx
|
||||
cudaPackages.libcublas
|
||||
cudaPackages.libcufft
|
||||
cudaPackages.libnvjitlink
|
||||
];
|
||||
|
||||
buildInputs =
|
||||
lib.optionals standaloneSupport [
|
||||
llvmPackages.llvm
|
||||
llvmPackages.clang
|
||||
llvmPackages.libcxx
|
||||
]
|
||||
++ lib.optionals cudaSupport [
|
||||
cudaPackages.cudatoolkit
|
||||
cudaPackages.cuda_cudart
|
||||
cudaPackages.cuda_nvcc
|
||||
cudaPackages.cuda_nvrtc
|
||||
];
|
||||
|
||||
preBuild =
|
||||
let
|
||||
buildOptions =
|
||||
lib.optionals (!standaloneSupport) [
|
||||
"--no_standalone"
|
||||
]
|
||||
++ lib.optionals cudaSupport [
|
||||
"--cuda_path=${cudaPackages.cudatoolkit}"
|
||||
]
|
||||
++ lib.optionals libmathdxSupport [
|
||||
"--libmathdx"
|
||||
"--libmathdx_path=${libmathdx}"
|
||||
]
|
||||
++ lib.optionals (!libmathdxSupport) [
|
||||
"--no_libmathdx"
|
||||
];
|
||||
|
||||
buildOptionString = lib.concatStringsSep " " buildOptions;
|
||||
in
|
||||
''
|
||||
python build_lib.py ${buildOptionString}
|
||||
'';
|
||||
|
||||
pythonImportsCheck = [
|
||||
"warp"
|
||||
];
|
||||
|
||||
# Many unit tests fail with segfaults on aarch64-linux, especially in the sim
|
||||
# and grad modules. However, other functionality generally works, so we don't
|
||||
# mark the package as broken.
|
||||
#
|
||||
# See: https://www.github.com/NVIDIA/warp/issues/{356,372,552}
|
||||
doCheck = !(stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux);
|
||||
|
||||
nativeCheckInputs = [
|
||||
unittestCheckHook
|
||||
(jax.override { inherit cudaSupport; })
|
||||
(torch.override { inherit cudaSupport; })
|
||||
|
||||
# # Disable paddlepaddle interop tests: malloc(): unaligned tcache chunk detected
|
||||
# (paddlepaddle.override { inherit cudaSupport; })
|
||||
];
|
||||
|
||||
preCheck = ''
|
||||
export WARP_CACHE_PATH=$(mktemp -d) # warp.config.kernel_cache_dir
|
||||
'';
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
description = "Python framework for high performance GPU simulation and graphics";
|
||||
longDescription = ''
|
||||
Warp is a Python framework for writing high-performance simulation
|
||||
and graphics code. Warp takes regular Python functions and JIT
|
||||
compiles them to efficient kernel code that can run on the CPU or
|
||||
GPU.
|
||||
|
||||
Warp is designed for spatial computing and comes with a rich set
|
||||
of primitives that make it easy to write programs for physics
|
||||
simulation, perception, robotics, and geometry processing. In
|
||||
addition, Warp kernels are differentiable and can be used as part
|
||||
of machine-learning pipelines with frameworks such as PyTorch,
|
||||
JAX and Paddle.
|
||||
'';
|
||||
homepage = "https://github.com/NVIDIA/warp";
|
||||
changelog = "https://github.com/NVIDIA/warp/blob/v${version}/CHANGELOG.md";
|
||||
license = lib.licenses.asl20;
|
||||
platforms = with lib.platforms; linux ++ darwin;
|
||||
maintainers = with lib.maintainers; [ yzx9 ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
diff --git a/build_llvm.py b/build_llvm.py
|
||||
index 9d5a26a7..839909ad 100644
|
||||
--- a/build_llvm.py
|
||||
+++ b/build_llvm.py
|
||||
@@ -161,7 +161,6 @@ def build_from_source_for_arch(args, arch, llvm_source):
|
||||
"-D", "LLVM_INCLUDE_TESTS=FALSE",
|
||||
"-D", "LLVM_INCLUDE_TOOLS=TRUE", # Needed by Clang
|
||||
"-D", "LLVM_INCLUDE_UTILS=FALSE",
|
||||
- "-D", f"CMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 {abi_version}", # The pre-C++11 ABI is still the default on the CentOS 7 toolchain
|
||||
"-D", f"CMAKE_INSTALL_PREFIX={install_path}",
|
||||
"-D", f"LLVM_HOST_TRIPLE={host_triple}",
|
||||
"-D", f"CMAKE_OSX_ARCHITECTURES={osx_architectures}",
|
||||
diff --git a/warp/build_dll.py b/warp/build_dll.py
|
||||
index 4d411e1b..4177725b 100644
|
||||
--- a/warp/build_dll.py
|
||||
+++ b/warp/build_dll.py
|
||||
@@ -321,7 +321,7 @@ def build_dll_for_arch(args, dll_path, cpp_paths, cu_path, libs, arch, mode=None
|
||||
else:
|
||||
version = "-fabi-version=13" # GCC 8.2+
|
||||
|
||||
- cpp_flags = f'{version} --std=c++17 -fno-rtti -D{cuda_enabled} -D{mathdx_enabled} -D{cuda_compat_enabled} -fPIC -fvisibility=hidden -D_GLIBCXX_USE_CXX11_ABI=0 -I"{native_dir}" {includes} '
|
||||
+ cpp_flags = f'{version} --std=c++17 -fno-rtti -D{cuda_enabled} -D{mathdx_enabled} -D{cuda_compat_enabled} -fPIC -fvisibility=hidden -I"{native_dir}" {includes} '
|
||||
|
||||
if mode == "debug":
|
||||
cpp_flags += "-O0 -g -D_DEBUG -DWP_ENABLE_DEBUG=1 -fkeep-inline-functions"
|
||||
@@ -0,0 +1,62 @@
|
||||
diff --git a/build_llvm.py b/build_llvm.py
|
||||
index 9d5a26a7..3663e9c9 100644
|
||||
--- a/build_llvm.py
|
||||
+++ b/build_llvm.py
|
||||
@@ -338,25 +338,19 @@ def build_warp_clang_for_arch(args, lib_name, arch):
|
||||
|
||||
clang_dll_path = os.path.join(build_path, f"bin/{lib_name}")
|
||||
|
||||
- if args.build_llvm:
|
||||
- # obtain Clang and LLVM libraries from the local build
|
||||
- install_path = os.path.join(llvm_install_path, f"{args.mode}-{arch}")
|
||||
- libpath = os.path.join(install_path, "lib")
|
||||
- else:
|
||||
- # obtain Clang and LLVM libraries from packman
|
||||
- fetch_prebuilt_libraries(arch)
|
||||
- libpath = os.path.join(base_path, f"_build/host-deps/llvm-project/release-{arch}/lib")
|
||||
-
|
||||
+ # obtain Clang and LLVM libraries from the local build
|
||||
libs = []
|
||||
-
|
||||
- for _, _, libraries in os.walk(libpath):
|
||||
- libs.extend(libraries)
|
||||
- break # just the top level contains library files
|
||||
+ install_paths = ["@LLVM_LIB@", "@LIBCLANG_LIB@"]
|
||||
+ libpaths = [os.path.join(install_path, "lib") for install_path in install_paths]
|
||||
+ for libpath in libpaths:
|
||||
+ for _, _, libraries in os.walk(libpath):
|
||||
+ libs.extend(libraries)
|
||||
+ break # just the top level contains library files
|
||||
|
||||
if os.name == "nt":
|
||||
libs.append("Version.lib")
|
||||
libs.append("Ws2_32.lib")
|
||||
- libs.append(f'/LIBPATH:"{libpath}"')
|
||||
+ libs.extend(f'/LIBPATH:"{libpath}"' for libpath in libpaths)
|
||||
else:
|
||||
libs = [f"-l{lib[3:-2]}" for lib in libs if os.path.splitext(lib)[1] == ".a"]
|
||||
if sys.platform == "darwin":
|
||||
@@ -364,7 +358,8 @@ def build_warp_clang_for_arch(args, lib_name, arch):
|
||||
else:
|
||||
libs.insert(0, "-Wl,--start-group")
|
||||
libs.append("-Wl,--end-group")
|
||||
- libs.append(f"-L{libpath}")
|
||||
+ libs.extend(f"-L{libpath}" for libpath in libpaths)
|
||||
+ libs.append("-lz")
|
||||
libs.append("-lpthread")
|
||||
libs.append("-ldl")
|
||||
if sys.platform != "darwin":
|
||||
diff --git a/warp/build_dll.py b/warp/build_dll.py
|
||||
index 4d411e1b..95fb7eaf 100644
|
||||
--- a/warp/build_dll.py
|
||||
+++ b/warp/build_dll.py
|
||||
@@ -311,8 +311,8 @@ def build_dll_for_arch(args, dll_path, cpp_paths, cu_path, libs, arch, mode=None
|
||||
run_cmd(link_cmd)
|
||||
|
||||
else:
|
||||
- cpp_includes = f' -I"{warp_home_path.parent}/external/llvm-project/out/install/{mode}-{arch}/include"'
|
||||
- cpp_includes += f' -I"{warp_home_path.parent}/_build/host-deps/llvm-project/release-{arch}/include"'
|
||||
+ cpp_includes = ' -I"@LLVM_DEV@/include"'
|
||||
+ cpp_includes += ' -I"@LIBCLANG_DEV@/include"'
|
||||
cuda_includes = f' -I"{cuda_home}/include"' if cu_path else ""
|
||||
includes = cpp_includes + cuda_includes
|
||||
@@ -19175,6 +19175,8 @@ self: super: with self; {
|
||||
|
||||
warlock = callPackage ../development/python-modules/warlock { };
|
||||
|
||||
warp-lang = callPackage ../development/python-modules/warp-lang { };
|
||||
|
||||
warrant = callPackage ../development/python-modules/warrant { };
|
||||
|
||||
warrant-lite = callPackage ../development/python-modules/warrant-lite { };
|
||||
|
||||
Reference in New Issue
Block a user