Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef82b77

Browse files
BLD Use Cython's shared memoryview utility to reduce wheel size (#31151)
Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
1 parent961afc7 commitef82b77

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

‎sklearn/meson.build

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ else:
180180
check:true
181181
).stdout().strip()
182182

183+
cython_program=find_program(cython.cmd_array()[0])
184+
183185
scikit_learn_cython_args= [
184186
'-X language_level=3','-X boundscheck='+ boundscheck,'-X wraparound=False',
185187
'-X initializedcheck=False','-X nonecheck=False','-X cdivision=True',
@@ -190,7 +192,25 @@ scikit_learn_cython_args = [
190192
]
191193
cython_args+= scikit_learn_cython_args
192194

193-
cython_program=find_program(cython.cmd_array()[0])
195+
if cython.version().version_compare('>=3.1.0')
196+
cython_shared_src=custom_target(
197+
install:false,
198+
output:'_cyutility.c',
199+
command: [
200+
cython_program,'-3','--fast-fail',
201+
'--generate-shared='+meson.current_build_dir()/'_cyutility.c'
202+
],
203+
)
204+
205+
py.extension_module('_cyutility',
206+
cython_shared_src,
207+
subdir:'sklearn',
208+
cython_args: cython_args,
209+
install:true,
210+
)
211+
212+
cython_args+= ['--shared=sklearn._cyutility']
213+
endif
194214

195215
cython_gen=generator(cython_program,
196216
arguments: cython_args+ ['@INPUT@','--output-file','@OUTPUT@'],
@@ -202,7 +222,6 @@ cython_gen_cpp = generator(cython_program,
202222
output:'@BASENAME@.cpp',
203223
)
204224

205-
206225
# Write file in Meson build dir to be able to figure out from Python code
207226
# whether scikit-learn was built with Meson. Adapted from pandas
208227
# _version_meson.py.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp