-2
$\begingroup$

If I want to build Stim from source so I can use the debugger to step through and better understand the C++ code, is there a recommended setup?

Is there a way to compile/debug only the C++ portion of the code? If not, what do os/ide/tools do you use for development?

I definitely understand you can't help debug every possible configuration of various tools/compilers. I wanted to ask just in case there was some obvious setup I could emulate.

//TL;DR Background Info.

I'm on VS Code on MacOs (M2 chip) and pretty new to C++. I want to run this code because there's some sections of Stim that I wish to understand better how they work. I ended up trying to follow Nadiah's tutorial where two debuggers are run in VS Code simultaneously. First the Python debugger runs, then the Cpp debugger is attached to it. I had trouble getting it running locally (a number of small things compounded to make cpp/VScode/python/M2 chip a tricky build/debug process) so I've been trying to get Docker/Linux /VScode working but again there's some M2 chip trickiness. So if there is some tried and true set of tools that (generally) play nicely together, I would appreciate being directed to them.

$\endgroup$

1 Answer 1

1
$\begingroup$

You'll probably get better help with a software tooling issue like this in a programming forum rather than a quantum computing forum.

Personally, I would recommend not involving python at all if you can. If you only involve C++ it will be much simpler. Stim can be built as a standalone command line C++ tool, so I would start there. Check that you can build the command line tool, and then try debugging that.

If the command line tool happens to already do what you want to understand, then you can just debug it doing that. If the command line tool doesn't do what you want, e.g. you want to step through how stim implements stim.Circuit.count_determined_measurements, then you can look in the *.pybind.cc files to see how the python calls you want to do are turned into things happening in C++. Then modify the main method to call those things, and start debugging. Alternatively, look for C++ unit tests of the method and debug the unit tests running.

$\endgroup$
1
  • $\begingroup$ Thank you so much! $\endgroup$
    – user27946
    Feb 3 at 21:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.