ROCm / rocprofiler-compute

Advanced Profiling and Analytics for AMD Hardware
https://rocm.docs.amd.com/projects/omniperf/en/latest/
MIT License
135 stars 49 forks source link

Issue with Python 3.11 #131

Closed vchuravy closed 1 year ago

vchuravy commented 1 year ago

After make install/local:

/opt/apps/omniperf/bin/omniperf 
Traceback (most recent call last):
  File "/opt/apps/omniperf/bin/omniperf", line 44, in <module>
    from omniperf_analyze.omniperf_analyze import roofline_only  # Standalone roofline
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/apps/omniperf/bin/omniperf_analyze/omniperf_analyze.py", line 45, in <module>
    from omniperf_analyze.utils import parser, file_io
  File "/opt/apps/omniperf/bin/omniperf_analyze/utils/parser.py", line 33, in <module>
    from omniperf_analyze.utils import schema
  File "/opt/apps/omniperf/bin/omniperf_analyze/utils/schema.py", line 56, in <module>
    @dataclass
     ^^^^^^^^^
  File "/usr/lib/python3.11/dataclasses.py", line 1223, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/usr/lib/python3.11/dataclasses.py", line 1213, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'pandas.core.frame.DataFrame'> for field sys_info is not allowed: use default_factory

On f8fe039aa57422bb5036d647699f1f97298bed5d

coleramos425 commented 1 year ago

I was able to reproduce this issue.

This is probably due to one of the following changes in the dataclasses standard library in version 3.11:

Lines 58-60 will likely need a __hash__ method https://github.com/AMDResearch/omniperf/blob/f8fe039aa57422bb5036d647699f1f97298bed5d/src/omniperf_analyze/utils/schema.py#L56-L66

coleramos425 commented 1 year ago

Instead I'm changing default values for sys_info, soc_spec, and raw_pmc attributes to None in Workload class

Tested this on Ubuntu 20.04, Python 3.11.3 and it fixed the issue. @vchuravy this change will be included in the next release