From b16191f3c936fecae0f0d246d3cdd559bfaf5270 Mon Sep 17 00:00:00 2001 From: Oliver Reiter Date: Mon, 15 Jul 2024 22:46:35 +0200 Subject: [PATCH 1/2] Add GLOG flags patch in torch-scatter --- .../0001_add_glog_export_flags.patch | 20 +++++++++++++++++++ python-torch-scatter/PKGBUILD | 12 +++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 python-torch-scatter/0001_add_glog_export_flags.patch diff --git a/python-torch-scatter/0001_add_glog_export_flags.patch b/python-torch-scatter/0001_add_glog_export_flags.patch new file mode 100644 index 0000000..0a11087 --- /dev/null +++ b/python-torch-scatter/0001_add_glog_export_flags.patch @@ -0,0 +1,20 @@ +--- setup.py 2023-10-05 20:36:18.000000000 +0200 ++++ setup.py.new 2024-07-15 22:06:58.553935150 +0200 +@@ -44,7 +44,7 @@ + if sys.platform == 'win32': + define_macros += [('torchscatter_EXPORTS', None)] + +- extra_compile_args = {'cxx': ['-O3']} ++ extra_compile_args = {'cxx': ['-O3', '-DGLOG_USE_GLOG_EXPORT']} + if not os.name == 'nt': # Not on Windows: + extra_compile_args['cxx'] += ['-Wno-sign-compare'] + extra_link_args = [] if WITH_SYMBOLS else ['-s'] +@@ -69,7 +69,7 @@ + define_macros += [('WITH_CUDA', None)] + nvcc_flags = os.getenv('NVCC_FLAGS', '') + nvcc_flags = [] if nvcc_flags == '' else nvcc_flags.split(' ') +- nvcc_flags += ['-O3'] ++ nvcc_flags += ['-O3', '-DGLOG_USE_GLOG_EXPORT'] + if torch.version.hip: + # USE_ROCM was added to later versions of PyTorch. + # Define here to support older PyTorch versions as well: diff --git a/python-torch-scatter/PKGBUILD b/python-torch-scatter/PKGBUILD index e0a7822..37b1c58 100644 --- a/python-torch-scatter/PKGBUILD +++ b/python-torch-scatter/PKGBUILD @@ -10,13 +10,21 @@ license=('MIT') depends=('python') makedepends=('python' 'python-build' 'python-installer' 'python-wheel' 'python-setuptools') -source=("$pkgname-$pkgver.tar.gz::https://github.com/rusty1s/pytorch_scatter/archive/refs/tags/$pkgver.tar.gz") -sha256sums=('6f375dbc9cfe03f330aa29ea553e9c7432e9b040d039b041f08bf05df1a8bf37') +source=("$pkgname-$pkgver.tar.gz::https://github.com/rusty1s/pytorch_scatter/archive/refs/tags/$pkgver.tar.gz" "0001_add_glog_export_flags.patch") +sha256sums=('6f375dbc9cfe03f330aa29ea553e9c7432e9b040d039b041f08bf05df1a8bf37' +'d36abaa3d10bf5bd788ce669db6cfd7a9b2a6c4b271c37ffb772173cba9ac9a9') _pkgname=pytorch_scatter +prepare() { + cd "${srcdir}/${_pkgname}-${pkgver}" + patch -p0 -i ../0001_add_glog_export_flags.patch +} + build() { cd "${srcdir}/${_pkgname}-${pkgver}" + unset CFLAGS + unset CXXFLAGS python -m build --wheel --no-isolation } From 8b716737e3db1ab3094798d868903c034a999cf2 Mon Sep 17 00:00:00 2001 From: Oliver Reiter Date: Mon, 15 Jul 2024 22:46:56 +0200 Subject: [PATCH 2/2] Add GLOG flags patch in torch-sparse --- .../0001_add_glog_export_flags.patch | 21 +++++++++++++++++++ python-torch-sparse/PKGBUILD | 12 +++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 python-torch-sparse/0001_add_glog_export_flags.patch diff --git a/python-torch-sparse/0001_add_glog_export_flags.patch b/python-torch-sparse/0001_add_glog_export_flags.patch new file mode 100644 index 0000000..b2c19ca --- /dev/null +++ b/python-torch-sparse/0001_add_glog_export_flags.patch @@ -0,0 +1,21 @@ +--- setup.py 2023-10-05 22:16:49.000000000 +0200 ++++ setup.py.new 2024-07-15 21:15:57.034407145 +0200 +@@ -64,7 +64,8 @@ + define_macros += [('MTMETIS_64BIT_PARTITIONS', None)] + libraries += ['mtmetis', 'wildriver'] + +- extra_compile_args = {'cxx': ['-O3']} ++ # extra_compile_args = {'cxx': ['-O3']} ++ extra_compile_args = {'cxx': ['-O3', '-DGLOG_USE_GLOG_EXPORT']} + if not os.name == 'nt': # Not on Windows: + extra_compile_args['cxx'] += ['-Wno-sign-compare'] + if sys.platform == 'darwin': # On macOS: +@@ -91,7 +92,7 @@ + define_macros += [('WITH_CUDA', None)] + nvcc_flags = os.getenv('NVCC_FLAGS', '') + nvcc_flags = [] if nvcc_flags == '' else nvcc_flags.split(' ') +- nvcc_flags += ['-O3'] ++ nvcc_flags += ['-O3', '-DGLOG_USE_GLOG_EXPORT'] + if torch.version.hip: + # USE_ROCM was added to later versions of PyTorch + # Define here to support older PyTorch versions as well: diff --git a/python-torch-sparse/PKGBUILD b/python-torch-sparse/PKGBUILD index d4aa936..ac3fe10 100644 --- a/python-torch-sparse/PKGBUILD +++ b/python-torch-sparse/PKGBUILD @@ -11,13 +11,21 @@ license=('MIT') depends=('python' 'python-scipy') makedepends=('python' 'python-build' 'python-installer' 'python-wheel' 'python-setuptools' 'parallel-hashmap') -source=("$pkgname-$pkgver::https://github.com/rusty1s/pytorch_sparse/archive/refs/tags/$pkgver.tar.gz") -sha256sums=('a9e194cddc17481001ac4592a058450493ce13780e8ce3eb54d4f79706e69c91') +source=("$pkgname-$pkgver::https://github.com/rusty1s/pytorch_sparse/archive/refs/tags/$pkgver.tar.gz" "0001_add_glog_export_flags.patch") +sha256sums=('a9e194cddc17481001ac4592a058450493ce13780e8ce3eb54d4f79706e69c91' +'9c3ee90e18a80c110abffd28cd3323794ec21f43c026ae1034e8aea2e957d9f3') _pkgname=pytorch_sparse +prepare() { + cd "${srcdir}/${_pkgname}-${pkgver}" + patch -p0 -i ../0001_add_glog_export_flags.patch +} + build() { cd "${srcdir}/${_pkgname}-${pkgver}" + unset CFLAGS + unset CXXFLAGS python -m build --wheel --no-isolation }