Beispiel #1
0
    def __call__(self, A, B):
        """C = A * B"""
        from ctypes import c_double, byref

        C = np.zeros(shape=A.shape, dtype=A.dtype)
        duration = c_double()
        meter = WattsUpReader()
        meter.start_recording()
        self.c_dgemm(C, A, B, byref(duration))
        joules = meter.get_recording()[0].joules
        seconds = duration.value
        self.c_dgemm.report(time=seconds, energy=joules)
        return C, seconds, joules, self.c_dgemm._current_config
Beispiel #2
0
    def __call__(self, A, B):
        """C = A * B"""
        from ctypes import c_double, byref

        C = np.zeros(shape=A.shape, dtype=A.dtype)
        duration = c_double()
        meter = WattsUpReader()
        meter.start_recording()
        self.c_dgemm(C, A, B, byref(duration))
        joules = meter.get_recording()[0].joules
        seconds = duration.value
        self.c_dgemm.report(time=seconds, energy=joules)
        return C, seconds, joules, self.c_dgemm._current_config
Beispiel #3
0
class Meter(object):
    def __init__(self, use_energy=False):
        self.time_meter = c_double()
        self.use_energy = use_energy
        self.energy_meter = WattsUpReader() if self.use_energy else None

    def start_recording(self):
        if self.use_energy:
            self.energy_meter.start_recording()

    def time_value(self):
        return self.time_meter.value

    def energy_value(self):
        if self.use_energy:
            return self.energy_meter.get_recording()[0].joules
        else:
            return 0.0
Beispiel #4
0
class Meter(object):
    def __init__(self, use_energy=False):
        self.time_meter = c_double()
        self.use_energy = use_energy
        self.energy_meter = WattsUpReader() if self.use_energy else None

    def start_recording(self):
        if self.use_energy:
            self.energy_meter.start_recording()

    def time_value(self):
        return self.time_meter.value

    def energy_value(self):
        if self.use_energy:
            return self.energy_meter.get_recording()[0].joules
        else:
            return 0.0