Skip to content

Commit 74793ca

Browse files
committed
Pass --gpus in packages/build.py
1 parent 7f5d354 commit 74793ca

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/build.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
default='/tmp',
3838
help='Directory to mount read-write as /dst inside the container',
3939
)
40+
parser.add_argument(
41+
'--gpus',
42+
metavar='GPU',
43+
help='docker run --gpus argument',
44+
)
4045
parser.add_argument(
4146
'script',
4247
metavar='SCRIPT',
@@ -117,6 +122,8 @@ def run(args: argparse.Namespace) -> None:
117122
'--volume',
118123
f'{os.path.abspath(args.dst)}:/dst:rw',
119124
]
125+
if args.gpus is not None:
126+
run_cmd = run_cmd + ['--gpus', args.gpus]
120127
if args.script:
121128
run_cmd = run_cmd + [
122129
'--volume',

packages/torchsparse.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ python3 setup.py bdist_wheel
2626

2727
find . -name '*.whl' > requirements.txt
2828
# import torchspase fails without GPU device
29-
/build/test.sh requirements.txt 'print()' # 'import torchsparse.backend; "count_cuda" in torchsparse.backend.__dict__'
29+
if [ -e /dev/nvidiactl ]; then
30+
/build/test.sh requirements.txt 'import torchsparse.backend; "count_cuda" in torchsparse.backend.__dict__'
31+
else
32+
echo 'GPU not found, add "--gpus all"'
33+
fi
3034

3135
find . -name '*.whl' -exec cp {} /dst \;

0 commit comments

Comments
 (0)