def getTimeHadamardSize(nbRepetition, nbElement): tabX = allocInitTable(nbElement) timeBegin = astericshpc.rdtsc() for i in range(0, nbRepetition): res = reductionpython.reduction(tabX) timeEnd = astericshpc.rdtsc() elapsedTime = float(timeEnd - timeBegin) / float(nbRepetition) elapsedTimePerElement = elapsedTime / float(nbElement) print("nbElement =", nbElement, ", elapsedTimePerElement =", elapsedTimePerElement, "cy/el", ", elapsedTime =", elapsedTime, "cy") print(str(nbElement) + "\t" + str(elapsedTimePerElement) + "\t" + str(elapsedTime), file=sys.stderr)
def getTimeFunctionSize(nbRepetition, nbElement): tabX = np.asarray(np.random.random(nbElement), dtype=np.float32) tabY = np.asarray(np.random.random(nbElement), dtype=np.float32) tabRes = np.zeros(nbElement, dtype=np.float32) scal = 42.0 timeBegin = astericshpc.rdtsc() for i in range(0, nbRepetition): for j in range(0, nbElement): tabRes[j] = scal*tabX[j] + tabY[j] timeEnd = astericshpc.rdtsc() elapsedTime = float(timeEnd - timeBegin)/float(nbRepetition) elapsedTimePerElement = elapsedTime/float(nbElement) print("nbElement =",nbElement,", elapsedTimePerElement =",elapsedTimePerElement,"cy/el",", elapsedTime =",elapsedTime,"cy") print(str(nbElement) + "\t" + str(elapsedTimePerElement) + "\t" + str(elapsedTime),file=sys.stderr)
def getTimeFunctionSize(nbRepetition, nbElement): tabX = np.asarray(np.random.random(nbElement), dtype=np.float32) timeBegin = astericshpc.rdtsc() for i in range(0, nbRepetition): res = tabX.sum() timeEnd = astericshpc.rdtsc() elapsedTime = float(timeEnd - timeBegin) / float(nbRepetition) elapsedTimePerElement = elapsedTime / float(nbElement) print("nbElement =", nbElement, ", elapsedTimePerElement =", elapsedTimePerElement, "cy/el", ", elapsedTime =", elapsedTime, "cy") print(str(nbElement) + "\t" + str(elapsedTimePerElement) + "\t" + str(elapsedTime), file=sys.stderr)
def getTimeFunctionSize(nbRepetition, nbElement): tabX = allocInitTable(nbElement) tabY = allocInitTable(nbElement) tabRes = astericshpc.allocTable(nbElement) scal = 42.0 timeBegin = astericshpc.rdtsc() for i in range(0, nbRepetition): saxpypython.saxpy(tabRes, scal, tabX, tabY) timeEnd = astericshpc.rdtsc() elapsedTime = float(timeEnd - timeBegin) / float(nbRepetition) elapsedTimePerElement = elapsedTime / float(nbElement) print("nbElement =", nbElement, ", elapsedTimePerElement =", elapsedTimePerElement, "cy/el", ", elapsedTime =", elapsedTime, "cy") print(str(nbElement) + "\t" + str(elapsedTimePerElement) + "\t" + str(elapsedTime), file=sys.stderr)
def getTimeFunctionSize(nbRepetition, nbElement): tabX = allocInitTable(nbElement) tabY = allocInitTable(nbElement) tabA = allocInitTable(nbElement) timeBegin = astericshpc.rdtsc() for i in range(0, nbRepetition): g = barycentrepython.barycentre(tabX, tabY, tabA) timeEnd = astericshpc.rdtsc() elapsedTime = float(timeEnd - timeBegin) / float(nbRepetition) elapsedTimePerElement = elapsedTime / float(nbElement) print("nbElement =", nbElement, ", elapsedTimePerElement =", elapsedTimePerElement, "cy/el", ", elapsedTime =", elapsedTime, "cy") print(str(nbElement) + "\t" + str(elapsedTimePerElement) + "\t" + str(elapsedTime), file=sys.stderr)
def getTimeFunctionSize(nbRepetition, nbElement): matX = np.asarray(np.random.random((nbElement, nbElement)), dtype=np.float32) matY = np.asarray(np.random.random((nbElement, nbElement)), dtype=np.float32) matRes = np.zeros((nbElement, nbElement), dtype=np.float32) timeBegin = astericshpc.rdtsc() for i in range(0, nbRepetition): np.matmul(matX, matY, matRes) timeEnd = astericshpc.rdtsc() elapsedTime = float(timeEnd - timeBegin) / float(nbRepetition) elapsedTimePerElement = elapsedTime / float(nbElement * nbElement) print("nbElement =", nbElement, ", elapsedTimePerElement =", elapsedTimePerElement, "cy/el", ", elapsedTime =", elapsedTime, "cy") print(str(nbElement) + "\t" + str(elapsedTimePerElement) + "\t" + str(elapsedTime), file=sys.stderr)
def getTimeFunctionSize(nbRepetition, nbElement): tabX = np.asarray(np.random.random(nbElement), dtype=np.float32) tabY = np.asarray(np.random.random(nbElement), dtype=np.float32) tabRes = np.zeros(nbElement, dtype=np.float32) listX = [] listY = [] listRes = [] for i in range(0,nbElement): listX.append(tabX[i]) listY.append(tabY[i]) listRes.append(tabRes[i]); timeBegin = astericshpc.rdtsc() for i in range(0, nbRepetition): for j in range(0, nbElement): listRes[j] = listX[j]*listY[j] timeEnd = astericshpc.rdtsc() elapsedTime = float(timeEnd - timeBegin)/float(nbRepetition) elapsedTimePerElement = elapsedTime/float(nbElement) print("nbElement =",nbElement,", elapsedTimePerElement =",elapsedTimePerElement,"cy/el",", elapsedTime =",elapsedTime,"cy") print(str(nbElement) + "\t" + str(elapsedTimePerElement) + "\t" + str(elapsedTime),file=sys.stderr)