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

Remove extras flow #1067

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions hls4ml/backends/catapult/catapult_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,8 @@ def _register_flows(self):
]

if len(extras) > 0:
extras_flow = register_flow('extras', extras, requires=[init_flow], backend=self.name)
else:
extras_flow = None
for opt in extras:
print(f'WARNING: Optimizer "{opt}" is not part of any flow and will not be executed.')
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it better to print a warning or to do warnings.warn()? I am fine either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a nice description about warnings vs logging in python documentation:

warnings.warn() in library code if the issue is avoidable and the client application should be modified to eliminate the warning

A logger’s warning() method if there is nothing the client application can do about the situation, but the event should still be noted

By this logic we should use warnings.warn() instead of our way of "logging" with print(). I'll update the PR.

On a related note, I was thinking that after we merge large PRs for 1.0 we do a simple pass and change all print() statements to logging.info() or logging.warn() and eventually use logging.debug() throughout the code to help with development/debugging. It was never a good time to do this as it affected large unmerged codebases, but it seems after 1.0 things will finally sufficiently quiet down for this to be done.


ip_flow_requirements = [
'optimize',
Expand All @@ -164,10 +163,8 @@ def _register_flows(self):
quantization_flow,
optimization_flow,
catapult_types_flow,
extras_flow,
template_flow,
]
ip_flow_requirements = list(filter(None, ip_flow_requirements))

self._default_flow = register_flow('ip', None, requires=ip_flow_requirements, backend=self.name)

Expand Down
7 changes: 2 additions & 5 deletions hls4ml/backends/quartus/quartus_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ def _register_flows(self):
]

if len(extras) > 0:
extras_flow = register_flow('extras', extras, requires=[init_flow], backend=self.name)
else:
extras_flow = None
for opt in extras:
print(f'WARNING: Optimizer "{opt}" is not part of any flow and will not be executed.')

ip_flow_requirements = [
'optimize',
Expand All @@ -114,10 +113,8 @@ def _register_flows(self):
quantization_flow,
optimization_flow,
quartus_types_flow,
extras_flow,
template_flow,
]
ip_flow_requirements = list(filter(None, ip_flow_requirements))

self._default_flow = register_flow('ip', None, requires=ip_flow_requirements, backend=self.name)

Expand Down
7 changes: 2 additions & 5 deletions hls4ml/backends/vivado/vivado_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,8 @@ def _register_flows(self):
]

if len(extras) > 0:
extras_flow = register_flow('extras', extras, requires=[init_flow], backend=self.name)
else:
extras_flow = None
for opt in extras:
print(f'WARNING: Optimizer "{opt}" is not part of any flow and will not be executed.')

ip_flow_requirements = [
'optimize',
Expand All @@ -158,10 +157,8 @@ def _register_flows(self):
quantization_flow,
optimization_flow,
vivado_types_flow,
extras_flow,
template_flow,
]
ip_flow_requirements = list(filter(None, ip_flow_requirements))

self._default_flow = register_flow('ip', None, requires=ip_flow_requirements, backend=self.name)

Expand Down
Loading