add nalgebra::linalg methods #478
26
flake.nix
26
flake.nix
@ -6,6 +6,7 @@
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
pkgs32 = import nixpkgs { system = "i686-linux"; };
|
||||
in rec {
|
||||
packages.x86_64-linux = rec {
|
||||
llvm-nac3 = pkgs.callPackage ./nix/llvm {};
|
||||
@ -15,6 +16,22 @@
|
||||
ln -s ${pkgs.llvmPackages_14.clang-unwrapped}/bin/clang $out/bin/clang-irrt
|
||||
ln -s ${pkgs.llvmPackages_14.llvm.out}/bin/llvm-as $out/bin/llvm-as-irrt
|
||||
'';
|
||||
demo-linalg-stub = pkgs.rustPlatform.buildRustPackage {
|
||||
name = "demo-linalg-stub";
|
||||
src = ./nac3standalone/demo/linalg;
|
||||
cargoLock = {
|
||||
lockFile = ./nac3standalone/demo/linalg/Cargo.lock;
|
||||
};
|
||||
doCheck = false;
|
||||
};
|
||||
demo-linalg-stub32 = pkgs32.rustPlatform.buildRustPackage {
|
||||
name = "demo-linalg-stub32";
|
||||
src = ./nac3standalone/demo/linalg;
|
||||
cargoLock = {
|
||||
lockFile = ./nac3standalone/demo/linalg/Cargo.lock;
|
||||
};
|
||||
doCheck = false;
|
||||
};
|
||||
nac3artiq = pkgs.python3Packages.toPythonModule (
|
||||
pkgs.rustPlatform.buildRustPackage rec {
|
||||
name = "nac3artiq";
|
||||
@ -32,7 +49,9 @@
|
||||
echo "Checking nac3standalone demos..."
|
||||
pushd nac3standalone/demo
|
||||
patchShebangs .
|
||||
./check_demos.sh
|
||||
export DEMO_LINALG_STUB=${demo-linalg-stub}/lib/liblinalg.a
|
||||
export DEMO_LINALG_STUB32=${demo-linalg-stub32}/lib/liblinalg.a
|
||||
./check_demos.sh -i686
|
||||
popd
|
||||
echo "Running Cargo tests..."
|
||||
cargoCheckHook
|
||||
@ -162,6 +181,11 @@
|
||||
pre-commit
|
||||
rustfmt
|
||||
];
|
||||
shellHook =
|
||||
''
|
||||
export DEMO_LINALG_STUB=${packages.x86_64-linux.demo-linalg-stub}/lib/liblinalg.a
|
||||
export DEMO_LINALG_STUB32=${packages.x86_64-linux.demo-linalg-stub32}/lib/liblinalg.a
|
||||
'';
|
||||
};
|
||||
devShells.x86_64-linux.msys2 = pkgs.mkShell {
|
||||
name = "nac3-dev-shell-msys2";
|
||||
|
@ -3,26 +3,49 @@
|
||||
set -e
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Requires at least one argument"
|
||||
exit 1
|
||||
echo "No argument supplied"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -a nac3args
|
||||
while [ $# -ge 2 ]; do
|
||||
case "$1" in
|
||||
--help)
|
||||
echo "Usage: check_demo.sh [-i686] -- demo [NAC3ARGS...]"
|
||||
exit
|
||||
;;
|
||||
-i686)
|
||||
i686=1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
demo="$1"
|
||||
shift
|
||||
while [ $# -gt 1 ]; do
|
||||
nac3args+=("$1")
|
||||
shift
|
||||
done
|
||||
demo="$1"
|
||||
|
||||
|
||||
echo "### Checking $demo..."
|
||||
|
||||
# Get reference output
|
||||
echo ">>>>>> Running $demo with the Python interpreter"
|
||||
|
||||
./interpret_demo.py "$demo" > interpreted.log
|
||||
|
||||
echo "...... Trying NAC3's 32-bit code generator output"
|
||||
./run_demo.sh -i386 --out run_32.log "${nac3args[@]}" "$demo"
|
||||
diff -Nau interpreted.log run_32.log
|
||||
if [ -n "$i686" ]; then
|
||||
echo "...... Trying NAC3's 32-bit code generator output"
|
||||
./run_demo.sh -i686 --out run_32.log "${nac3args[@]}" "$demo"
|
||||
diff -Nau interpreted.log run_32.log
|
||||
fi
|
||||
|
||||
echo "...... Trying NAC3's 64-bit code generator output"
|
||||
./run_demo.sh --out run_64.log "${nac3args[@]}" "$demo"
|
||||
@ -31,4 +54,4 @@ diff -Nau interpreted.log run_64.log
|
||||
echo "...... OK"
|
||||
|
||||
rm -f interpreted.log \
|
||||
run_32.log run_64.log
|
||||
run_32.log run_64.log
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
set -e
|
||||
|
||||
: "${DEMO_LINALG_STUB:=linalg/target/release/liblinalg.a}"
|
||||
: "${DEMO_LINALG_STUB32:=linalg/target/i686-unknown-linux-gnu/release/liblinalg.a}"
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "No argument supplied"
|
||||
exit 1
|
||||
@ -11,7 +14,7 @@ declare -a nac3args
|
||||
while [ $# -ge 1 ]; do
|
||||
case "$1" in
|
||||
--help)
|
||||
echo "Usage: run_demo.sh [--help] [--out OUTFILE] [--debug] [-i386] -- [NAC3ARGS...]"
|
||||
echo "Usage: run_demo.sh [--help] [--out OUTFILE] [--debug] [-i686] -- [NAC3ARGS...]"
|
||||
exit
|
||||
;;
|
||||
--out)
|
||||
@ -21,8 +24,8 @@ while [ $# -ge 1 ]; do
|
||||
--debug)
|
||||
debug=1
|
||||
;;
|
||||
-i386)
|
||||
i386=1
|
||||
-i686)
|
||||
i686=1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
@ -51,20 +54,14 @@ fi
|
||||
|
||||
rm -f ./*.o ./*.bc demo
|
||||
|
||||
if [ -z "$i386" ]; then
|
||||
if [ -z "$i686" ]; then
|
||||
$nac3standalone "${nac3args[@]}"
|
||||
|
||||
cd linalg && cargo build --release --target x86_64-unknown-linux-gnu -q && cd ..
|
||||
clang -c -std=gnu11 -Wall -Wextra -O3 -o demo.o demo.c
|
||||
clang -lm -Wl,--no-warn-search-mismatch -o demo module.o demo.o linalg/target/x86_64-unknown-linux-gnu/release/liblinalg.a
|
||||
clang -o demo module.o demo.o $DEMO_LINALG_STUB -lm -Wl,--no-warn-search-mismatch
|
||||
sb10q
commented
Can you really pass a DSO to clang and get it linked in? Can you really pass a DSO to clang and get it linked in?
sb10q
commented
Anyway I would just make it a static lib. Anyway I would just make it a static lib.
|
||||
else
|
||||
# Enable SSE2 to avoid rounding errors with X87's 80-bit fp precision computations
|
||||
|
||||
$nac3standalone --triple i386-pc-linux-gnu --target-features +sse2 "${nac3args[@]}"
|
||||
|
||||
cd linalg && cargo build --release --target i686-unknown-linux-gnu -q && cd ..
|
||||
clang -m32 -c -std=gnu11 -Wall -Wextra -O3 -msse2 -o demo.o demo.c
|
||||
clang -m32 -lm -Wl,--no-warn-search-mismatch -o demo module.o demo.o linalg/target/i686-unknown-linux-gnu/release/liblinalg.a
|
||||
$nac3standalone --triple i686-unknown-linux-gnu "${nac3args[@]}"
|
||||
clang -m32 -c -std=gnu11 -Wall -Wextra -O3 -msse2 -o demo.o demo.c
|
||||
clang -m32 -o demo module.o demo.o $DEMO_LINALG_STUB32 -lm -Wl,--no-warn-search-mismatch
|
||||
fi
|
||||
sb10q
commented
indentation indentation
sb10q
commented
But nevermind I'll fix it But nevermind I'll fix it
|
||||
|
||||
if [ -z "$outfile" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user
Removing LLI should (1) be done more thoroughly, we don't want to drag dead code along (2) be a separate PR.
Since we can't really link a static library with
lli
it won't be able to run the new functions and the tests will fail. Generating DSO and linking using that should work though.Yes, let's just remove the LLI tests entirely.