pypapi icon indicating copy to clipboard operation
pypapi copied to clipboard

PAPI miscellaneous error during initialization: Unknown error code. (PAPI_EMISC)

Open adnaneGdihi opened this issue 1 year ago • 3 comments

Hello,

I installed pypapi on a cluster and I am encountering an unknown error code. I used papi low to do the reading. the events I used (including the commented ones) are available and can be read in the system. the code breaks in the initialization block, but I can't pin point the reason

Linux 5.14.0-362.24.1.el9_3.0.1.x86_64 x86_64
PAPI Version: 7.1.0.0
Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         46 bits physical, 57 bits virtual
  Byte Order:            Little Endian
CPU(s):                  96
  On-line CPU(s) list:   0-95
Vendor ID:               GenuineIntel
  Model name:            Intel(R) Xeon(R) Platinum 8468
    CPU family:          6
    Model:               143
    Thread(s) per core:  1
    Core(s) per socket:  48
    Socket(s):           2
    Stepping:            8
    CPU max MHz:         3800.0000
    CPU min MHz:         800.0000
    BogoMIPS:            4200.00
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from torch.utils.data import TensorDataset, DataLoader
#from pytorch_msssim import ssim, ms_ssim, SSIM, MS_SSIM
import intel_extension_for_pytorch as ipex

from tqdm import tqdm
import numpy as np
import argparse
import cv2
from matplotlib import pyplot as plt
import os
import sys

import Utils
from Network import *
from Utils_model import *
from gan_loss import *
from pypapi import papi_low as papi
import time
from pypapi import events
from pypapi.exceptions import PapiInvalidValueError, PapiMiscellaneousError

try:
    papi.library_init()
    events_set = papi.create_eventset()
    event_names = [events.PAPI_BR_CN, events.PAPI_BR_INS, events.PAPI_BR_MSP, events.PAPI_BR_NTK, events.PAPI_BR_PRC, 
        # events.PAPI_BR_TKN, events.PAPI_BR_UCN, events.PAPI_CA_SHR, events.PAPI_DP_OPS, events.PAPI_FP_INS, 
        # events.PAPI_FP_OPS, events.PAPI_L1_ICM, events.PAPI_L1_TCM, events.PAPI_L2_DCA, 
        # events.PAPI_L2_ICA, events.PAPI_L2_ICH, events.PAPI_L2_ICM, 
        # events.PAPI_L2_ICR, events.PAPI_L3_ICA, events.PAPI_L3_ICR, events.PAPI_L3_LDM, 
        # events.PAPI_LD_INS, events.PAPI_LST_INS, events.PAPI_REF_CYC, 
        # events.PAPI_SP_OPS, events.PAPI_SR_INS, events.PAPI_TOT_CYC, events.PAPI_TOT_INS, events.PAPI_VEC_DP, 
        # events.PAPI_VEC_INS, events.PAPI_VEC_SP
    ]
    papi.add_events(events_set, list(event_names))
except PapiInvalidValueError as e:
    print("PAPI initialization error:", e)
    sys.exit(1)
except PapiMiscellaneousError as e:
    print("PAPI miscellaneous error during initialization:", e)
    sys.exit(1)
except Exception as e:
    print("Unexpected error during PAPI initialization:", e)
    sys.exit(1)

# some code
try:
    papi.start(events_set)
    # some code
    papi.stop(events_set)
    print(papi.read(events_set))
except PapiInvalidValueError as e:
    print("PAPI error:", e)
except PapiMiscellaneousError as e:
    print("PAPI miscellaneous error:", e)
except Exception as e:
    print("Unexpected error during PAPI operation:", e)
finally:
    papi.remove_events(events_set)
    papi.cleanup()

adnaneGdihi avatar Oct 03 '24 03:10 adnaneGdihi

Hello,

If the error is during PAPI initialization, maybe you should ask for help on PAPI repository: https://github.com/icl-utk-edu/papi

PyPAPI is only a Python wrapper to PAPI, if the error is not caused by the Python binding itself I will not be able to help (I am only maintaining the Python part, I do not know how PAPI work). :)

flozz avatar Oct 03 '24 13:10 flozz

I am trying to pin point the source. it is not the init that is raising the exception but rather add event or add events

adnaneGdihi avatar Oct 03 '24 18:10 adnaneGdihi

Ok, let me know if your investigations finds out a problem with the Python binding itself so I can fix it :)

flozz avatar Oct 04 '24 09:10 flozz