Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Computing on other computers (P2P compute)

Experimental: both settings are feature flags, off unless you turn them on.

A heavy Part Studio can take a while to rebuild on a laptop. With P2P compute, cadrs sends that work to other computers running cadrs: a workstation under the desk, a colleague’s computer, or a few computers a team shares. The parts come back and show as if they were built locally.

Two flags in Preferences › Feature flags turn it on:

FlagOn this computerUnder it
P2P Compute UseRebuilds, exports and drawing views also go to the computers listed.Compute on: their cadrs IDs. Also compute here (on by default).
P2P Compute ProvideThis computer does the geometry work of the computers listed, while cadrs is online.This computer’s cadrs ID, to give the others. Compute for: their cadrs IDs.

Both need cadrs online (the network button at the top). Both lists take up to 16 cadrs IDs, separated by commas. The Status line shows each computer listed and whether it is connected (or why not), where the last job was done, and how many computers this one is computing for.

Setting it up

  1. On the computer that will do the work, turn on P2P Compute Provide and copy its cadrs ID.
  2. On your computer, turn on P2P Compute Use, paste that ID under Compute on, and copy your own cadrs ID (Preferences › Collaboration).
  3. Back on the first computer, paste your ID under Compute for.

Two people who each want the other’s help both turn on both flags and list each other.

List only computers you trust. A computer you compute on builds your Part Studios and sends back the parts you see. cadrs checks that it runs the same release and build, but it can’t check every answer it gets from that computer.

What happens to a rebuild

  • Each Part Studio has a home. Every Part Studio goes to the same computer on the list, every time, and on every editor’s machine: the choice comes from the Part Studio itself, not from who is asking. That computer keeps what it worked out, so the next edit there starts from it, and another editor’s rebuild of a Part Studio it has already built (saved a moment after it was built) is read rather than built again. Two editors asking for the same new edit at the same moment still have it built twice there. Part Studios with different homes rebuild at the same time.
  • A computer that can’t be reached is skipped. Its Part Studios go to the next home on the list (or stay here) until it answers again; cadrs tries it again every few seconds.
  • Racing. With Also compute here on, your computer works on the same rebuild at the same moment, and the first answer is used. A quick edit finishes locally while the other computer is still reading it. A heavy one, or one the other computer has already built, comes back from there first. A failed answer from the other computer, or one it built without something only yours has (see Limits), isn’t used: your computer’s is. With Also compute here off, your computer leaves rebuilds to the other computer. It starts on one itself when no computer on the list can take it, or when the other computer hasn’t answered in time: a few seconds, plus three times what that Part Studio took last. The first answer is still used.
  • Independent features are spread out. Features that don’t depend on each other (blind extrudes of their own sketches, Booleans, Transforms that move parts) are computed in parallel: each waits only for the features before it that change or make a part it reads. When there are more of them than your computer has processor cores, the rest go to the computers on the list. Each core takes the next feature, its own first and then those sent out: the other computer’s answer if it has come; a short wait if it is due well before the core could build the feature; otherwise the core builds it itself.
  • Checked like local work. What comes back for one of those features goes through the same check as a result computed locally ahead of its turn: it is used only if nothing it read has changed since, and recomputed otherwise.

What crosses the network

Only what the other computer needs, and only once:

  • Features go whole the first time. After that, only the edited ones go whole; the rest are sent as references.
  • Imported files (an Import’s CAD file, an Image’s picture) go only for the features that use them, once per connection.
  • For a feature computed elsewhere, only the parts it touches go, with their bodies and without their meshes. Each body is sent once per connection. Only what the feature changed comes back.
  • Meshes come back once per connection, and a pattern’s copies come back as positions.
  • Everything travels over cadrs’s peer-to-peer connections, encrypted end to end. A computer computes only for the cadrs IDs it lists, and only while its flag is on: anyone else’s connection is closed at once with the reason, and turning the flag off closes the others’.
  • Both computers must be running the same cadrs release and build, on the same kind of system (Linux, Windows, and Macs with Apple or Intel chips each have their own build). They check this when they connect, and refuse to work together if their geometry could differ. A team on different systems can’t share compute yet.

On the computer that computes for others

  • On Linux and macOS its work for others runs at a lower priority than its own, so its own editing stays smooth. (On Windows it runs at the normal priority.)
  • Each computer it computes for gets up to four geometry processes there, and it runs at most twelve for others in all; one more is refused with the reason. A process left without work for 15 minutes ends; the other computer starts another when it needs one.
  • A request from another computer is at most 1 GB, and the files it brings at most 2 GB. It can only rebuild, export and project Part Studios there, nothing else.
  • What it works out for others is kept in a folder of its own (served, in the snapshots folder), apart from its own work. It is cleaned as it grows, keeping a week of results and at most 2 GB. Its own saved results are read from there too, never written. While it provides, it saves its own work a moment after each rebuild (not after a few idle seconds), so what you just built is ready for the others.
  • Full rebuild (the cache cleared) on a computer that uses others reaches them too: their geometry processes for it start afresh, and nothing they kept for it before is used.
  • A feature that crashes the geometry process here isn’t sent to the other computers either.

For a team

  • Two people working on one document, each building their part: both turn on both flags and list each other. With Also compute here on, each computer asks the other for every Part Studio and builds it too, and the first answer is used. The other computer keeps what it built for you in a geometry process of its own, and reads its own saved results, saved a moment after each of their rebuilds. So the Part Studio your colleague is working on usually comes back from their computer before yours could rebuild it, and yours comes from your own. When the other computer wins, it stops; yours finishes its rebuild unless other work comes (so what only this computer does, such as a dialog’s preview, finds the Part Studio built). A loser’s results aren’t sent.
  • A team spread across the world (200 ms or more between computers): with Also compute here on, a quick edit is finished locally before the network could answer. Long rebuilds, and Part Studios someone else already built, are where the other computers win. Features that took less than about twice the time of a trip to the other computer aren’t sent; cadrs measures that trip as answers come back, late ones included. A feature whose answer should come well before this computer could build it is waited for; otherwise it is built here.
  • Many editors, many computers: every editor lists the same computers. A Part Studio then has the same home for all of them, and that computer’s saved results serve everyone.

Limits

  • The browser version can’t use or provide P2P compute: it has no separate geometry process.
  • Feature batches go out for blind extrudes of their own sketches, Booleans, and Transforms that move parts (without copies), in Part Studios without derived parts or sheet metal. Every other feature (fillets, patterns, shells, sheet metal) is computed where its whole rebuild is.
  • Some work is always done on this computer: a feature’s stage in the rebuild, display levels, section caps, CAM models, interference checks, assembly drawing views, and importing and exporting files other than the STEP export of a Part Studio. When the other computer’s rebuild was used, the first of these rebuilds the Part Studio here first, so with Also compute here off it costs a local rebuild.
  • An export or drawing view of a Part Studio with a Derived feature is done on this computer.
  • A Derived feature whose source is another of your documents can’t be built on another computer (it doesn’t have your documents): when one fails there, this computer’s rebuild is used.
  • Debugging aids: CADRS_COMPUTE_WHOLE=0 keeps whole rebuilds local and sends out only feature batches. CADRS_PROFILE=1 logs how many features of each batch were sent out and how many came back in time.