default=[100, 128, 12800, 25, 100, 2500, 5, 25, 125]) parser.add_argument('--vectors', required=False, type=int, help='number of vectors', default=300) parser.add_argument('--mtx', required=False, help='path to mtx file', nargs="+", default='none') args = parser.parse_args() xclbin_opt = gemx.parse_cfg(args.cfg) if args.engine == 'spmv': gemx.createSPMVHandle(args, xclbin_opt) else: gemx.createFCNHandle(args, xclbin_opt) A_buf = [] B_buf = [] C_buf = [] bias_buf = [] nnz_size = [] if args.engine == 'spmv': min_row = int(xclbin_opt["GEMX_spmvMacGroups"]) * int( xclbin_opt["GEMX_spmvWidth"]) min_col = int(xclbin_opt["GEMX_ddrWidth"]) if args.mtx == 'none': #read matrix size from args.matrix
parser.add_argument('--model', required = True, help='model') parser.add_argument('--xclbin', required = True, help='file path to FPGA bitstream') parser.add_argument('--cfg', required = True, help='file describing properties of .xclbin') parser.add_argument('--gemxlib', required = True, help='file path to GEMX host code shared library') parser.add_argument('--engine', default = 'fcn', choices=['fcn','spmv','uspmv'],help='choose fcn, spmv, uspmv engine') parser.add_argument('--train', default = False, help='set to True if retrain the model') args = parser.parse_args() xclbin_prop = gemx.parse_cfg(args.cfg) #load xclbin if args.engine == 'fcn': gemx.createFCNHandle( args, xclbin_prop ) elif args.engine == 'uspmv': gemx.createUSPMVHandle( args, xclbin_prop ) else: gemx.createSPMVHandle( args, xclbin_prop ) train_fd = pd.read_csv(args.data) # Load training data. IDcol = 'Run' # A column used to identified the run for data collection; not an independent variable. target = 'Class' # The column name for our dependent variable. predictors = [x for x in train_fd.columns if x not in [target, IDcol]] # Define column names to use as independent variables. # Encode class values as integers encoder = LabelEncoder() encoder.fit(train_fd[target]) encoded_Y = encoder.transform(train_fd[target]) # Convert integers to dummy variables (i.e. one hot encoded) train_y = np_utils.to_categorical(encoded_Y) num_classes = len(train_fd[target].unique()) model = create_keras_model(train_fd[predictors].values.shape[1],num_classes)