Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java api run slowerly than Python #81

Open
benlihua opened this issue Mar 16, 2023 · 1 comment
Open

Java api run slowerly than Python #81

benlihua opened this issue Mar 16, 2023 · 1 comment

Comments

@benlihua
Copy link

I compared java and python performance with CPU and MKL enabled, Java(20ms) is much slower than Python(10ms).

BERT parameters:
batch_size=1, seq_length=24, num_hidden_layers=6, num_attention_heads=12
ENV variables:
export OMP_NUM_THREADS=8
export KMP_BLOCKTIME=0
export KMP_AFFINITY=granularity=fine,verbose,compact,1,0

Then I tested Java Native Api(JNI) instead of JNA, it's also the same phenomenon. I suspect that it's something about cuBERT.so (maybe MKL configuration) making java run slower than python?

@benlihua
Copy link
Author

benlihua commented Mar 16, 2023

I think I found the problem. when set MKL_VERBOSE=1, java show "MKL_VERBOSE Intel(R) MKL 2019.0 Update 3 Product build 20190220.." and python show "MKL_VERBOSE oneMKL 2021.0 Update 4 Product build 20210904...". So the old version of MKL may show worse performance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant