Пример #1
0
                    type=int,
                    required=False,
                    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"])
Пример #2
0
                        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', 'uspmv'],
                        help='choose fcn, 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)
    else:
        gemx.createUSPMVHandle(args, xclbin_prop)

    (x_train, y_train), (x_test, y_test) = reuters.load_data(num_words=1000,
                                                             test_split=0.2)
    tokenizer = Tokenizer(num_words=1000)
    num_classes = np.max(y_train) + 1

    model = create_keras_model(num_classes)
    model.load_weights(args.model)