diff --git a/README.md b/README.md index 3e4c559..95279af 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,8 @@ cat _codabench/scoring/scores.json ``` `python tools/run_docker.py` does the same inside the Docker image (needs -`pip install docker`). +`pip install docker`). Add `--gpu` to give ingestion the host GPUs, as on a +GPU worker (needs the NVIDIA Container Toolkit). ## Large data: staging it on a self-hosted worker diff --git a/tools/run_docker.py b/tools/run_docker.py index 6e23cba..ea138ce 100644 --- a/tools/run_docker.py +++ b/tools/run_docker.py @@ -6,10 +6,13 @@ ``benchmark_utils``, the metric, next to scoring), and the hidden test labels as ``/app/input/ref``. Prepare the data first with ``benchopt prepare benchmark -d Real`` (writes ``benchmark/data``). +``--gpu`` gives ingestion all the host GPUs (needs the NVIDIA Container +Toolkit). Usage ----- python tools/run_docker.py [--data ] [--submission ] + [--gpu] """ import argparse @@ -32,6 +35,8 @@ parser.add_argument("--submission", help="Folder holding submission.py (default: the " "sample benchmark/solvers/random-forest.py)") + parser.add_argument("--gpu", action="store_true", + help="Run ingestion with all the host GPUs") args = parser.parse_args() data = Path(args.data).resolve() @@ -50,9 +55,11 @@ ) out = REPO / "_codabench/ingestion" out.mkdir(parents=True, exist_ok=True) + gpus = [docker.types.DeviceRequest(count=-1, capabilities=[["gpu"]])] print("Running ingestion...") logs = client.containers.run( image=image, remove=True, name="ingestion", user="root", + device_requests=gpus if args.gpu else None, command="python3 /app/program/ingestion.py", volumes=[ f"{REPO / 'ingestion_program'}:/app/program:ro",