pip - build with avx2 support by default

This commit is contained in:
Matthias Hochsteger 2022-09-16 15:47:14 +02:00
parent f91769d53d
commit b40c1db612
4 changed files with 12 additions and 10 deletions

View File

@ -43,10 +43,14 @@ cmake_args = [
f'-DNETGEN_VERSION_PYTHON={version}', f'-DNETGEN_VERSION_PYTHON={version}',
] ]
if 'NETGEN_ARCH' in os.environ: if 'NETGEN_ARCH' in os.environ and os.environ['NETGEN_ARCH'] == 'avx2':
arch = os.environ['NETGEN_ARCH'] # build for avx2 architecture
name += "-"+arch if 'darwin' in sys.platform:
flag = '/'+arch if 'win' in sys.platform else '-march=core-avx2' flag = "'-Xarch_x86_64;-march=core-avx2'"
elif 'win' in sys.platform:
flag = '/AVX2'
else:
flag = '-march=core-avx2'
cmake_args += [f'-DNG_COMPILE_FLAGS={flag}'] cmake_args += [f'-DNG_COMPILE_FLAGS={flag}']
if 'NETGEN_CCACHE' in os.environ: if 'NETGEN_CCACHE' in os.environ:

View File

@ -6,6 +6,7 @@ if (test-path dist) {
} }
$env:NETGEN_CCACHE = 1 $env:NETGEN_CCACHE = 1
$env:NETGEN_ARCH = avx2
$pydir=$args[0] $pydir=$args[0]
& $pydir\python.exe --version & $pydir\python.exe --version

View File

@ -14,15 +14,11 @@ do
$PYDIR/pip install -U pytest-check numpy wheel scikit-build pybind11-stubgen $PYDIR/pip install -U pytest-check numpy wheel scikit-build pybind11-stubgen
rm -rf _skbuild rm -rf _skbuild
NETGEN_ARCH=avx2 $PYDIR/pip wheel .
$PYDIR/pip wheel . $PYDIR/pip wheel .
auditwheel repair netgen_mesher*-cp${pyversion}-*.whl auditwheel repair netgen_mesher*-cp${pyversion}-*.whl
rm netgen_mesher-*.whl rm netgen_mesher-*.whl
rm -rf _skbuild
NETGEN_ARCH=avx2 $PYDIR/pip wheel .
auditwheel repair netgen_mesher_avx2*-cp${pyversion}-*.whl
rm netgen_mesher_avx2-*.whl
$PYDIR/pip install wheelhouse/netgen_mesher*-cp${pyversion}-*.whl $PYDIR/pip install wheelhouse/netgen_mesher*-cp${pyversion}-*.whl
$PYDIR/python3 -c 'import netgen' $PYDIR/python3 -c 'import netgen'
#cd ../tests/pytest #cd ../tests/pytest

View File

@ -9,5 +9,6 @@ $PYDIR/python3 --version
$PYDIR/pip3 install --user numpy twine scikit-build wheel pybind11-stubgen $PYDIR/pip3 install --user numpy twine scikit-build wheel pybind11-stubgen
export CMAKE_OSX_ARCHITECTURES='arm64;x86_64' export CMAKE_OSX_ARCHITECTURES='arm64;x86_64'
export NETGEN_ARCH='avx2'
$PYDIR/python3 setup.py bdist_wheel --plat-name macosx-10.15-universal2 -j10 $PYDIR/python3 setup.py bdist_wheel --plat-name macosx-10.15-universal2 -j10
$PYDIR/python3 -m twine upload dist/*.whl $PYDIR/python3 -m twine upload dist/*.whl