Skip to content
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

Extract command line parser into separate file #5443

Merged
merged 4 commits into from
Mar 8, 2023
Merged

Extract command line parser into separate file #5443

merged 4 commits into from
Mar 8, 2023

Conversation

GuanLuo
Copy link
Contributor

@GuanLuo GuanLuo commented Mar 2, 2023

No description provided.

@GuanLuo GuanLuo changed the title Gluo parser Extract command line parser into separate file Mar 2, 2023
}

// Template specialization for ParsePairOption
// [FIXME] replace ParseXXXOPtion with these
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels a bit messy to read through. Could you separate the ParseXXXOption functions away from the template functions section and have a header comment for each (e.g. explaining how/when they are used, since both are being compiled into the code).

return std::stod(arg);
}

// Condition here merely to avoid compilation error, this function will
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain this further? What is the compilation error and why do we need this? If we need to keep this, ideally we need the logic included in the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is mentioned in the second half of the comment, not the exact compilation error code though

Comment on lines 87 to 93
#if 0
float
ParseFloatOption(const std::string arg)
{
return std::stof(arg);
}
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this dead code?

return std::stod(arg);
}

// Condition here merely to avoid compilation error, this function will
Copy link
Collaborator

@rmccorm4 rmccorm4 Mar 2, 2023

Choose a reason for hiding this comment

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

Optional if you agree, but I believe this file could be a good candidate for starting to break out some ifdefs into constexpr bools like rapids_triton does. Then all ifdefs in this source can be replaced with if (logging_enabled) { } etc., and it shouldn't complain about unused functions/variables even when these are disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is going to be a different approach to address the problem, more on runtime check (and compiler optimization) rather than compile time selection. I am not going to do this in this PR and it will need a discussion before we agree to move towards this way.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good.

Comment on lines +262 to +215
// [FIXME] who should call this function?
void CheckPortCollision();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this comment still valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will probably be a helper function in main.cc, once the parser is broken down, the collision checking will be done after all endpoint parsing is done so can't be part of any option struct

rmccorm4
rmccorm4 previously approved these changes Mar 7, 2023
Copy link
Collaborator

@rmccorm4 rmccorm4 left a comment

Choose a reason for hiding this comment

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

LGTM, just one question above

@GuanLuo GuanLuo merged commit a5d269d into main Mar 8, 2023
@GuanLuo GuanLuo deleted the gluo-parser branch March 20, 2023 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants