-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Smesher API #145
New Smesher API #145
Conversation
# Conflicts: # proto/spacemesh/v1/smesher.proto # release/go/spacemesh/v1/smesher.pb.go # release/go/spacemesh/v1/smesher_types.pb.go
Changes:
We need to conclude the terminology dicsussion so I could finalize the documentation and how we name things. Currently, “pos”, “pos setup”, “post data creation”, “post init”, “post setup” are used interchangeably. I vote for the later. |
For now I see you call its Post and not Pos on the API level. We can use |
Q: are you updating cli-wallet to work with these changes as well? |
Can you please remove the status field from all smesher api responses? They are not needed as a grcp api response always has built-in status code and message fields. |
LGTM but it will be nice to add these notes to the doc comments of the methods in smesher.proto so the intent is clearer there for all users and this will be used as base for higher-level api docs. |
Updated here: spacemeshos/smrepl#23 (comment).
This pattern is used in other services as well, so I'd rather keep it following the general API design, and discuss it with @lrettig.
I planned to finish the docs once the design and the implementation is accepted. |
proto/spacemesh/v1/smesher.proto
Outdated
rpc IsSmeshing (google.protobuf.Empty) returns (IsSmeshingResponse); | ||
|
||
// Start smeshing. If the post data is incomplete or missing, data creation | ||
// session will be preceded. Changing of the post potions (e.g., number of labels), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"will be preceded"
What does this mean? is it a typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means that if the data is incomplete or missing, data creation session will occur and must complete before smeshing can start. Feel free to fix my english, but I plan to revise all the documentation anyway.
uint32 num_units = 2; // Number of PoST data commitment units to generate | ||
uint32 num_files = 3; // Number of files to equally distribute the labels among | ||
uint32 compute_provider_id = 4; // A PostProvider id | ||
bool throttle = 5; // Throttle down setup phase computations while user is interactive on system |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this be an int, to allow more fine-tuned throttling? E.g., max CPU percentage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's referring to the utilization of GPU cores, not CPU time. The API complies with the internal API of gpu-post
lib, so we should consider changing it there first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the release of gpu-post lib for post it is indeed a boolean and it is not going to change to an int. Let's consider this feature for next release. We need to finalize and ship and we shouldn't change features so late in the cycle.
message StopPostDataCreationSessionRequest { | ||
bool delete_files = 1; | ||
message PostComputeProvidersRequest { | ||
bool benchmark = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does benchmark mean here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request to run a short benchmarking session for each provider, so that the performance
field of PoSTSetupComputeProvider
will be assigned with the num of hashes per sec.
Documentation is still missing and will be complete soon.
We use this pattern for responses that would otherwise be empty. It's a way to explicitly specify success/failure. |
@lrettig - didn't you just comment on another issue that we should get rid of these statuses in empty responses? There you agreed this is unnecessary. In the current pattern - 2 distinct statuses are returned for these methods - the built in one (which is always returned) and the explicit one - not a great way to return results to api users. |
Yes, I agree, I think we should make this change |
aebcdb8
to
4d79a9b
Compare
The smesher api generally looks fine.
message PostParams {
uint32 bits_per_label = 1;
uint64 labels_per_unit = 2;
uint32 min_num_units = 3;
uint32 max_num_units = 4;
}
message ConfigResponse {
PostParams post_params = 1;
}
message PostInitOpts {
PostPramas post_params = 1;
uint32 compute_provider_id = 2; // A PostProvider id
bool throttle = 3; // Throttle down setup phase computations while user is interactive on system
} Also, perhaps the message PostInitOptions {
uint32 bits_per_label = 1;
uint64 labels_per_unit = 2;
uint32 min_num_units = 3;
uint32 max_num_units = 4;
uint32 compute_provider_id = 5; // A PostProvider id
bool throttle = 6; // Throttle down setup phase computations while user is interactive on system
}
message ConfigResponse {
PostInitOptions post_init_options = 1;
}
message StartSmeshingRequest {
AccountId coinbase = 1;
PostInitOptions post_init_options = 2;
}
|
The naming you specified are outdated, so plz use the latest. After some revisions, we now have 2 distinct configurations:
Considering this, your suggestion doesn’t make sense to me, so let me know if I missed something.
I'd like to do it in a follow-up PR, because it doesn't involve solely the Smesher API. |
Ok, this makes sense for both items. |
COMPUTE_API_CLASS_UNSPECIFIED = 0; | ||
COMPUTE_API_CLASS_CPU = 1; // useful for testing on systems without a cuda or vulkan GPU | ||
COMPUTE_API_CLASS_CUDA = 2; | ||
COMPUTE_API_CLASS_VULKAN = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we maybe add a COMPUTE_API_CLASS_OTHER
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what reason? These value correspond to the type of providers supported by the gpu-post lib. If/when we'll add new supported types of providers to gpu-post then we'll add them to the enum in future api releases. Don't see how other is useful here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm definitely not a fan of the PoST
capitalization, e.g., PoSTConfig
. I think PostConfig
is much easier and less error prone.
Same with me - we don't use this naming pattern anywhere in the Api and I agree that |
0631982
to
7e631f5
Compare
# Conflicts: # release/go/spacemesh/v1/types.pb.go
# Conflicts: # release/go/spacemesh/v1/types.pb.go
91afd69
to
f54df33
Compare
Fixed (7e631f5, and in the implementation as well). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As requested, dealing with empty GRPC responses will be done in another PR.
Main remarks:
IsSmeshing() -> bool
withSmeshingStatus() -> [IDLE, CREATING_POST_DATA, ACTIVE]
. Since Smeshing now triggers the PoST setup, we have an intermediate stage in which we are neither idle or Smeshing (NOTE:ACTIVE
is probably a bad name because it has nothing to do with the activation status of the miner).PostStatus()
query is no longer supported (because a status can be evaluated only in relation to aPostInitOpts
arg), besides withinPostDataCreationProgressStream
, which is supported only when a PoST data creation session is active. For this reason I changed the status message name toSessionStatus
and removed most of its fields (files_status
,init_in_progress
,error_type
,error_message
), while keeping onlynum_labels_written
(instead ofbytes_written
). We can rethink this and decide whether we want to expose errors within the stream or elsewhere, asynchronously.PostInitOpts
the user is now to select its commitment size vianum_units
instead ofdata_size
. For evaluating the size in bytes, clients are expected to queryConfig()
which specifieslabels_per_unit
andbits_per_label
.PostComputeProviders()
now havebool benchmark
, to avoid imposing the benchmark procedure delay by default (for example when a client wants to enumerate the providers for ID validation purposes).