Code Monkey home page Code Monkey logo

modelbench's Introduction

ModelBench

Instructions on benching AI model with anonymous compiler

Docker

Docker

Setup ENV

use following cmd to install ipex and intel ai model zoo.

source setup_env.sh

Bench Bert Large

Please refer to Simplified Bert Large Inference. The detailed guidance is in Detailed Bert Large Inference

Bench DLRM

Please refer to Simplified DLRM Inference. The detailed guidance is in Detailed DLRM Inference

Manual Config (has been integrated in bench_bert.sh / bench_dlrm.sh)

By default, only int8 mode of IPEX will run into oneDNN Graph. If you want to benchmark the performance under fp32 mode with oneDNN Graph and Anonymous Compiler, you need to manually do some modification on IPEX and Model Zoo source code. For IPEX, navigate to [IPEX_ROOT]/csrc/jit/codegen/onednn/interface.cpp and change the value of llga_fp32_bf16_enabled from false to true:

bool llga_fp32_bf16_enabled = true;

Then re-build IPEX:

export DNNL_GRAPH_BUILD_COMPILER_BACKEND=1
python setup.py install

For Model Zoo Scripts, you need to search for the model’s main script and comment out the ipex.optimize in the corresponding dtype’s condition branch. For instance, as for DLRM model under fp32 mode, navigate to dlrm_s_pytorch.py, comment out the following code:

dlrm = ipex.optimize(dlrm, dtype=torch.float, ...)

Note that, the above changes need to be reverted when you are running in int8 mode. As for benchmark AI models, you can follow the instructions on Bert Large and DLRM to prepare the model specified dependency and datasets. For bench DLRM model, you need to modify the below two args to switch to throughput mode (32 cores per instance).

OMP_NUM_THREADS=1 => OMP_NUM_THREADS=32
-share-weight-instance=$Cores => -share-weight-instance=0

Switch Anonymous Compiler and oneDNN

By default, anonymous compiler is enabled on IPEX. To get oneDNN's performance data on end-to-end model, you need to set the below environment variable:

export _ONEDNN_GRAPH_DISABLE_COMPILER_BACKEND=1

Evaluation and expected result

To check whether the Anonymous Compiler is enabled or not, you can check the graph verbose (via export ONEDNN GRAPH VERBOSE=1). You will see the below outputs from verbose once compiler backend is enabled.

onednn_graph_verbose,info,backend,0:compiler_backend
onednn_graph_verbose,info,backend,1:dnnl_backend

modelbench's People

Contributors

crazydemo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.