Execution model
Contexts
Section titled “Contexts”A yuenix_context binds one GPU and one CUDA stream. Every plan, keyset, evaluator and ciphertext belongs to exactly one context. The context also stores the most recent error message, which yuenix_last_error(ctx) returns.
yuenix_context_options opt = {.struct_size = sizeof opt, .device = 0};yuenix_context_create(&opt, &ctx);Asynchronous calls
Section titled “Asynchronous calls”Operations enqueue GPU work on the context’s stream and return without waiting for it. Encrypt, decrypt, serialize and deserialize synchronize as needed because they produce host data. Call yuenix_synchronize(ctx) before measuring time or reading results produced by other means.
Threads
Section titled “Threads”Use one host thread per context at a time. Separate contexts may run on separate threads, or on separate GPUs.
Output handles
Section titled “Output handles”Functions that return a new object take a T** output argument.
- If
*outisNULL, the library allocates a new object. - If
*outpoints to an existing object of the right shape, the library overwrites it in place. This avoids allocations in loops.
Release every object with its _destroy function. Destroy objects before the context they belong to.
Memory
Section titled “Memory”Each context keeps a GPU memory pool. Evaluation keys for N = 2^16 bootstrapping profiles occupy several gigabytes of GPU memory, and aggregation programs over many clients use most of a 32 GB GPU. Large aggregation programs keep part of their keys in host memory and move them to the GPU as needed. Their program report shows the GPU and host memory they use.
Logging
Section titled “Logging”The library writes nothing to standard output. Register a callback with yuenix_set_log_callback to receive diagnostic messages.