Commands and scripts
Any executable can be a GPUlayer job: a shell script, a compiled CUDA program, a Python script,
ffmpeg, a Julia or R script. The job runs in a fresh directory on the chosen worker, with
your source directory and input files staged next to it.
Run a command
gpulayer submit -- python -c "print('hello')"gpulayer submit --accelerator mps -- python train.pygpulayer submit --source ./project --timeout 3600 --env MODE=fast -- python train.py --lr 0.01gpulayer submit --input data.csv:raw/data.csv -- python prep.py # file at $GPULAYER_INPUT_DIR/raw/data.csvgpulayer submit --secret API_KEY=MY_API_KEY -- python call_api.py # read from the worker's environment
Without --detach, the CLI streams the output and exits with the job's exit code. With an
embedded control plane it also starts a worker in the same process for the duration of the
command.
A leading python means the worker's interpreter. Jobs do not inherit the worker's
environment; pass values with --env and --secret (see
Environment variables).
A complete example
examples/shell_job sums a CSV with awk and returns the result
file:
gpulayer submit --source examples/shell_job \--input examples/shell_job/sales.csv:sales.csv -- bash report.shgpulayer job result <job-id> --download ./out # out/totals.csv
Call a function
gpulayer submit --source ./project --function pkg.module:train --arg 0.01 --arg '{"epochs": 5}'
Arguments are JSON; the return value is printed as JSON.
Distributed scripts
gpulayer submit --distributed --source ./project --entrypoint train_ddp.py \--nodes 2 --procs-per-node 4 --accelerator cuda --backend nccl
See Distributed training.
Queue now, run later
gpulayer submit --detach -- python long_job.py # prints the job idgpulayer worker start # a long-running worker picks it up
Inspect and control
gpulayer job listgpulayer job status <job-id> # state, why it was placed (or not), tasks per nodegpulayer job logs <job-id> -f # follow outputgpulayer job events <job-id> # lifecycle events with timestampsgpulayer job result <job-id> --download ./outgpulayer job cancel <job-id>gpulayer worker status
When a job cannot be placed, job status shows the reason for every worker:
scheduling: no eligible workerwkr-10c5089a6044: needs 1 usable cuda device(s), worker has 0
Against a server
Set GPULAYER_URL, GPULAYER_TOKEN and GPULAYER_FINGERPRINT (printed by
gpulayer up), or pass --url, --token and --fingerprint before the
command. The same commands then talk to the server instead of the embedded control plane.
Full option list: CLI reference.