Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GLOG export flags for torch-sparse and torch-scatter #270

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions python-torch-scatter/0001_add_glog_export_flags.patch
Original file line number Diff line number Diff line change
@@ -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:
12 changes: 10 additions & 2 deletions python-torch-scatter/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
21 changes: 21 additions & 0 deletions python-torch-sparse/0001_add_glog_export_flags.patch
Original file line number Diff line number Diff line change
@@ -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:
12 changes: 10 additions & 2 deletions python-torch-sparse/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down