In [1]:
import warnings
import pandas as pd
import numpy as np
import os
import sys # error msg
import operator # sorting
from math import *
from read_trace import *
from avgblkmodel import *
warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning)
In [2]:
gtx950 = DeviceInfo()
gtx950.sm_num = 6
gtx950.sharedmem_per_sm = 49152
gtx950.reg_per_sm = 65536
gtx950.maxthreads_per_sm = 2048
In [3]:
data_size = 23000
trace_file = './1cke/trace_' + str(data_size) + '.csv'
df_trace = trace2dataframe(trace_file) # read the trace to the dataframe
In [4]:
df_trace
Out[4]:
In [5]:
df_single_stream = model_param_from_trace_v1(df_trace)
df_single_stream.head(20)
Out[5]:
In [6]:
df_s1 = reset_starting(df_single_stream)
In [7]:
df_s1
Out[7]:
In [8]:
stream_num = 2
df_cke_list = []
for x in range(stream_num):
df_cke_list.append(df_s1.copy(deep=True))
In [9]:
df_cke_list[0]
Out[9]:
In [10]:
df_cke_list[1]
Out[10]:
In [11]:
H2D_H2D_OVLP_TH = 3.158431
for i in range(1,stream_num):
# compute the time for the init data transfer
stream_startTime = find_whentostart_comingStream(df_cke_list[i-1], H2D_H2D_OVLP_TH)
print('stream_startTime : {}'.format(stream_startTime))
df_cke_list[i].start += stream_startTime
df_cke_list[i].end += stream_startTime
In [12]:
df_cke_list[0]
Out[12]:
In [13]:
df_cke_list[1]
Out[13]:
In [14]:
prev_stm_h2ds_start, prev_stm_h2ds_end = find_h2ds_timing(df_cke_list[0])
print("prev stream h2ds : {} - {}".format(prev_stm_h2ds_start, prev_stm_h2ds_end))
curr_stm_h2ds_start, curr_stm_h2ds_end = find_h2ds_timing(df_cke_list[1])
print("curr stream h2ds : {} - {}".format(curr_stm_h2ds_start, curr_stm_h2ds_end))
In [15]:
if curr_stm_h2ds_start >=prev_stm_h2ds_start and curr_stm_h2ds_start < prev_stm_h2ds_end:
h2ds_ovlp_between_stream = True
else:
h2ds_ovlp_between_stream = False
print("h2ds_ovlp_between_stream : {}".format(h2ds_ovlp_between_stream))
In [16]:
prev_stm_kern_start, prev_stm_kern_end = find_kern_timing(df_cke_list[0])
print("prev stream kern : {} - {}".format(prev_stm_kern_start, prev_stm_kern_end))
curr_stm_kern_start, curr_stm_kern_end = find_kern_timing(df_cke_list[1])
print("curr stream kern : {} - {}".format(curr_stm_kern_start, curr_stm_kern_end))
In [17]:
if prev_stm_kern_start <= curr_stm_kern_start < prev_stm_kern_end:
kern_ovlp_between_stream = True
else:
kern_ovlp_between_stream = False
print("kern_ovlp_between_stream : {}".format(kern_ovlp_between_stream))
In [18]:
# get the overlapping kernel info from both stream
kernel_ = model_cke_from_same_kernel(gtx950, df_trace, )