-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Summary
The cudaq::qec::generate_random_pcm() function fails with error "xbuffer_storage not resizable" when attempting to create Parity Check Matrices (PCMs) with more than ~50,000 error mechanisms. This appears to be a limitation in the underlying xtensor library used by cudaqx::tensor.
Environment
- Component:
cudaqx::tensor(xtensor implementation) - Affected Functions:
cudaq::qec::generate_random_pcm()inlibs/qec/lib/pcm_utils.cpp - Error:
std::runtime_error: xbuffer_storage not resizable - nvq++ Version: (https://github.com/NVIDIA/cuda-quantum d7f1551f6c9544b6123a4daf11c391fade6ea590)
Reproduction
Test Code
#include "cudaq/qec/pcm_utils.h"
#include <iostream>
#include <random>
int main() {
std::cout << "Testing PCM generation for different sizes...\n\n";
std::vector<size_t> test_sizes = {1000, 10000, 50000, 100000};
for (size_t num_mechs : test_sizes) {
std::cout << "Attempting " << num_mechs << " mechanisms... " << std::flush;
try {
size_t n_rounds = std::max(size_t(1), num_mechs / 100);
size_t n_errs_per_round = num_mechs / n_rounds;
size_t n_syndromes_per_round = std::max(size_t(1), n_errs_per_round / 2);
int weight = 3;
std::mt19937_64 rng(42);
auto pcm = cudaq::qec::generate_random_pcm(
n_rounds, n_errs_per_round, n_syndromes_per_round, weight, std::move(rng));
std::cout << " Success! Shape: " << pcm.shape()[0] << "×" << pcm.shape()[1]
<< " (rows×cols)\n";
} catch (const std::exception& e) {
std::cout << " Failed! Error: " << e.what() << "\n";
}
}
return 0;
}Execution Results
$ ./test-pcm-allocation
Testing PCM generation for different sizes...
Attempting 1000 mechanisms... Success! Shape: 500×1000 (rows×cols)
Attempting 10000 mechanisms... Success! Shape: 5000×10000 (rows×cols)
Attempting 50000 mechanisms... Success! Shape: 25000×50000 (rows×cols)
Attempting 100000 mechanisms... Failed! Error: xbuffer_storage not resizableReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels