Skip to content

Commit

Permalink
Merge pull request #391 from kmaehashi/fix-workdir-preload
Browse files Browse the repository at this point in the history
Fix `prepare_cuda_opt_library` assumes `--source cupy`
  • Loading branch information
takagi authored Sep 11, 2024
2 parents d202734 + 3af1f16 commit b6fec7c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def run_command_output(*cmd, **kwargs):
return subprocess.check_output(cmd, **kwargs)


def prepare_cuda_opt_library(library, cuda_version, prefix):
def prepare_cuda_opt_library(library, cuda_version, prefix, *, workdir):
"""Extracts the library to the prefix, and returns preloading metadata."""

target_system = platform.system()
Expand All @@ -69,7 +69,8 @@ def prepare_cuda_opt_library(library, cuda_version, prefix):
'--prefix', prefix,
]
records = json.loads(
run_command_output(*command, '--action', 'dump').decode('utf-8'))
run_command_output(
*command, '--action', 'dump', cwd=workdir).decode('utf-8'))
for record in records:
if record['cuda'] == cuda_version:
metadata = {
Expand All @@ -81,7 +82,7 @@ def prepare_cuda_opt_library(library, cuda_version, prefix):
raise RuntimeError('Combination not supported by install_library tool')

log('Extracting the library to {}'.format(prefix))
run_command(*command, '--action', 'install')
run_command(*command, '--action', 'install', cwd=workdir)

return metadata

Expand Down Expand Up @@ -412,7 +413,7 @@ def build_linux(

for p in preloads:
wheel_metadata[p] = prepare_cuda_opt_library(
p, cuda_version, optlib_workdir)
p, cuda_version, optlib_workdir, workdir=workdir)
log('Writing wheel metadata')
with open('{}/_wheel.json'.format(workdir), 'w') as f:
json.dump(wheel_metadata, f)
Expand Down Expand Up @@ -562,7 +563,7 @@ def build_windows(
os.mkdir(optlib_workdir)
for p in preloads:
wheel_metadata[p] = prepare_cuda_opt_library(
p, cuda_version, optlib_workdir)
p, cuda_version, optlib_workdir, workdir=workdir)

# Create a wheel metadata file for preload.
log('Writing wheel metadata')
Expand Down

0 comments on commit b6fec7c

Please sign in to comment.