Quantum icon indicating copy to clipboard operation
Quantum copied to clipboard

Add Python host programs to chemistry samples.

Open cgranade opened this issue 6 years ago • 15 comments

Currently, most samples only have a C# host program. It would be nice if more or even most samples demonstrated how to use Python to call into Q#.

Samples with Python Hosts

  • algorithms
    • [x] chsh-game
    • [x] database-search
    • [x] integer-factorization
    • [x] oracle-synthesis
    • [x] order-finding
    • [x] reversible-logic-synthesis
    • [x] simple-grover
  • arithmetic
    • adder-example (n/a: no host program for this sample)
  • characterization
    • [x] phase-estimation
  • chemistry
    • [x] AnalyzeHamiltonian
    • [ ] CreateHubbardHamiltonian
    • [ ] GetGateCount
    • [ ] IntegralData (n/a: static sample data)
    • [ ] LithiumHydrideGUI (n/a: demonstrates C# ↔ Electron interaction)
    • [ ] MolecularHydrogen
    • [ ] MolecularHydrogenGUI (n/a: demonstrates C# ↔ Electron interaction)
    • [x] PythonIntegration
    • [ ] RunSimulation
    • [ ] SimulateHubbardHamiltonian
  • diagnostics
    • [ ] unit-testing (n/a: demonstrates xunit integration)
  • error-correction
    • [x] bit-flip-code
  • getting-started
    • [ ] intro-to-iqsharp (n/a: specific to IQ#)
    • [x] measurement
    • [x] simple-algorithms
    • [x] teleportation
  • interoperability
    • [ ] fsharp (n/a)
    • [x] python
  • numerics
  • [x] CustomModAdd
  • [x] EvaluatingFunctions
  • [x] ResourceCounting
  • runtime
    • [ ] oracle-emulation (n/a: specific to extending runtime with C#)
    • [ ] state-visualizer (n/a: demonstrates using Q# with ASP.NET Core)
  • simulation
    • h2
      • [x] command-line
      • [ ] gui (n/a: demonstrates C# ↔ Electron interaction)
    • [x] hubbard

cgranade avatar Oct 03 '19 12:10 cgranade

We are working on a samples re-organization, it would be best for those interesting in helping with this issue to work on it after #235 has been merged.

bromeg avatar Oct 10 '19 17:10 bromeg

As per @bromeg's comment above, I think we're in a better place to add host programs now that #235 is in. ♥

cgranade avatar Oct 11 '19 17:10 cgranade

Hello, are you still looking for help with this issue? Also this is my first time contributing to Open Source but this seems like a simple issue.

deadmau6 avatar Oct 11 '19 20:10 deadmau6

@deadmau6: Thanks for your patience, we'd definitely appreciate help with this one! We recently added several Python host programs to the samples in the getting-started folder, but there's a number of samples that still only have C# host programs. A good place to start might be with the bit-flip-code sample, as adding a Python host to that would require fairly minimal changes. Please let me know if there's anything I can do to help, in the meantime we really appreciate the contribution! 💕

cgranade avatar Oct 15 '19 16:10 cgranade

Update: Just giving a quick update here, so I finished the bit-flip-code and almost all of the samples in algorithms/. I did have an issue with order-finding in which the solution is maybe not the best and I can go into more detail either here or in a PR. Anyways I should be able to get a lot more done over the weekend because I don't have to work.

Questions: I do have a quick question, should I submit all of the samples in one PR? Also is there some sort of issues and sub-issues list in github?

I'm just thinking it would be easier to provide updates if there was a task list I could check off like algorithms -> done. Thanks!

deadmau6 avatar Oct 18 '19 15:10 deadmau6

Thanks, @deadmau6! For order-finding, if it would be helpful I'm happy to take a look in a PR and offer what suggestions I can. As for PR style, I don't think there's a huge advantage either way for having one big PR or several small ones in this case; whatever works best for you.

Thanks for the suggestion of a sub-issues list, probably the easiest way to do that is for me to edit the original issue with - [ ] lists, as GitHub then renders that as a kind of sub-issue. I'll go on and do that now, then. Thanks!

cgranade avatar Oct 18 '19 16:10 cgranade

@cgranade, quick update, sorry it has taken me so long. I am nearly complete with all of the samples, but I hit a wall with most of the chemistry samples. I feel like I am missing something like a library, but I have everything done except for GetGateCount, CreateHubbardHamiltonian, SimulateHubbardHamiltonian, RunSimultation, and MolecularHydrogen. Anyways can I submit a PR for what I have and then could you maybe help me out with the chemistry stuff?

deadmau6 avatar Oct 27 '19 17:10 deadmau6

My apologies for the delay, @deadmau6, just getting spun back up after a vacation. In any case, the chemistry host programs are definitely the hardest to adapt, as there's a lot of pre- and post-processing that happens in the classical hosts to load problem descriptions. Especially given planned simplifications such as #203, I agree with making a PR for the other host programs for now, that sounds like a great idea. Thank you again for all your help!

cgranade avatar Oct 31 '19 16:10 cgranade

Awesome! And no worries I actually made some progress since I last spoke, not enough to add to this PR but if there is a better place I'd love to share what I got. Anyways I'll submit the PR once I get home tonight.

deadmau6 avatar Oct 31 '19 21:10 deadmau6

Thanks again for your contribution, @deadmau6! I think that brings us down to just missing Python hosts for the chemistry samples, so I'll go on and update the title/description accordingly.

cgranade avatar Dec 09 '19 19:12 cgranade

It was great to talk to you today, @sdf94! I've updated the checklist above, as it looks like only AnalyzeHamiltonian was incorrectly listed as not having a Python host. Thanks for volunteering to take a look at this enhancement, we really appreciate it! 💕

cgranade avatar Apr 02 '20 20:04 cgranade

@cgranade, is SimulateHubbardHamiltonian still open for contributions?

superkirill avatar Aug 07 '20 23:08 superkirill

@cgranade Would it be possible to contribute?

ShaunJW360 avatar Aug 08 '20 12:08 ShaunJW360

@cgranade, is SimulateHubbardHamiltonian still open for contributions?

Yep! If you're interested in contributing, the relevant folder is at https://github.com/microsoft/Quantum/tree/master/samples/chemistry/SimulateHubbardHamiltonian. That sample currently only has a C# host, but it should be adaptable to a Python host since it doesn't rely on project references. Thanks for the help, @superkirill!

@cgranade Would it be possible to contribute?

Absolutely, thank you for the help @ShaunJW360! Please let me know if there's anything I can do to help with contributions; in the meantime, the contribution guide may be of interest. Thanks!

cgranade avatar Aug 10 '20 19:08 cgranade

Yes, I want to take a look at this then. Thanks, @cgranade!

superkirill avatar Aug 11 '20 23:08 superkirill