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

OpenTuner: Clarification on Required Command-Line Arguments #166

Open
chimengqiaoyu opened this issue May 13, 2024 · 2 comments
Open

OpenTuner: Clarification on Required Command-Line Arguments #166

chimengqiaoyu opened this issue May 13, 2024 · 2 comments

Comments

@chimengqiaoyu
Copy link

Hello,

I am currently using OpenTuner to optimize some configurations and encountered an issue related to command-line arguments. I'm trying to ensure that I have set up all the necessary command-line parameters that OpenTuner's main method requires, but I faced a TypeError related to missing command-line arguments, specifically parallel_compile.

While attempting to run my tuning script, I encountered the following error:

Traceback (most recent call last):
File "tune.py", line 37, in
MpiTuner.main(args)
File "/path/to/opentuner/measurement/interface.py", line 300, in main
return TuningRunMain(cls(args, *pargs, **kwargs), args).main()
File "/path/to/opentuner/measurement/interface.py", line 63, in init
self.parallel_compile = args.parallel_compile
AttributeError: 'Namespace' object has no attribute 'parallel_compile'


This suggests that the `parallel_compile` argument is expected but was not provided.

#### Specific Questions
1. Could you please clarify which command-line arguments are mandatory for OpenTuner’s operation?
2. Is there a list or documentation available that details all required and optional command-line parameters for OpenTuner?
3. Additionally, is there a recommended approach for handling default values for these parameters to avoid such errors?

I attempted to define basic command-line parsing in my script to include this argument, but I am unsure if there are other parameters I might be missing and would appreciate guidance or a reference to the relevant part of the documentation.

Thank you for your help!

---
@jansel
Copy link
Owner

jansel commented May 13, 2024

When you create your ArgumentParser, you should do

argparse.ArgumentParser(parents=opentuner.argparsers())

parents=opentuner.argparsers() will add all the needed OpenTuner args, including default values.

If you don't want the opentuner args on your own program's command line, you can create a separate ArgumentParser instance for opentuner and use the args=[...] option to parse_args.

For more see https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.parse_args

@chimengqiaoyu
Copy link
Author

I have resolved it, thank you very much!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants