@@ -150,17 +150,59 @@ def update_matrix(existing_version: str, new_version: str, matrix_path: Path) ->
150150 f .write (content )
151151
152152
153- def main (version : str , cuda_python_repo : Path , cybind_repo : Path , is_prev : bool ):
153+ def regenerate_cython_gen (cuda_python_private_repo : Path , cuda_python_repo : Path ) -> int :
154+ with tempfile .TemporaryDirectory () as tempdir :
155+ tempdir_path = Path (tempdir )
156+
157+ venv .create (tempdir_path , with_pip = True )
158+ subprocess .check_call ( # noqa: S603
159+ [
160+ str (tempdir_path / "bin" / "python" ),
161+ "-m" ,
162+ "pip" ,
163+ "install" ,
164+ "-r" ,
165+ str (cuda_python_private_repo / "requirements.txt" ),
166+ ]
167+ )
168+ try :
169+ subprocess .check_call ( # noqa: S603
170+ [
171+ str (tempdir_path / "bin" / "python" ),
172+ str (cuda_python_private_repo / "regenerate.py" ),
173+ "-t" ,
174+ "driver" ,
175+ "-t" ,
176+ "runtime" ,
177+ "-t" ,
178+ "nvrtc" ,
179+ "-o" ,
180+ str (cuda_python_repo ),
181+ ],
182+ cwd = cuda_python_private_repo ,
183+ )
184+ except subprocess .CalledProcessError :
185+ print ("Error running cython-gen." )
186+ print ("This probably indicates an issue introduced with the new headers." )
187+ return 1
188+
189+ return 0
190+
191+
192+ def main (version : str , cuda_python_repo : Path , cybind_repo : Path , cuda_python_private_repo : Path , is_prev : bool ):
154193 cybind_headers_path = cybind_repo / "assets" / "headers"
155194 cybind_config_path = cybind_repo / "assets" / "configs"
156195
196+ existing_version = update_version_file (version , cuda_python_repo / "ci" / "versions.json" , is_prev )
197+ update_matrix (existing_version , version , cuda_python_repo / "ci" / "test-matrix.json" )
198+
199+ if regenerate_cython_gen (cuda_python_private_repo , cuda_python_repo ):
200+ sys .exit (1 )
201+
157202 for libname , distname , subdir in CYBIND_GENERATED_LIBRARIES :
158203 fetch_headers (version , distname , cybind_headers_path / subdir )
159204 update_config (version , cybind_config_path / f"config_{ libname } .py" )
160205
161- existing_version = update_version_file (version , cuda_python_repo / "ci" / "versions.json" , is_prev )
162- update_matrix (existing_version , version , cuda_python_repo / "ci" / "test-matrix.json" )
163-
164206 # Do this last, because, if anything, it's the thing that's likely to fail
165207 if run_cybind (cybind_repo , cuda_python_repo , [x [0 ] for x in CYBIND_GENERATED_LIBRARIES ]):
166208 sys .exit (1 )
@@ -173,6 +215,11 @@ def main(version: str, cuda_python_repo: Path, cybind_repo: Path, is_prev: bool)
173215 type = Path ,
174216 help = "Path to a checkout of cybind (default: ../cybind relative to cuda-python)" ,
175217 )
218+ parser .add_argument (
219+ "--cuda-python-private-repo" ,
220+ type = Path ,
221+ help = "Path to a checkout of cuda-python-private (default: ../cuda-python-private relative to cuda-python)" ,
222+ )
176223 parser .add_argument (
177224 "--is-prev" ,
178225 action = "store_true" ,
@@ -190,9 +237,16 @@ def main(version: str, cuda_python_repo: Path, cybind_repo: Path, is_prev: bool)
190237 if args .cybind_repo is None :
191238 args .cybind_repo = cuda_python_repo .parent / "cybind"
192239
240+ if args .cuda_python_private_repo is None :
241+ args .cuda_python_private_repo = cuda_python_repo .parent / "cuda-python-private"
242+
193243 print ("Before running this script, you need to:" )
194244 print (" - Create a new branch in this repo based on upstream/main" )
195245 print (f" - Create a new branch in a cybind checkout at { args .cybind_repo } based on upstream/main" )
246+ print (
247+ f" - Create a new branch in a cuda-python-private checkout at { cuda_python_repo } based on upstream/cython-gen"
248+ )
249+ print (" - Install the version of CTK you are adding and make sure CUDA_HOME is pointing to it." )
196250 print ()
197251 print (f"This will add CTK { args .version } as the { 'previous' if args .is_prev else 'latest' } version." )
198252 print ("Proceed? [y/N]" )
@@ -201,12 +255,15 @@ def main(version: str, cuda_python_repo: Path, cybind_repo: Path, is_prev: bool)
201255 print ("Aborting" )
202256 sys .exit (0 )
203257
204- main (args .version , cuda_python_repo , args .cybind_repo , args .is_prev )
258+ main (args .version , cuda_python_repo , args .cybind_repo , args .cuda_python_private_repo , args . is_prev )
205259
206260 print ("Remaining manual steps:" )
207- print ("- Add a changelog entry:" )
261+ print ("- Add a changelog entry, for example:" )
262+ print ()
208263 print (
209264 f"* Updated the ``cuda.bindings.runtime`` module to statically link "
210265 f"against the CUDA Runtime library from CUDA Toolkit { args .version } ."
211266 )
212- print ("- Inspect the changes to this repo and cybind, commit and submit PRs." )
267+ print ()
268+ print ("- Inspect the changes to this repo, cuda-python-private and cybind, " )
269+ print (" commit and submit PRs." )
0 commit comments