Skip to content

Conversation

@dstrain115
Copy link
Collaborator

  • Adds BatchedProgram, BatchedRunContext, and BatchedResult
  • Each is a repeated message so that circuits can be bundled
    together as one request for increased efficiency.

- Adds BatchedProgram, BatchedRunContext, and BatchedResult
- Each is a repeated message so that circuits can be bundled
together as one request for increased efficiency.
@googlebot googlebot added the cla: yes Makes googlebot stop complaining. label Jun 3, 2020
Copy link
Collaborator

@dabacon dabacon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor coment.


// The results of a BatchedProgram
// Each result in the message will directly correspond to a Program
// in the BatchedProgram request. There will be one Result for each
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be slightly reworded, since there is a result per Program/RunContext pair. I think it is important in the protos to convey the state of the resources, users may thinking about this as "run a program", but we should make it clear in the api that just creating a batched program does not ended up with results.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded. Take another look and let me know if it is more clear. I wasn't sure if I understood your concerns correctly.

}

// A Batch of multiple circuits that should be run as one program
message BatchedProgram {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: call this BatchProgram instead? Similarly for BatchRunContext and BatchResult.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// A Batch of multiple circuits that should be run as one program
message BatchedProgram {

// The circuits that should be bundled togather as one program
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "together"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}
}

// A Batch of multiple circuits that should be run as one program
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to clarify here that "as one program" is at the level of the quantum engine api. These will not necessarily be executed all at once on the hardware.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

repeated SweepResult sweep_results = 1;
}

// The result returned by a BatchedProgram
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: (related to @dabacon's comment below)
"The result returned from running a BatchProgram/BatchRunContext"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


// A batch of contexts for running a bundled batch of programs
// To be used in conjunction with BatchedProgram
message BatchedRunContext {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might consider moving all these into a new batch.proto file, so they are closer together and the relationship between them should be easier to see:

# batch.proto

message BatchProgram { ... }
message BatchRunContext { ... }
message BatchResult { ... }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

@maffoo maffoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

(not sure why there's a diff in old generated proto files)

message BatchRunContext {

// Run contexts for each program in the BatchProgram
// Each RunContext should map directly to a Program in the corresponding
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe add lines between paragraphs as you've done for BatchResult:

// Run contexts for ...
//
// Each RunContext should map ...

// A Batch of multiple circuits that should be run together
// as one QuantumProgram within Quantum Engine.
// (Note that circuits may not necessarily be executed
// simultaneously on hardware based on circumstances)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "executed as a batch" instead of "executed simultaneously"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the wording you proposed adds more confusion. I rephrased again.

// Results returned from executing a BatchProgram/BatchRunContext pair.
//
// After a BatchProgram and BatchRunContext is successfully run in
// Quantum Engine, the expected result if successful will be a BatchResult.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must success be for every program/context combo, or can this include partial results?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect we would not initially support partial result, but put in a paragraph on how it would be supported in the future.

// Each RunContext should map directly to a Program in the corresponding
// BatchProgram.
//
// This message should have one RunContext for each Program in the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"should" should be "must" when describing the relationship between run contexts and programs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@dstrain115 dstrain115 merged commit d998b3a into quantumlib:master Jun 4, 2020
tonybruguier pushed a commit to tonybruguier/Cirq that referenced this pull request Aug 23, 2020
- Add Batched requests to Google's cirq messages
- This adds a new batch.proto which contains BatchedProgram, BatchedRunContext, and BatchedResult
- Each is a repeated message so that circuits can be bundled together as one request for increased efficiency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Makes googlebot stop complaining.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants