The graphics card
On this page
The graphics card is shared. Your Sols' model, listening and every app with gpu.use all want its memory, and nothing stops two of them overfilling it. So Solel decides who goes on the card, in the order the owner chose on Settings › Models. Out of the box that’s talking to Sols, then listening, then the Sols' background work, then apps' jobs.
Your back end takes part in two ways: it asks for room before a job loads onto the card, and it lets go when Solel asks.
Ask for room# Link to: Ask for room
Before a job loads, send the app’s token to POST $SOLEL_CORE_URL/api/gpu/room, with how much card memory the job needs:
curl -sS "$SOLEL_CORE_URL/api/gpu/room" \
-H "Authorization: Bearer $SOLEL_APP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"what": "Tagging photos", "bytes": 2147483648}'| Field | What it is |
|---|---|
bytes |
Needed. The card memory the job needs, in bytes |
what |
What the job is, in up to 100 characters. The owner sees it on Settings › Models while it waits |
now |
Optional. true when an admin pressed a button to run this job now. Everything else on the card is asked to let go, the Sols' model too, and the processor isn’t offered. Send the admin’s person ID in X-Solel-Person, or the answer is a 403. When you say you’re done, the Sols' model goes back on the card |
The answer comes once there’s room, so keep the request open, without a short timeout:
answer |
What to do |
|---|---|
go |
Load onto the card now |
processor |
The card is busy, and the owner lets jobs this size use the processor. Run it there instead |
While neither, the request waits, and the job shows as waiting on Settings › Models. Ending the request stops it waiting. Solel may ask others lower in the order to let go to make room; it never asks anyone before you in the order.
Your app needs the gpu.use grant, or the answer is a 403.
Say when you’re done# Link to: Say when you're done
When the job is off the card, say so:
curl -sS -X POST "$SOLEL_CORE_URL/api/gpu/done" -H "Authorization: Bearer $SOLEL_APP_TOKEN"See the card# Link to: See the card
To show people how full the card is, ask for the server’s cards. You get each card’s name and its memory and how much of it is in use, in bytes, plus the server’s own name. Who holds what stays on Settings › Models, for the server’s admins.
curl -sS "$SOLEL_CORE_URL/api/gpu/cards" -H "Authorization: Bearer $SOLEL_APP_TOKEN"
# {"server": "mercury", "cards": [{"name": "AMD Radeon RX 9070 XT", "memory": 17179869184, "used": 12884901888}]}The figures are 0 when the driver doesn’t say.
Let go when asked# Link to: Let go when asked
When something before your app’s jobs needs the room, like a person talking to a Sol, Solel sends your back end POST /.solel/gpu/let-go, with your app’s token as the bearer token and {"seconds": 30} as the body. Stop what you’re doing on the card, free its memory, and send /api/gpu/done. Then ask for room again before you carry on.
An app that asked for room and still holds the card 30 seconds later has its job stopped: its back end is started afresh. Save your progress as you go, so the job picks up where it left off.
An app that doesn’t ask# Link to: An app that doesn't ask
Linux can’t hold one container to a share of the card’s memory, so an app could load onto it without asking. Solel sees what each app holds there. An app that never asked is shown on Settings › Models, and the owner is told once. It isn’t stopped, but Solel can’t make room by asking it, so the Sols may have to share.