diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9a56d12..0f7177b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -68,10 +68,10 @@ jobs:
bash tools/create_asm.sh
echo '
example
' >> $GITHUB_STEP_SUMMARY
- python tools/clean_asm.py build/asm/example.asm >> $GITHUB_STEP_SUMMARY
+ python tools/clean_asm.py build/runner/example.asm >> $GITHUB_STEP_SUMMARY
echo 'stencils_x86_64_O3.o
' >> $GITHUB_STEP_SUMMARY
- python tools/clean_asm.py build/asm/stencils.asm >> $GITHUB_STEP_SUMMARY
+ python tools/clean_asm.py build/runner/stencils.asm >> $GITHUB_STEP_SUMMARY
- name: Run tests with pytest
run: pytest
diff --git a/tools/clean_asm.py b/tools/clean_asm.py
index ae39f05..b14193b 100644
--- a/tools/clean_asm.py
+++ b/tools/clean_asm.py
@@ -28,7 +28,7 @@ def main() -> None:
if outp_flag:
print(line + '
')
- if "Disassembly of section .text:" in line:
+ if "Disassembly of section .text" in line:
outp_flag = True
print('')
diff --git a/tools/create_asm.sh b/tools/create_asm.sh
index b939fb8..ca6e220 100644
--- a/tools/create_asm.sh
+++ b/tools/create_asm.sh
@@ -5,29 +5,29 @@ set -v
mkdir -p build/runner
-arch=$(python3 -c "import copapy; print(copapy._stencils.detect_process_arch())")
+cparch=$(python3 -c "import copapy; print(copapy._stencils.detect_process_arch())")
# Disassemble stencil object file
-objdump -d -x src/copapy/obj/stencils_${arch}_O3.o > build/runner/stencils.asm
+objdump -d -x src/copapy/obj/stencils_${cparch}_O3.o > build/runner/stencils.asm
# Create example code disassembly
python3 tools/make_example.py
build/runner/coparun build/runner/test.copapy build/runner/test.copapy.bin
-if [ $(arch) = 'x86_64' ]; then
- arch="i386:x86-64"
-elif [ $(arch) = 'x86' ]; then
- arch="i386"
-elif [ $(arch) = 'arm64' ]; then
- arch="aarch64"
-elif [ $(arch) = 'armv6' ]; then
- arch="arm"
-elif [ $(arch) = 'armv7' ]; then
- arch="arm"
+if [ "$cparch" = 'x86_64' ]; then
+ cparch="i386:x86-64"
+elif [ "$cparch" = 'x86' ]; then
+ cparch="i386"
+elif [ "$cparch" = 'arm64' ]; then
+ cparch="aarch64"
+elif [ "$cparch" = 'armv6' ]; then
+ cparch="arm"
+elif [ "$cparch" = 'armv7' ]; then
+ cparch="arm"
fi
-echo "Archtitecture: '$arch'"
+echo "Archtitecture: '$cparch'"
-objdump -D -b binary -m $arch --adjust-vma=0x10000 build/runner/test.copapy.bin > build/runner/example.asm
+objdump -D -b binary -m $cparch --adjust-vma=0x10000 build/runner/test.copapy.bin > build/runner/example.asm
rm build/runner/test.copapy.bin
diff --git a/tools/make_example.py b/tools/make_example.py
index 2f16334..6d9cebc 100644
--- a/tools/make_example.py
+++ b/tools/make_example.py
@@ -4,7 +4,7 @@ from copapy._binwrite import Command
import copapy as cp
-def compile_to_x86_64() -> None:
+def compile_example(arch: str = 'native') -> None:
"""Test compilation of a simple program for x86_64."""
c1 = value(9.0)
@@ -16,65 +16,16 @@ def compile_to_x86_64() -> None:
out = [Write(r) for r in ret]
- sdb = stencil_db_from_package('x86_64')
+ sdb = stencil_db_from_package(arch)
dw, _ = compile_to_dag(out, sdb)
dw.write_com(Command.DUMP_CODE)
- print('* Data to runner:')
- dw.print()
+ #print('* Data to runner:')
+ #dw.print()
dw.to_file('build/runner/test.copapy')
-def compile_to_x86() -> None:
- """Test compilation of a simple program for x86 32 bit."""
- c1 = value(9.0)
-
- #ret = [c1 / 4, c1 / -4, c1 // 4, c1 // -4, (c1 * -1) // 4]
- ret = [c1 // 3.3 + 5]
- #ret = [cp.sqrt(c1)]
- #c2 = cp._math.get_42()
- #ret = [c2]
- ret = [cp.sin(value(2.5))]
-
- out = [Write(r) for r in ret]
-
- sdb = stencil_db_from_package('x86')
- dw, _ = compile_to_dag(out, sdb)
-
- dw.write_com(Command.DUMP_CODE)
-
- print('* Data to runner:')
- dw.print()
-
- dw.to_file('build/runner/test-x86.copapy')
-
-
-def compile_to_aarch64() -> None:
- """Test compilation of a simple program for arm64."""
- c1 = value(9.0)
-
- #ret = [c1 / 4, c1 / -4, c1 // 4, c1 // -4, (c1 * -1) // 4]
- #ret = [cp.sin(c1), cp.sqrt(c1) + 5]
- ret = [c1 // 3.3 + 5]
- #c2 = cp._math.get_42()
- #ret = [c2]
-
- out = [Write(r) for r in ret]
-
- sdb = stencil_db_from_package('arm64')
- dw, _ = compile_to_dag(out, sdb)
-
- dw.write_com(Command.DUMP_CODE)
-
- print('* Data to runner:')
- dw.print()
-
- dw.to_file('build/runner/test-arm64.copapy')
-
-
if __name__ == "__main__":
- compile_to_x86_64()
- compile_to_x86()
- compile_to_aarch64()
+ compile_example()