Update build-extension to allow arm compilation

#2
nemotron-ocr/scripts/build-extension.py CHANGED
@@ -5,6 +5,7 @@
5
 
6
 
7
  import os
 
8
  import sys
9
  import shutil
10
  from glob import glob
@@ -73,8 +74,8 @@ common_args = ["-std=c++17"]
73
  gcc_args = ["-fopenmp", "-DOMP_NESTED=true"]
74
  cuda_args = []
75
 
76
- # TODO: analyze if SIMD optimizations are beneficial on ARM
77
- if os.environ.get("ARCH") != "arm64":
78
  gcc_args += ["-mavx2"]
79
 
80
  files = sorted(glob("cpp/**/*.cu", recursive=True) + glob("cpp/**/*.cpp", recursive=True))
 
5
 
6
 
7
  import os
8
+ import platform
9
  import sys
10
  import shutil
11
  from glob import glob
 
74
  gcc_args = ["-fopenmp", "-DOMP_NESTED=true"]
75
  cuda_args = []
76
 
77
+ _target_arch = os.environ.get("ARCH", "").lower() or platform.machine().lower()
78
+ if _target_arch in ("x86_64", "amd64"):
79
  gcc_args += ["-mavx2"]
80
 
81
  files = sorted(glob("cpp/**/*.cu", recursive=True) + glob("cpp/**/*.cpp", recursive=True))